Compare commits

...

1054 Commits

Author SHA1 Message Date
Jonathan G Rennison ffbc5aff6d Fix various formatting and spelling issues 2 days ago
Jonathan G Rennison de36e9545e Merge branch 'master' into jgrpp
# Conflicts:
#	src/cargopacket.h
#	src/cargotype.h
#	src/station_base.h
#	src/station_cmd.cpp
#	src/timer/timer_game_common.h
#	src/town.h
2 days ago
Peter Nelson 4b169426dc Fix #12764: Crash when opening Detailed performance rating window with no companies. (#12765)
(cherry picked from commit df1b6a933bc0208e4b62d6ee44359a15fa2354fe)
2 days ago
Jonathan G Rennison fff46974fd Scheduled dispatch: Allow naming departure slot tags 2 days ago
Jonathan G Rennison fe294403aa Add std::string_view variant of SetDParamStr 2 days ago
Jonathan G Rennison ef91ed1dfb Scheduled dispatch: Fix string names for departure tag 2 days ago
Jonathan G Rennison 6a03992a03 Scheduled dispatch: Add dividers to management dropdowns 2 days ago
Jonathan G Rennison c8ce89ff89 Fix stack alignment issues with 32 bit MinGW
Set incoming and preferred alignment to 4 bytes to match Win32 standard

See: #704
3 days ago
Jonathan G Rennison c67f14dc88 Merge branch 'master' into jgrpp
# Conflicts:
#	src/fileio.cpp
#	src/fileio_func.h
#	src/industry_cmd.cpp
#	src/ini.cpp
#	src/openttd.cpp
#	src/os/windows/win32_main.cpp
#	src/settingsgen/settingsgen.cpp
#	src/strgen/strgen.cpp
#	src/strings.cpp
5 days ago
Jonathan G Rennison 79fe829e98 Allow road vehicle overtaking in road waypoint tiles 5 days ago
Jonathan G Rennison 102ba8932e Remove use of non-threadsafe strerror
Add helper class to use strerror_r or strerror_s
5 days ago
Jonathan G Rennison 81ba704477 Fix e53998ec0: Incorrect handling of changed path separators in strgen 5 days ago
Qwest8K 162015433e
Update: Russian translation to ''af102d1'' commit (#703)
Update: Russian translation to ''af102d1''
6 days ago
Jonathan G Rennison e53998ec01 Merge branch 'master' into jgrpp
# Conflicts:
#	src/cheat_gui.cpp
#	src/industry_gui.cpp
#	src/linkgraph/linkgraphschedule.cpp
#	src/misc/getoptdata.h
#	src/music/dmusic.cpp
#	src/network/core/os_abstraction.cpp
#	src/newgrf_engine.cpp
#	src/openttd.cpp
#	src/order_gui.cpp
#	src/os/windows/win32.cpp
#	src/pathfinder/npf/queue.cpp
#	src/smallmap_gui.cpp
#	src/strgen/strgen.cpp
7 days ago
Jonathan G Rennison af102d123b Add button to toggle train purchase window dual pane mode 1 week ago
Jonathan G Rennison 8a134d0f94 Fix narrowing cast warning 1 week ago
Jonathan G Rennison 827146de00 Dirty settings window when using mode toggle in signal window 1 week ago
Jeremy Gao bca37ef9e7 Change: correct punctuations in zh_CN 1 week ago
Jonathan G Rennison fa9db4ed6d Debug: Fix missing newlines in multi-line vehicle flags 1 week ago
Jonathan G Rennison f9b75ed304 Merge branch 'master' into jgrpp
# Conflicts:
#	cmake/scripts/FindVersion.cmake
#	src/airport_gui.cpp
#	src/industry_gui.cpp
#	src/newgrf.cpp
#	src/newgrf_class_func.h
#	src/newgrf_object.h
#	src/newgrf_roadstop.cpp
#	src/newgrf_roadstop.h
#	src/object_gui.cpp
#	src/rail_gui.cpp
#	src/road_cmd.h
#	src/road_gui.cpp
#	src/station_cmd.h
#	src/strings.cpp
#	src/waypoint_cmd.h
1 week ago
Jonathan G Rennison 2aefeec225 Fix infrastructure totals when removing canals in ForceClearWaterTile 1 week ago
Jonathan G Rennison 226c3d5d17 Apply limit train acceleration setting before acceleration scaling
See: #699
1 week ago
Jonathan G Rennison c3829f5088 Show scheduled dispatch tag in order window 1 week ago
Jonathan G Rennison 9aca7ed2b4 Fix logging of game load times in crash and desync logs 2 weeks ago
Jonathan G Rennison 05915b2129 Fix handling of reservations when reserving at one way tunnel-bridge exit 2 weeks ago
Alistair Lynn 7ef8706ed2 Add: Setting to uniformly slow the acceleration and braking of realistic trains
This does not affect the maximum speed.
2 weeks ago
Jonathan G Rennison 0351734729 Fix narrowing warning using packet GetDeserialisationPosition 2 weeks ago
Jonathan G Rennison 7997430688 Add various missing includes 2 weeks ago
Jonathan G Rennison f09f412c43 Add hash table index to EngineOverrideManager
Use for EngineOverrideManager::GetID lookups
2 weeks ago
Jonathan G Rennison 556722399a Move EngineOverrideManager to separate header 2 weeks ago
Jonathan G Rennison b42d12deb2 Add do/while wrappers around grfmsg/GrfMsg 2 weeks ago
Jonathan G Rennison 32b8ec34ff Merge branch 'master' into jgrpp
# Conflicts:
#	src/autoreplace_gui.cpp
#	src/build_vehicle_gui.cpp
#	src/cheat_gui.cpp
#	src/company_gui.cpp
#	src/debug.cpp
#	src/engine_gui.h
#	src/error_gui.cpp
#	src/group_gui.cpp
#	src/industry_cmd.cpp
#	src/industry_gui.cpp
#	src/misc_gui.cpp
#	src/network/network_gui.cpp
#	src/newgrf.cpp
#	src/newgrf_debug_gui.cpp
#	src/newgrf_gui.cpp
#	src/order_gui.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
#	src/saveload/saveload.cpp
#	src/screenshot_gui.cpp
#	src/sound/win32_s.cpp
#	src/statusbar_gui.cpp
#	src/strgen/strgen.cpp
#	src/table/newgrf_debug_data.h
#	src/timetable_gui.cpp
#	src/toolbar_gui.cpp
#	src/town_gui.cpp
#	src/vehicle_gui.cpp
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
#	src/viewport.cpp
2 weeks ago
Jonathan G Rennison c6c7191b16 Avoid unnecessary allocation of temporaries in layout line cache 2 weeks ago
Jonathan G Rennison 99e6b75337 Move NewGRF sprite dump declarations to new header file 2 weeks ago
Jonathan G Rennison dc6ba9b9d8 Move NewGRF shadow copy groups into internal header 2 weeks ago
Jonathan G Rennison 56356bb761 Change container type for several uses of std::map/std::set 2 weeks ago
Jonathan G Rennison 853ed272be Merge branch 'master' into jgrpp
# Conflicts:
#	src/airport_gui.cpp
#	src/blitter/32bpp_optimized.cpp
#	src/blitter/32bpp_simple.cpp
#	src/blitter/32bpp_sse2.cpp
#	src/blitter/8bpp_optimized.cpp
#	src/blitter/8bpp_simple.cpp
#	src/blitter/null.cpp
#	src/build_vehicle_gui.cpp
#	src/company_gui.cpp
#	src/crashlog.cpp
#	src/dropdown.cpp
#	src/dropdown_type.h
#	src/genworld_gui.cpp
#	src/gfx.cpp
#	src/main_gui.cpp
#	src/newgrf_debug_gui.cpp
#	src/news_gui.cpp
#	src/news_type.h
#	src/openttd.cpp
#	src/order_gui.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/signs.cpp
#	src/smallmap_gui.cpp
#	src/spritecache.cpp
#	src/spriteloader/grf.cpp
#	src/texteff.cpp
#	src/toolbar_gui.cpp
#	src/town_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/video/opengl.cpp
#	src/viewport.cpp
#	src/waypoint_cmd.cpp
#	src/zoom_type.h
2 weeks ago
Jonathan G Rennison cb1e41fc88 Remove use of memcmp in CheckCaches 2 weeks ago
Jonathan G Rennison 2b539a2d37 Fix water infrastructure total when changing owner of object on water 3 weeks ago
Jonathan G Rennison 1e9fb74451 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/release-windows.yml
#	src/autoreplace_gui.cpp
#	src/cargotype.cpp
#	src/company_base.h
#	src/company_cmd.cpp
#	src/company_gui.cpp
#	src/currency.h
#	src/date_gui.cpp
#	src/dropdown.cpp
#	src/dropdown_func.h
#	src/dropdown_type.h
#	src/game/game_gui.cpp
#	src/genworld.cpp
#	src/genworld_gui.cpp
#	src/ground_vehicle.hpp
#	src/group_gui.cpp
#	src/house.h
#	src/industry_gui.cpp
#	src/network/network_client.cpp
#	src/network/network_server.cpp
#	src/network/network_type.h
#	src/newgrf_class_func.h
#	src/newgrf_house.cpp
#	src/newgrf_roadstop.h
#	src/openttd.cpp
#	src/order_gui.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/screenshot_gui.cpp
#	src/settings_gui.cpp
#	src/settings_type.h
#	src/slider.cpp
#	src/smallmap_gui.cpp
#	src/station_cmd.cpp
#	src/stdafx.h
#	src/survey.cpp
#	src/tile_map.h
#	src/town_cmd.cpp
#	src/town_gui.cpp
#	src/vehicle.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
3 weeks ago
Jonathan G Rennison cbea3b8b46 Add console command to merge two companies 3 weeks ago
Jonathan G Rennison f2f8692fb2 Add setting to allow track editing to ignore realistic braking restrictions 3 weeks ago
Jonathan G Rennison 7874fb7a12 Add public key auth support for settings_access console command 3 weeks ago
Jonathan G Rennison 84a0dd326f Merge branch 'master' into jgrpp
# Conflicts:
#	src/console_cmds.cpp
#	src/network/core/config.h
#	src/network/core/packet.h
#	src/network/core/tcp.cpp
#	src/network/core/tcp_game.cpp
#	src/network/core/tcp_game.h
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_gui.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/table/settings/network_secrets_settings.ini
3 weeks ago
Jonathan G Rennison effaf6acc4 Allow removing reservation boundary signal in realistic braking
All other operations were permitted so only disallowing removal
was not useful and could be trivially bypassed
3 weeks ago
Jonathan G Rennison 431a6a1262 Allow sorting by average order occupancy in shared order group mode
See: #698
3 weeks ago
Jonathan G Rennison d39bdd352b Merge PR #700 into jgrpp 3 weeks ago
pvillaverde dc465000f7 🌐 Update Galician Translations 2024-05-26 3 weeks ago
Jonathan G Rennison 1d70c781c6 Fix vehicle window showing profit last year in wallclock timekeeping mode 3 weeks ago
Qwest8K 6dfe5c4da9
Update: Russian translation (#695)
Russian localization update
3 weeks ago
Jonathan G Rennison a8d830aa3e Fix signal side when using both sides signal style with no-entry signals 4 weeks ago
Jonathan G Rennison a24d72f0d7 Fix flag values in CustomSignalSpriteContextFlags 4 weeks ago
Jonathan G Rennison 8907b9aa31 Reduce diff with upstream for console command functionality 4 weeks ago
Jonathan G Rennison 88d7be1d99 Change FormatArrayAsHex to be uppercase by default
To match upstream
4 weeks ago
Jonathan G Rennison 48910a8b7d Version: Committing version data for tag: jgrpp-0.59.1 4 weeks ago
Jonathan G Rennison 5e971bfc02 Fix abstract filetype not being set for network client join savegames 4 weeks ago
Jonathan G Rennison fc5b3b90b4 Remove incorrect assertion as temporary fix for #692
See: https://github.com/OpenTTD/OpenTTD/issues/12651
4 weeks ago
Rubidium 1d13ac7280 Fix #12655, 4f6d75f: inconsistent state in client list and potential crash after client leaves
(cherry picked from commit f939e81bf0)
4 weeks ago
Peter Nelson f62eb72fcb Fix #12685: nullptr dereference when checking for equal loaded/loading groups. (#12686)
Always treat empty groups as non-equal. Given that the case of both being empty is handled earlier, they cannot both be equal and empty.

Additionally if a loaded or loading set are all the same, only add one reference.

(cherry picked from commit 856ec901ca)
4 weeks ago
Jonathan G Rennison 3df3ed6690 Reduce frequency of brake overheating breakdowns
Decay overheat state more quickly
Avoid double-triggering overheating
Make overheating speed-dependent
4 weeks ago
Jonathan G Rennison 66d03530dc Adjust handling of vehicle subspeed with realistic braking
In particular when descending a steep slope with insufficient braking
4 weeks ago
Jonathan G Rennison 6d1f3b673e Fix non-percentage servicing interval when using wallclock mode 4 weeks ago
Jonathan G Rennison 89902c8ab1 Fix advisory max speed being higher than strict max for reservation end
In GetCurrentMaxSpeedInfoInternal
4 weeks ago
Jonathan G Rennison 242e87652b Fix setting display for industry cargo scaling 1 month ago
Jonathan G Rennison b81da24a64 Fix setting default value for industry cargo scaling mode in old saves 1 month ago
Jonathan G Rennison bdd1d36bd9 Fix road vehicle restart loading at same station when using implicit orders 1 month ago
TELK b1faf3d39f Update: Korean translation 1 month ago
TELK d3fc9997d1
Update: Korean translation up to 0.59.0 (#689)
* Update: Korean translation up to 0.59.0

* Update: Korean translation up to fc4ea241

* Update: Korean translation / missing ones
1 month ago
Peter Nelson d7f029344f Codechange: Don't delete news items or NewGRF window when EffectVehicle is deleted. (#12334)
EffectVehicles never create news and can't be debugged, so searching for news items and windows to delete just wastes time.

(cherry picked from commit 737e3feaf0)
1 month ago
Jonathan G Rennison fc4ea241b0 Merge branch 'master' into jgrpp 1 month ago
Jonathan G Rennison 6d4f616706 Fix crash when sorting by capacity in autoreplace window
Move capacity cache into GUIList sort parameter

See: #690
1 month ago
Jonathan G Rennison 5e24882c18 Use template specialisation for GUIList parameter reference/init behaviour 1 month ago
Jonathan G Rennison 18a42664fc Merge branch 'master' into jgrpp
Remove 'byte' typedef
1 month ago
Jonathan G Rennison f1c0f864f5 Add setting to shorten vehicle view status text 1 month ago
Jonathan G Rennison 0a0b42a931 Bump OpenTTD content version to 14.1 1 month ago
Jonathan G Rennison 3e57319c0b Fix SDL keycode to vkey mapping 1 month ago
Jonathan G Rennison eccffec758 Version: Committing version data for tag: jgrpp-0.59.0 1 month ago
Peter Nelson 6de4fa921c Change: Use standard padding for company password window.
Also use now-established OnResize pattern for setting height of password warning widget.

(cherry picked from commit 0090431e99b8301c9e3ee14fb3435075708294d5)
1 month ago
Jonathan G Rennison f993e30850 Take cargo refit into account in build vehicle window capacity sort modes 1 month ago
Jonathan G Rennison 1e5c96ef87 De-duplicate filling TestedEngineDetails in build vehicle windows 1 month ago
Jonathan G Rennison fe374a1db0 Allow sorting by cargo capacity/running cost in dual pane train purchase window 1 month ago
Jonathan G Rennison 126173a839 Fix text filter in dual-pane purchase window with GRF custom names 1 month ago
Jonathan G Rennison 6dab30f928 Documentation: Remove random_bits variable from road stops (NML) 1 month ago
Jonathan G Rennison 6ef682cf44 Documentation: Fix typo 1 month ago
Jonathan G Rennison a413ddfd82 Readme: Expand introduction section a bit 1 month ago
Jonathan G Rennison 4f7fa73140 Readme: Remove various things which have been upstreamed 1 month ago
Jonathan G Rennison e89a40994a Reduce diff with upstream for fileio.cpp 1 month ago
Peter Nelson a2bd2efec1 Codechange: Remove support for links in tar files. (#12571)
This was a feature to support the original 32bpp sprite system and is no longer relevant.

(cherry picked from commit ef55cc7979)

# Conflicts:
#	src/fileio.cpp
1 month ago
Loïc Guilloux 716ba5fd2a Fix #12584: Improved error handling during tar scan (#12586)
(cherry picked from commit 99b74c1064)

# Conflicts:
#	src/fileio.cpp
1 month ago
Peter Nelson 8769318653 Codechange: Ensure SDLK mappings stay in the expected order. (#12608)
Add a constexpr constructor that ensures at compile-time that the source SDLK range matches the target range.

(cherry picked from commit 90029beb49)

# Conflicts:
#	src/video/sdl2_v.cpp
#	src/video/sdl_v.cpp
1 month ago
Fen fd183914c8 Fix 2d27e8e: Update numpad keycodes for SDL2, making it usable (#12596)
* Fix 2d27e8e: Update numpad keycodes for SDL2, making it usable

* Cleanup: List sdl2 numpad mappings individually

(cherry picked from commit 2559bdfa6f)
1 month ago
Jonathan G Rennison f1334b9854 Documentation: Fix typo 1 month ago
Calvin Sykes 69cb68a3e2 Override remain at station behaviour for road vehicles with explicit stop direction set
(cherry picked from commit 8f8d635baf3dc1506de206a3378498bedfd020bf)

See: #686
2 months ago
Jonathan G Rennison 247b40c95b Adjust setting texts for show running costs per year setting 2 months ago
Jonathan G Rennison d90c540f9e Enable economy day length scaling in wallclock timekeeping mode 2 months ago
Jonathan G Rennison 9a07f14f56 Show running costs in calendar years by default 2 months ago
Jonathan G Rennison c5cd598217 Debug: Log number of GRFs at level sl=2 when loading a game
Add helper to get the number of non-static GRFs in a GRF config
2 months ago
Jonathan G Rennison adc7840f01 Scheduled dispatch: Caveat text for number of vehicles required 2 months ago
Jonathan G Rennison a14f850f33 Debug: Show unreachable error groups in sprite dump when show details enabled 2 months ago
Peter Nelson 96ddabb30c Codechange: Remove write-only spec_id from RoadStopSpec. (#12582)
Comment is incorrect about its value too.

(cherry picked from commit 72c55128d2)
2 months ago
Jonathan G Rennison 991b7a958e Do not reset lateness on auto-timetable congestion detection, when using scheduled dispatch 2 months ago
TELK b39bd33c1c
Update: Korean translation up to 980de73 (#688)
* Update: ko-KR / Colouring some setting

* Update: Korean translation - time

* Update: Korean translation up to 980de735
2 months ago
Jonathan G Rennison 29871e412c Fix 69e7c1697: Add missing include for MSVC 2 months ago
Jonathan G Rennison ce40e85ccc Fix ROADSTOP_DRAW_MODE_WAYP_GROUND when used with RSF_DRAW_MODE_REGISTER 2 months ago
Jonathan G Rennison 07cfa5f602 Fix documentation comment for RSF_DRAW_MODE_REGISTER 2 months ago
Jonathan G Rennison 980de7353d TBTR: Fix replacement servicing condition when using infinite money 2 months ago
Jonathan G Rennison 69e7c1697e Win32: Increase buffer size and count in wave out sound driver
Ensure that wave structs are zero-inited and buffers are freed
2 months ago
Jonathan G Rennison 3136f08b86 Debug: Fix display of engine cargo age period and reliability decay speed 2 months ago
Jonathan G Rennison 33baceaef7 Maintain timer sort invariants when changing period
See: https://github.com/OpenTTD/OpenTTD/issues/12509
2 months ago
Jonathan G Rennison 674642f9cc Add a priority field to TimerGameTick::TPeriod
Use this as the primary sort key for TimerGameTick::TPeriod,
to avoid container sort order changes on timer period saveload.
2 months ago
Jonathan G Rennison d5b8f51bf9 Rename variable to fix Windows header name collision 2 months ago
Jonathan G Rennison 71227f61d8 Use MoveFileExW to implement FioRenameFile on Windows
This is to allow renaming over an existing file
2 months ago
Jonathan G Rennison 083d91a582 Remove use of shell API function for rename 2 months ago
Peter Nelson 653e217bb1 Fix: Signature validation did not close its file. (#12479)
(cherry picked from commit 3316b27496)
2 months ago
Peter Nelson 8fdc91bd9f Fix a29766d: Wrong scrolling dropdown list position with RTL. (#12412)
(cherry picked from commit 9750826590)
2 months ago
Loïc Guilloux 54093fb8b2 Fix: [Win32] Force font mapper to only use TrueType fonts (#12406)
(cherry picked from commit 11aa3694fa)
2 months ago
Jonathan G Rennison 98dc6c3c81 Fix NewGRF byte order when using -q 2 months ago
Peter Nelson ae16df2d61 Fix #12497: Add workaround for motion_counter being implemented correctly.
#12229 stopped updating motion_counter for non-engine parts of trains, and in doing so accidentally followed the spec for NewGRF var 46, which breaks NewGRFs that used to... accidentally work.

Make var 46 return motion_counter of the first engine, regardless of self or parent scope. This means var 46 is always in sync with the head engine, and avoids further changes to when motion_counter is updated.

(cherry picked from commit 9539b02455f672e11f3ac32302a00cffa5507770)
2 months ago
Jonathan G Rennison 6056a00222 Fix incorrect train weight used for infrastructure sharing track fees 2 months ago
Jonathan G Rennison 0150f8f570 Merge branch 'master' into jgrpp
# Conflicts:
#	src/network/network_server.cpp
2 months ago
Jonathan G Rennison e17c6da46a Fix industry cargoes when loading newer vanilla savegames 2 months ago
Jonathan G Rennison d70c824056 Linkgraph: Increase effect strength of distance scaling setting
Updates: 3d049895
2 months ago
Jonathan G Rennison d52d447603 Update station/industry nearby lists in BuildOilRig
See: https://github.com/OpenTTD/OpenTTD/issues/12506
2 months ago
Rubidium b2218e75d4 Codefix: missing space between close parenthesis and open curly brace 2 months ago
Jonathan G Rennison 41543498f4 Fix ships leaving dots behind in viewport map mode
Fixes: 57db9a41
2 months ago
Jonathan G Rennison 1e38e513ae Fix EnginesDailyLoop being called on new economy day instead of calendar 2 months ago
Peter Nelson 48eb9b8bc9
Add: Check that towns can build roads before generating map. (#12503) 2 months ago
translators 8e2ccddd77 Update: Translations from eints
portuguese (brazilian): 2 changes by pasantoro
2 months ago
Peter Nelson 3ad143c43a
Codechange: Use `x = y` instead of `x{y}` for value-type member initialisation. (#12501)
This is easier to read and less likely to look like an array definition.
2 months ago
Koen Bussemaker 672aa014d8 Doc: Updated Visual Studio, cpp standard and Cmake version 2 months ago
ladysadie 727392e0b3
Codechange: Remove per font AA settings. (#12413)
OpenTTD will use the global AA font setting for all fonts from now on.
2 months ago
Peter Nelson a1b03ee69e
Codechange: Replace platform-specific calls with std::filesystem::last_write_time. (#12487) 2 months ago
dP f5a50a874f
Codechange: Update doxygen comment to reflect removed parameter (#12499) 2 months ago
translators cd108fd9e4 Update: Translations from eints
greek: 10 changes by gh658804
2 months ago
Jonathan G Rennison 0dcbcedbac Fix ScriptRail::BuildSignal when using realistic braking with block signals 2 months ago
Peter Nelson 839f486074
Codechange: Use directory_iterator to find language files. (#12495)
This avoids using custom ttd_opendir, along with C-style string comparisons against file names.
2 months ago
Peter Nelson 4eaeccdaeb
Codechange: Introduce FioRemove() to remove files. (#12491)
New function FioRemove() handles OTTD2FS conversion, and uses std::filesystem::remove instead of unlink, all in one location.
2 months ago
FedelloKirfed 46d71463d9 🌐 Update Galician Translations 2024-04-14 2 months ago
translators 29e932e087 Update: Translations from eints
ukrainian: 13 changes by imlystyi
lithuanian: 19 changes by dziugas1959
french: 7 changes by ottdfevr
portuguese (brazilian): 14 changes by pasantoro
2 months ago
translators 090c3b3abf Update: Translations from eints
danish: 5 changes by bscargo
dutch: 5 changes by Afoklala
portuguese (brazilian): 7 changes by pasantoro
2 months ago
Peter Nelson e83e2df023
Fix: Build industry window did not take width of count into account. (#12476) 2 months ago
Peter Nelson 12125bad82
Fix 3de8853e: Industry cargo types callback no longer functioned due to container change. (#12489)
Use defined INDUSTRY_NUM_INPUTS/INDUSTRY_NUM_OUTPUTS values instead of container size, which is now empty at this point.
2 months ago
Peter Nelson c1520cf682
Fix 25aeb1c: Driver parameter documentation was not updated. (#12486) 2 months ago
Peter Nelson ca73f03334
Codechange: Use std::filesystem::remove/rename in settingsgen. (#12483) 2 months ago
Peter Nelson 44b8210037
Codechange: settingsgen's CopyFile actually appends. (#12485) 2 months ago
Peter Nelson 003906becb
Codechange: std::filesystem::rename does not need remove first. (#12484) 2 months ago
translators bb9b8b90c7 Update: Translations from eints
swedish: 6 changes by sereneavatar
portuguese (brazilian): 11 changes by pasantoro
2 months ago
Peter Nelson 9915c1f032
Fix #12477: Use std::filesystem::rename instead of Windows Shell API call. (#12478) 2 months ago
Rubidium eda10abc8c Codechange: pass command line arguments as std::span to openttd_main 2 months ago
Peter Nelson 3316b27496
Fix: Signature validation did not close its file. (#12479) 2 months ago
Rubidium afd7878de0 Codechange: internally use a span of arguments for GetOptData 2 months ago
Rubidium 5592b4409b Codechange: use ranged for loop and separate function instead of goto 2 months ago
Rubidium e8a56db21d Codechange: use designated initializers for OptionData and pass as span 2 months ago
Rubidium 4f2412a272 Codechange: range based for loops instead of C-style for loops 2 months ago
Rubidium 2587a21400 Codechange: use zero-initialization instead of C-style loop 2 months ago
Rubidium ff27b9e76a Codechange: use std::any_of instead of custom loop 2 months ago
translators 6cade18053 Update: Translations from eints
portuguese (brazilian): 1 change by pasantoro
polish: 1 change by pAter-exe
2 months ago
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2 months ago
Peter Nelson 6bc4a62c27 Codechange: Pass std::string_view from blitters instead of char *. 2 months ago
Peter Nelson 332cbca36e Codechange: Pass std::string_view from drivers instead of char *. 2 months ago
Peter Nelson a42aa1a086
Codechange: Remove cargo_suffix C-array from GetIndustryString. (#12472)
The information is pushed onto a vector, so string ownership can be moved there instead of using a pointer into to the CargoSuffix array.
2 months ago
Jonathan G Rennison 40644f21d4 Version: Committing version data for tag: jgrpp-0.58.3 2 months ago
Jonathan G Rennison 6642b7e12c Temporary fix for click/tooltip alignment of cargo lines in industry chains window
See: #681
See: https://github.com/OpenTTD/OpenTTD/issues/12465
2 months ago
Peter Nelson 144bcbbaf1
Fix: Use clear() to clear std::string. (#12471) 2 months ago
Rubidium 21b640b5ff Codechange: simplify president name generation 2 months ago
Jonathan G Rennison 8e0fa32d33 Fix merge/editing error in IndustryCargoesWindow 2 months ago
Patric Stout 1b4bb1d38a
Codefix: [CMake] use the UTC0 date for our ISODATE (#12470) 2 months ago
translators f0f97c698b Update: Translations from eints
norwegian (bokmal): 11 changes by eriksorngard
russian: 5 changes by Ln-Wolf
spanish: 5 changes by MontyMontana
portuguese (brazilian): 7 changes by pasantoro
2 months ago
Jonathan G Rennison 3d04989507 Link graph: Change distance scaling algorithm in demand scaler
Fix erratic scaling and increase effect at large setting values
2 months ago
Peter Nelson 1773c5b810
Change: Increase object/station/roadstop class limit. (#12094)
The class limit is arbitrary and not stored in game state.

This change prevents all entities in classes after the 255th class from being dumped into the first class.
2 months ago
Rubidium df8eeb1b10 Codechange: use C++ algorithms to determine the SaveLoadFormat 2 months ago
Peter Nelson 77f27e0804 Change: Expose NewGRF classes and specs as spans and simplify iteration.
This replaces some index-based loops with range loops.
2 months ago
Peter Nelson 052f421327 Change: Use vector/iterators/algorithms instead of C-array/loops for NewGRF classes. 2 months ago
Peter Nelson 34758d0921 Change: Allow string mapping by function instead of pointer.
This allows mapping of strings to objects that may be moved between loading stages.
2 months ago
Peter Nelson 90ca3515da
Fix #12459, f6a88e4: Crashes when deleting news messages. (#12460)
The updated logic in f6a88e4 for deleting news messages did things in the wrong order.
2 months ago
Jonathan G Rennison 3712b84d2e Fix narrowing conversion warnings 2 months ago
Peter Nelson 2976a46d06
Fix 54be756: Terminating NUL byte was not skipped in ReadString(). (#12462) 2 months ago
Rubidium 883d3e7a9f Codechange: use std::span instead of pointer + length 2 months ago
Peter Nelson 54be756aae
Codechange: Pass NewGRF strings as std::string_view instead of char *. (#12461) 2 months ago
Peter Nelson dc7c2bb30d
Fix: Draw continuation lines for engine variant hierarchy tree. (#12434) 2 months ago
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2 months ago
translators b5ad28022d Update: Translations from eints
english (au): 5 changes by krysclarke
chinese (simplified): 1 change by WenSimEHRP
catalan: 7 changes by J0anJosep
portuguese (brazilian): 27 changes by pasantoro
2 months ago
Peter Nelson 1b127628cb
Codechange: Use dynamic_cast with FindWindowById. (#12458)
Missed from 74e09ab.
2 months ago
Rubidium bf0cb3c43f Codechange: let lengthof fail when anything that isn't a C-style array is passed
(cherry picked from commit 97bea563d7)
2 months ago
Jonathan G Rennison 28e74005d0 Remove various uses of lengthof on std::array 2 months ago
Rubidium 919830db7a Fix: do not use lengthof() for non C-style arrays
(cherry picked from commit c544a2be0a)
2 months ago
Peter Nelson c5b854a422 Codechange: Avoid lengthof() on std::array.
(cherry picked from commit 295508fc53)
2 months ago
Peter Nelson 9b830e9eb2 Fix: Aircraft crash counter was too low to reach ground. (#12425)
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.

(cherry picked from commit 83da886093)
2 months ago
Peter Nelson cc6322e0a3 Fix #12233: Mini order list overlaps vehicle group name. (#12423)
Move mini order list down one line to make room.

(cherry picked from commit e8c78df39e)
2 months ago
Peter Nelson df03366cf5 Fix #12114: Viewport coords of crashed aircraft not updated when falling. (#12424)
This results in the aircraft glitching as the wrong viewport area is drawn.

(cherry picked from commit d11622b9a0)
2 months ago
Peter Nelson 7e28605830 Fix: Use reinterpret_cast instead of C-style cast to align pointers. 2 months ago
Peter Nelson 4daf95b878 Fix: Use static_cast instead of C-cast to avoid hidden errors. 2 months ago
Peter Nelson cdfffb551c Fix: sym->sym accidentally changed to sym prevented keys working with SDL. 2 months ago
Peter Nelson 74e09abf76
Codechange: Use dynamic_cast instead of C-cast after FindWindowById. (#12448)
dynamic_cast was used in most places, but not all.
2 months ago
Rubidium 4e6d4fcf32 Codechange: replace for loops with endof with range-based for loops 2 months ago
translators 095bdf32fe Update: Translations from eints
greek: 5 changes by gh658804
finnish: 7 changes by hpiirai
ukrainian: 56 changes by Quantom2, 14 changes by imlystyi
latvian: 14 changes by lexuslatvia
portuguese: 14 changes by azulcosta
portuguese (brazilian): 10 changes by pasantoro
polish: 5 changes by pAter-exe
2 months ago
Rubidium 62f5c595f3 Codechange: use range-based for loops and let count be correct count 2 months ago
rubidium42 4718971ccc Codechange: use std::size instead of lengthof for town names 2 months ago
Peter Nelson 995fca58a2
Codechange: Use begin/end instead of endof for some industry arrays. (#12447) 2 months ago
Rubidium d7fa614a9d Codechange: use range-based for loop for debug levels and fix global variable naming 2 months ago
Rubidium 1fcf1a136d Codechange: use single function returning std::span over two functions that return size and begin 2 months ago
Jonathan G Rennison 89e3b009c3 Fix changing sprite alignment in sprite aligner window 2 months ago
translators 0f6bf90731 Update: Translations from eints 2 months ago
Peter Nelson eb094a953c
Codefix: Social Plugins widget parts were not constexpr. (#12443)
Widget lists were made constexpr except these.
2 months ago
Peter Nelson 34ba969c74
Change: Display more useful information in sprite aligner than sprite ID. (#12439)
Sprite IDs are not useful information given they change don't refer to anything outside the loaded game.

Instead, include the filename and nfo line at minimum, and include action A or action 5 sprite replacement information if applicable.
2 months ago
Peter Nelson fbdf26800b
Codechange: Use std::initializer_list and range-for for credits window. (#12431)
Replaces C-style array, indexed looping, and char * strings.
2 months ago
Peter Nelson a4c2f0778a
Codechange: Use range-for to iterate keycode-to-name lookups. (#12429)
Replaces C-style looping.
2 months ago
Peter Nelson b905209421
Fix: Viewport signs assume small font is smaller than normal font. (#12422)
If the small font is set to a larger size than the normal font for some reason, viewport signs would be drawn incorrect as the area marked dirty only considered the normal size font.
2 months ago
Peter Nelson 830c9e2de8 Codechange: Simplify iteration of framerate performance elements. 2 months ago
Rubidium 97bea563d7 Codechange: let lengthof fail when anything that isn't a C-style array is passed 2 months ago
Rubidium c544a2be0a Fix: do not use lengthof() for non C-style arrays 2 months ago
translators eaafc57de6 Update: Translations from eints
swedish: 6 changes by joeax910
norwegian (bokmal): 2 changes by eriksorngard
chinese (simplified): 2 changes by WenSimEHRP
dutch: 2 changes by Afoklala
2 months ago
Peter Nelson 8e881471c1 Codechange: Pass replacement blitter name as string_view instead char *. 2 months ago
Peter Nelson 6771dbe62b Codechange: Use range-for to find replacement blitter. 2 months ago
Peter Nelson a866166673
Codechange: Use initializer_list and range-for for OpenTTD title. (#12430)
Replaces C-style array and looping.
2 months ago
Peter Nelson 2cc700d606
Codechange: Replace colour_dropdown array with StringID arithmetic. (#12426)
This assumes that the string colours are in order, but that is already assumed elsewhere.

Removes old C-style array access.
2 months ago
Peter Nelson 83da886093
Fix: Aircraft crash counter was too low to reach ground. (#12425)
Aircraft can float above the ground when crashed as the counter limit to reach the ground is too low.

Instead reset the counter until the aircraft reaches the ground, then continue the timer.
2 months ago
Jonathan G Rennison 1a6a4c9a6c Fix path-only signal cycle mode being ignored when using realistic braking 2 months ago
Peter Nelson e8c78df39e
Fix #12233: Mini order list overlaps vehicle group name. (#12423)
Move mini order list down one line to make room.
2 months ago
Peter Nelson d11622b9a0
Fix #12114: Viewport coords of crashed aircraft not updated when falling. (#12424)
This results in the aircraft glitching as the wrong viewport area is drawn.
2 months ago
translators df3e5ade11 Update: Translations from eints
korean: 2 changes by telk5093
portuguese (brazilian): 1 change by pasantoro
2 months ago
Peter Nelson 7572cfd103 Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
This matches expectations of what normal zoom means.
2 months ago
Peter Nelson 9854553e10 Codechange: ZOOM_LVL_SHIFT/BASE are not actually ZOOM_LVLs.
Rename to ZOOM_BASE_SHIFT and ZOOM_BASE respectively, and derive from ZOOM_LVL instead of numeric value.
2 months ago
Peter Nelson 3c94e81665 Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2 months ago
Peter Nelson 7c322ebcf1 Codechange: Define a ZOOM_LVL for minimum text effect visibility. 2 months ago
Peter Nelson 197fb00d31
Fix #12395: Ensure president name widget is tall enough. (#12419) 2 months ago
Peter Nelson 338def1b06
Fix: Segfault when using -q without providing a . character. (#12418)
Use std::filesystem::path to find extension instead of strrchr.
2 months ago
Peter Nelson f6a88e40a4
Codechange: Use std::list for News Items. (#12338) 2 months ago
translators 08cf106fc6 Update: Translations from eints
english (us): 2 changes by 2TallTyler
finnish: 2 changes by hpiirai
ukrainian: 2 changes by Quantom2
danish: 2 changes by beruic
portuguese (brazilian): 22 changes by pasantoro
2 months ago
Jonathan G Rennison a9dbd793b4 Implement Vehicle::GetCargoTile for (multi-part) ships 2 months ago
Loïc Guilloux 3cf43de059 Fix #12415, 9c49a61, df400ef: Aircraft::tile is valid only for front vehicle (#12416)
(cherry picked from commit 243c6bead3)

# Conflicts:
#	src/economy.cpp
2 months ago
Loïc Guilloux 243c6bead3
Fix #12415, 9c49a61, df400ef: Aircraft::tile is valid only for front vehicle (#12416) 2 months ago
translators 931aa39018 Update: Translations from eints
english (au): 2 changes by krysclarke
swedish: 2 changes by joeax910
greek: 2 changes by gh658804
russian: 3 changes by its5Q
catalan: 2 changes by J0anJosep
spanish: 2 changes by MontyMontana
portuguese: 2 changes by azulcosta
portuguese (brazilian): 27 changes by pasantoro
polish: 2 changes by pAter-exe
2 months ago
Peter Nelson 9750826590
Fix a29766d: Wrong scrolling dropdown list position with RTL. (#12412) 2 months ago
translators 72b5c6a591 Update: Translations from eints
vietnamese: 1 change by KhoiCanDev
greek: 83 changes by gh658804
german: 3 changes by Wuzzy2
ukrainian: 54 changes by Quantom2
spanish: 4 changes by MontyMontana
portuguese (brazilian): 2 changes by pasantoro
2 months ago
Peter Nelson 2047c27445 Codechange: Move drop down list item definitions to separate header.
This reduces the scope of the definitions which are no longer needed to create the common lists.
2 months ago
Peter Nelson 56cac21086 Codechange: Use functions to create common drop down list items. 2 months ago
Loïc Guilloux 11aa3694fa
Fix: [Win32] Force font mapper to only use TrueType fonts (#12406) 2 months ago
Peter Nelson f79ec7955a Codechange: Explicitly reset old industry data before loading games. 2 months ago
Peter Nelson 3de8853e29 Codechange: Store accepted and produced cargo in vector instead of array.
Most industries do not use the full 16 slots, so this can save a little memory and iteration time.
2 months ago
Peter Nelson bd2a92331b Codechange: Use inline and std::array for old industry structures.
This avoids separate declaration/definition, and less C-style arrays.
2 months ago
Peter Nelson 00e0021e3a Codechange: Don't assume accepted/produced slot exists. 2 months ago
Peter Nelson 295508fc53 Codechange: Avoid lengthof() on std::array. 2 months ago
Peter Nelson f6b38e8e06 Codechange: Remove optional MakeCargo() parameters that are never changed.
Default values are always used, so don't need to be parameters.
2 months ago
Peter Nelson e4fc8ef595 Codechange: Use std::span for industry cargo window instead of pointer + length. 2 months ago
merni-ns 6f36f3d714
Fix #11055: Make saveload failure error messages consistent with others (#12247)
The save/load error messages were combined using string parameters, rather than using the built-in functionality of error dialogs.
2 months ago
merni-ns 92a171c3e0
Doc: Improve the output and documentation of the font command. (#12392)
Now that the default font =/= sprite font, there is a different way to invoke the sprite font, and default size applies to default (not sprite).
Also, interface scaling now affects the font size.
2 months ago
Peter Nelson d68e5159e1
Feature: Allow base sounds set to be changed mid-game. (#12399) 2 months ago
translators 3d2a8fb60c Update: Translations from eints
welsh: 5 changes by Ansbaradigeidfran
ukrainian: 11 changes by StepanIvasyn
catalan: 1 change by J0anJosep
portuguese (brazilian): 69 changes by pasantoro
3 months ago
Peter Nelson d683ec0183
Codechange: Move dropdown and slider out of widgets directory. (#12403)
Also shuffle headers to place widget includes near end.

This leaves the widgets directory solely for defining Widget IDs.
3 months ago
Jonathan G Rennison 0008e7d769 Fix velocity unit names used in cargo payments graph window 3 months ago
Jonathan G Rennison 4d47eee48d Lang: Update tiles/day and tiles/sec unit name strings 3 months ago
Jonathan G Rennison 6e689c2b93 Fix tiles/day speed unit in wallclock mode 3 months ago
Jonathan G Rennison e041fb8b25 Fix industry window production last month string in wallclock mode 3 months ago
Jonathan G Rennison 9dc332ca59 Fix choppy audio playback of sound effects on Windows
Increase default audio buffer size

See: #680
See: 25aeb1c5
3 months ago
Rubidium d5e28a904d Fix fb9d4af: use different nonces for key exchange and stream encryption 3 months ago
translators 9954187680 Update: Translations from eints
greek: 172 changes by gh658804
ukrainian: 18 changes by StepanIvasyn
portuguese (brazilian): 9 changes by pasantoro
3 months ago
Jonathan G Rennison 083a05a179 Adjust case of vehicle list window drop down items 3 months ago
Jonathan G Rennison d31359f4d2 Saveload: Fix doc comment for SlXvGetFeatureName 3 months ago
Patric Stout 77f02faf15
Codefix 977aba73be: also update comment about removal of is_random (#12400) 3 months ago
Jonathan G Rennison 98f1fb2722 Saveload: Fix NGRF chunks being saved with incorrect table SL_ARR format
Array length prefix was missing

See also: https://github.com/OpenTTD/bananas-api/pull/456
3 months ago
translators 340c2802da Update: Translations from eints
ukrainian: 14 changes by StepanIvasyn
dutch: 3 changes by Afoklala
portuguese (brazilian): 34 changes by pasantoro
3 months ago
Patric Stout e866ca8adc
Cleanup 69d5b9d3: actually clean up all remnants of "no-thread" builds (#12398) 3 months ago
Patric Stout c0308acb03
Fix: "-q" displays NewGRF IDs in the wrong byte-order (#12397) 3 months ago
Jonathan G Rennison 9f7d25e02d TBTR: Fix head state migration when using start/stop callbacks
Don't run start/stop callbacks during head state migration
3 months ago
Jonathan G Rennison 3439d208d7 TBTR: Fix cost estimation of replacement when using wagon attach callbacks
Do not CMD_SELL_VEHICLE in cost estimation, just use the vehicle values
3 months ago
Peter Nelson 8d312b305b
Codechange: Replace currency macros with functions. (#12396) 3 months ago
translators e21c12afeb Update: Translations from eints
finnish: 39 changes by hpiirai
ukrainian: 23 changes by StepanIvasyn
danish: 1 change by bscargo
french: 1 change by Lishouuu
portuguese: 1 change by azulcosta
portuguese (brazilian): 100 changes by pasantoro
3 months ago
Peter Nelson e16b982b6a Codechange: Use iteration when dealing with all HouseSpecs. 3 months ago
Peter Nelson 3e83dcedfd Codechange: Allocate houses dynamically instead of from a fixed array.
This uses vectors for HouseSpecs and global/town building counts.
3 months ago
Peter Nelson 8746be8bf2
Codechange: Use FindVehiclesWithOrder when removing a road stop. (#12144) 3 months ago
frosch 907cb4fc53
Fix: [Script] ScriptSubsidy::GetExpireDate should return an economy-date (#12372) 3 months ago
Michael Lutz 8fb7d74dfe Fix eabb9db: Drag building of road stops should not allow mixing z levels. 3 months ago
Michael Lutz 69acc132ca Fix #12387, eabb9db: [NewGRF] Wrong tile offset passed to rail station CB 149 (slope check) 3 months ago
Loïc Guilloux 71087bb6d3
Change: [CI] Always use latest stable Xcode (#12390) 3 months ago
Jonathan G Rennison 0ba9d9bb18 Version: Committing version data for tag: jgrpp-0.58.2 3 months ago
glx22 64a67d8821 Change: [CI] Always use latest stable Xcode
(cherry picked from commit d750db9bbefe853002edea59ad72ca37a4702b6c)
3 months ago
translators ca53e134be Update: Translations from eints
swedish: 14 changes by sereneavatar
finnish: 2 changes by hpiirai
ukrainian: 18 changes by StepanIvasyn
latvian: 4 changes by lexuslatvia
portuguese (brazilian): 13 changes by pasantoro
3 months ago
Jonathan G Rennison 433484cda3
Fix #12388: Vehicle::CopyVehicleConfigAndStatistics not releasing unit number (#12389) 3 months ago
Jonathan G Rennison 315dd62bd9 Fix Vehicle::CopyVehicleConfigAndStatistics not releasing unit number
See: https://github.com/OpenTTD/OpenTTD/issues/12388
3 months ago
SamuXarick afaf452534 Fix: Changing NPF max search nodes while in-game had no effect (#12194)
(cherry picked from commit f845b4bbc3)
3 months ago
Peter Nelson 5c345f55e2 Fix #12368: Incorrect offset for click position within industry chain window. (#12370)
(cherry picked from commit 97c1738541)
3 months ago
Peter Nelson b919c412b9 Fix 2fd9096: Label for fruit incorrectly changed to `FRUI` from `FRUT`. (#12367)
(cherry picked from commit eebfb83aa2)
3 months ago
translators b8b01818ca Update: Translations from eints
english (au): 1 change by krysclarke
norwegian (bokmal): 1 change by eriksorngard
spanish (mexican): 32 changes by rgonzalez-py
english (us): 3 changes by 2TallTyler
russian: 3 changes by Ln-Wolf
ukrainian: 18 changes by StepanIvasyn
lithuanian: 6 changes by dziugas1959
portuguese (brazilian): 11 changes by pasantoro
3 months ago
Jonathan G Rennison 8e9600991a Clear vehicle unit number on load for non-primary vehicles 3 months ago
Jonathan G Rennison 459e13fc5a Remove unused command: CMD_SET_VEHICLE_UNIT_NUMBER 3 months ago
translators 575336ef43 Update: Translations from eints
swedish: 20 changes by joeax910
greek: 182 changes by gh658804
ukrainian: 11 changes by StepanIvasyn
slovak: 45 changes by puco
lithuanian: 14 changes by dziugas1959
portuguese (brazilian): 11 changes by pasantoro
3 months ago
Rubidium 8e12bd35ae Fix: server shutdown and newgame packets should be stable
The server sends shutdown and newgame (reboot) packets to any connected client.
This can be useful, so you can tell clients that are trying to join that the
server is restarting. However, that means that packets can be sent before a
version check has been done.
So, these packets should be in the stable packet range instead of the one that
is unstable and guarded by a version check.
3 months ago
Peter Nelson 4751179dc5
Codefix: Remove unused class member and extraneous spaces. (#12378) 3 months ago
Rubidium 9aa6669266 Fix: inconsistent check for client authorized status 3 months ago
Rubidium 84bbe235e4 Fix: do not send chat to clients that have not authorized yet 3 months ago
Tyler Trahan f71ada4f30
Fix #12268: Capitalize "Wait to unbunch" order string (#12375) 3 months ago
SamuXarick f845b4bbc3
Fix: Changing NPF max search nodes while in-game had no effect (#12194) 3 months ago
translators 40a75e0b8d Update: Translations from eints
swedish: 19 changes by joeax910
norwegian (bokmal): 2 changes by eriksorngard
ukrainian: 6 changes by StepanIvasyn
french: 3 changes by ottdfevr
portuguese (brazilian): 23 changes by pasantoro
polish: 1 change by pAter-exe
3 months ago
Peter Nelson 97c1738541
Fix #12368: Incorrect offset for click position within industry chain window. (#12370) 3 months ago
Peter Nelson eebfb83aa2
Fix 2fd9096: Label for fruit incorrectly changed to `FRUI` from `FRUT`. (#12367) 3 months ago
Jonathan G Rennison c295b1d99e Use OTTD2FS for unlink when using iconv 3 months ago
Tyler Trahan 8928f4979a
Change: Add dividers in vehicle group action dropdown (#12284) 3 months ago
Jonathan G Rennison e9c8c36af7 Add missing include to src/sl/saveload.cpp 3 months ago
Rubidium 5d8e40cad4 Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity
(cherry picked from commit d09b5aaeba)

# Conflicts:
#	src/newgrf_debug_gui.cpp
#	src/newgrf_gui.cpp
#	src/widget_type.h
3 months ago
Rubidium caa7c44052 Cleanup: remove checks for old MSVC versions 3 months ago
Rubidium d09b5aaeba Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity 3 months ago
Rubidium c01bf06ee1 Codefix: some minor errors in tcp-game protocol documentation 3 months ago
translators 018944dc20 Update: Translations from eints
english (au): 2 changes by krysclarke
vietnamese: 1 change by KhoiCanDev
chinese (simplified): 9 changes by WenSimEHRP
greek: 152 changes by gh658804
russian: 3 changes by Ln-Wolf
finnish: 2 changes by hpiirai
ukrainian: 9 changes by StepanIvasyn
danish: 2 changes by bscargo
portuguese: 5 changes by azulcosta
portuguese (brazilian): 35 changes by pasantoro
3 months ago
Peter Nelson 668186ca5b
Codechange: Remove macros involved with NewGRFClass. (#12363)
Use direct class instantiation instead.
3 months ago
Peter Nelson 2219b8e378 Fix: Don't let CT_INVALID map to valid cargo type. (#12364)
(cherry picked from commit ff35288ddf)

# Conflicts:
#	src/cargotype.cpp
3 months ago
glx22 5b127ed23e Revert bbdbf9a: ScriptTimeMode was not the best solution for economy/calendar support
(cherry picked from commit 704e871a0e)

# Conflicts:
#	src/script/api/script_date.cpp
#	src/script/script_storage.hpp
3 months ago
frosch 0b6d73fab2 Add: [SDL2] Driver parameter 'no_mouse_capture' to ease interactive debugging (#12336)
(cherry picked from commit 603154899a)
3 months ago
Rubidium a12f166815 Fix: crash to desktop when attempting to join a company while not joined (yet)
(cherry picked from commit 0f25eaa271)

# Conflicts:
#	src/console_cmds.cpp
3 months ago
Tyler Trahan d21369b258 Change: Show unbunching action in timetable window (#12351)
(cherry picked from commit 2732b3d6c6)

# Conflicts:
#	src/order_gui.cpp
3 months ago
Peter Nelson 1c66ac2d81 Fix #12347: Crash attempting to find catchment tiles of a station with no catchment area. (#12348)
(cherry picked from commit ea74ca0a76)
3 months ago
Peter Nelson ff35288ddf
Fix: Don't let CT_INVALID map to valid cargo type. (#12364) 3 months ago
glx22 02c00f3e3e Change: [Script] Use economy time for ScriptDate 3 months ago
glx22 704e871a0e Revert bbdbf9a: ScriptTimeMode was not the best solution for economy/calendar support 3 months ago
frosch 603154899a
Add: [SDL2] Driver parameter 'no_mouse_capture' to ease interactive debugging (#12336) 3 months ago
Rubidium 0f25eaa271 Fix: crash to desktop when attempting to join a company while not joined (yet) 3 months ago
Jonathan G Rennison 515303b8be Fix #12092: Incorrect x-axis in cargo payment graph window 3 months ago
Tyler Trahan 2732b3d6c6
Change: Show unbunching action in timetable window (#12351) 3 months ago
Peter Nelson ea74ca0a76
Fix #12347: Crash attempting to find catchment tiles of a station with no catchment area. (#12348) 3 months ago
Rubidium f599108c16 Codechange: move 'months_empty' to CompanyProperties 3 months ago
translators 4321cca5fb Update: Translations from eints
vietnamese: 1 change by KhoiCanDev
chinese (simplified): 1 change by WenSimEHRP
ukrainian: 11 changes by StepanIvasyn
catalan: 1 change by J0anJosep
danish: 1 change by bscargo
dutch: 3 changes by Afoklala
portuguese (brazilian): 58 changes by pasantoro
3 months ago
Peter Nelson df2ee7b06c
Cleanup: Remove old SaveLoad workarounds for MS VS 2017. (#12355) 3 months ago
Rubidium e904122441 Codefix: follow coding style 3 months ago
merni-ns 7457f8d0ff
Codefix: Incorrect pluralisation in last service/service interval texts (#12352) 3 months ago
Jonathan G Rennison a11a8d0b29 Allow removing vehicle from slots using vehicle details window dropdown 3 months ago
raddari 5751da7809
Fix #7982: Show existing coverage with unambiguous adjacent station (#12346)
When hovering a tile containing a station, show existing coverage for
that station even when adjacent to a different station.

Co-authored-by: Peter Nelson <peter@fuzzle.org>
3 months ago
translators e141734e54 Update: Translations from eints
english (au): 1 change by krysclarke
norwegian (bokmal): 1 change by eriksorngard
english (us): 1 change by 2TallTyler
korean: 3 changes by telk5093
german: 1 change by Wuzzy2
finnish: 3 changes by hpiirai
ukrainian: 12 changes by StepanIvasyn
portuguese (brazilian): 81 changes by pasantoro
polish: 1 change by pAter-exe
3 months ago
Jonathan G Rennison 0484ba700f Allow manually removing/setting train speed restriction
From vehicle details window
See: #674
3 months ago
Jonathan G Rennison a0454490ab Fix some command ID comments 3 months ago
Jonathan G Rennison 2189607c34 Codechange: Reduce size of class WaterRegion
The tile patch array is 256 bytes and is not needed for the majority
of water regions, change it to be optional via std::unique_ptr
3 months ago
Jonathan G Rennison e42aec5a89 Fix #12305: Crash with large positive sprite x offset in engine preview window 3 months ago
Jonathan G Rennison 16577279a1 Saveload: Save to temporary file name and rename to target on success 3 months ago
Jonathan G Rennison 5e87d95013 Return success boolean from FioRenameFile 3 months ago
translators 0eaeeaabb6 Update: Translations from eints
russian: 2 changes by Ln-Wolf
catalan: 2 changes by J0anJosep
portuguese (brazilian): 23 changes by pasantoro
3 months ago
Tyler Trahan 704d3b8a9b
Fix #12342: Add missing ellipsis to town generation error string (#12343) 3 months ago
Jonathan G Rennison 4d0af08aad Saveload: Log number of bytes/blocks serialised during save 3 months ago
Jonathan G Rennison 26cb47935e Saveload: Raise error if fclose fails in FileWriter 3 months ago
Jonathan G Rennison 84c476cea5 Avoid data race in calls to VideoDriver::GetGameInterval 3 months ago
Jonathan G Rennison 2c63a65b87 Don't first increment start order index in AdvanceOrderIndexDeferred
Fixes behaviour of CheckRestartLoadingAtRoadStop
3 months ago
translators 00a09af1fd Update: Translations from eints
english (us): 2 changes by 2TallTyler
vietnamese: 2 changes by KhoiCanDev
german: 2 changes by Wuzzy2
ukrainian: 2 changes by StepanIvasyn
portuguese (brazilian): 9 changes by pasantoro
3 months ago
Owen Rudge d4a6ee9554 Change: [CI] Use Azure Code Signing for Windows build 3 months ago
translators 3a3d8f3b53 Update: Translations from eints
english (au): 2 changes by krysclarke
norwegian (bokmal): 2 changes by eriksorngard
chinese (simplified): 31 changes by lysinelai
greek: 7 changes by Xertoveizer
ukrainian: 14 changes by StepanIvasyn
danish: 2 changes by bscargo
lithuanian: 15 changes by dziugas1959
spanish: 2 changes by MontyMontana
french: 2 changes by glx22
portuguese (brazilian): 52 changes by pasantoro
polish: 2 changes by pAter-exe
3 months ago
Peter Nelson 737e3feaf0
Codechange: Don't delete news items or NewGRF window when EffectVehicle is deleted. (#12334)
EffectVehicles never create news and can't be debugged, so searching for news items and windows to delete just wastes time.
3 months ago
Rubidium 7580eac2d5 Codechange: create helper class for useful NetworkAuthorizedKeys functions 3 months ago
Peter Nelson 2485de9462
Codefix: Widget should be passed as WidgetID type. (#12332) 3 months ago
Jonathan G Rennison 4a767b279c Crashlog: Windows: Use VirtualAlloc for crash log object and text buffer 3 months ago
Jonathan G Rennison 3064523f46 Use different text tag for viewport route step go via station orders 3 months ago
Peter Nelson 64bc95722b Codechange: Cache train curve speed limit can be stored in 16 bits.
Cache curve speed modifier and max curve speed are both 16 bit values so can be stored in 16 bit types instead of 32 bit types.

(cherry picked from commit 3fc7b3b9a0)
3 months ago
Peter Nelson a1b7ca979b Fix #12302: Allow empty train engines to use an invalid cargo type. (#12325)
The cargo type will be forced to the first available type (usually passengers) instead of the engine being disabled.

(cherry picked from commit 88cf99017a)
3 months ago
Peter Nelson 107c208d87
Codechange: Use single list for hierarchical group lists. (#12330)
Replace both group list implementations (vehicle group list and company colour group list) with a single implementation, using a struct to hold the group and indentation level instead of two separate lists. Parts that were previously duplicated are now shared.
3 months ago
translators ec3c8d3462 Update: Translations from eints
ukrainian: 12 changes by StepanIvasyn
portuguese (brazilian): 21 changes by pasantoro
polish: 52 changes by pAter-exe
3 months ago
Rubidium 4af089b9be Feature: console command to change authorized keys 3 months ago
Rubidium b7dfa3eb90 Feature: authorized key authentication for rcon 3 months ago
Rubidium 1cf8799810 Feature: encrypt the connection between game server and client 3 months ago
Rubidium d26629c15b Codechange: make encoded length of packet size and type more explicit 3 months ago
Rubidium 5706801ea7 Feature: authenticate to the server without sending the password
Either using password-authentication key exchange or via authorized keys
3 months ago
Rubidium dd532cbc77 Codechange: add setting for authorized/secret/public keys 3 months ago
Rubidium fb9d4afa5c Codechange: add set of classes providing authentication and encryption 3 months ago
Jonathan G Rennison 29496772a1 Fix removing road from road/tram road stop incorrectly removing one-way state 3 months ago
Jonathan G Rennison 2c8ec1bfaf Increase assert verbosity in RoadStop::Entry::CheckIntegrity 3 months ago
Peter Nelson 88cf99017a
Fix #12302: Allow empty train engines to use an invalid cargo type. (#12325)
The cargo type will be forced to the first available type (usually passengers) instead of the engine being disabled.
3 months ago
Peter Nelson 322ca6ef54 Codechange: Shuffle members of Vehicle to reduce size.
This reduces space wasted due to member alignment.
3 months ago
Peter Nelson 3fc7b3b9a0 Codechange: Cache train curve speed limit can be stored in 16 bits.
Cache curve speed modifier and max curve speed are both 16 bit values so can be stored in 16 bit types instead of 32 bit types.
3 months ago
Patric Stout f08da1d373
Codechange: the "no revision detected" string is with four zeros (norev0000) (#12328) 3 months ago
Jonathan G Rennison 20b8cb3059 Add setting to use object land ground for purchased land
Default on
3 months ago
Jonathan G Rennison c8709a9623 Add edge flood behaviour for land ground objects with no foundations 3 months ago
Peter Nelson ab94c8b511
Codechange: Iterate order lists instead of vehicles to find if any vehicle visits a station. (#12315)
This reduces the search time as shared orders are only searched once and non-front vehicles are skipped.
3 months ago
translators 6c5a8f55df Update: Translations from eints
norwegian (bokmal): 58 changes by eriksorngard
vietnamese: 45 changes by KhoiCanDev
greek: 21 changes by Xertoveizer
ukrainian: 5 changes by StepanIvasyn
tamil: 24 changes by merni-ns
lithuanian: 7 changes by dziugas1959
portuguese (brazilian): 61 changes by pasantoro
polish: 21 changes by aefoes
3 months ago
Jonathan G Rennison 109d31a350 VarAction2: Fix jump insertion moving past special stores which could affect the jump variable
See: #672
3 months ago
frosch a886bd9666
Fix #12319, 3a676a5: Some SSE blitters were broken due to ODR violations (#12322) 3 months ago
Jonathan G Rennison 57db9a41f1 Fix vehicles leaving dots behind in viewport map mode 3 months ago
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 3 months ago
Loïc Guilloux bd7120bae4
Fix #12316, 268e512: Support for enum storage type in GenerateWidget.cmake (#12321) 3 months ago
merni-ns af1bd43b30
Codefix 4c0dca1: [CI] Fix typo in workflow file (#12318) 3 months ago
Peter Nelson 0058ebe472
Codechange: Check cheap station-facility-filter before expensive in-use-filter. (#12317) 3 months ago
Jonathan G Rennison 041e71ec05 Merge branch 'master' into jgrpp
# Conflicts:
#	src/crashlog.cpp
#	src/gfx.cpp
#	src/network/network_client.cpp
#	src/openttd.cpp
#	src/openttd.h
#	src/saveload/saveload.cpp
#	src/survey.cpp
3 months ago
Jonathan G Rennison 8066309074 Fix crash with large positive sprite x offset in engine preview window 3 months ago
Jonathan G Rennison 1532c96ca7 Add ctrl-click scroll to for non-destination orders
Conditional orders on station cargo and show as via orders
3 months ago
Jonathan G Rennison 3284bd68e3 Debug: Show engine company and climate availability in debug info 3 months ago
Jonathan G Rennison 1a279a844c Console: Prefer command names with underscores in auto-completion 3 months ago
Loïc Guilloux 818a57c9af
Codechange: Actually use LIT_NONE (#12314) 3 months ago
SamuXarick d7c5e9e8ab Codechange: Where the ship comes from is already known
This simplifies the handling of variables.

`ChooseShipTrack` is called upon entering `tile`, and looking further back to the caller, it can be deduced that `v->tile` matches `src_tile`. With that said, `enterdir` can also be removed, as it's not used anywhere else.

`CreateRandomPath` and `GetRandomFollowUpTrackdir` is being fed `src_tile` as it's 2nd parameter. This could be eliminated, as `v` is also being passed to it. Just use `v->tile` in those functions.
3 months ago
Patric Stout 7f49b6f25a
Codefix: allow preview label on PRs against release branches too (#12310) 3 months ago
Patric Stout 5f4f9334ce
Codefix f1e999ec: use RandomRange(l) instead of _random.Next(l) (#12274) 3 months ago
merni-ns 4c0dca1411
Codechange: [CI] Move Release CI build to MacOS runner (#12309) 3 months ago
Rubidium fe12d38024 Codechange: split initiating of joining and identification of the client 3 months ago
Rubidium 15d02f51ed Codechange: use span to send bytes to Packet and add span recv function 3 months ago
Rubidium b6c75dec3a Codechange: explicitly allow only one state in initial handshake/authorization 3 months ago
Rubidium 26d1d5d6e7 Codechange: move decision whether to check NewGRFs to SendNewGRFCheck, just like for sending game/company passwords 3 months ago
Rubidium 6eff879e49 Codechange: pass the socket handler that is going to send the packet into the packet 3 months ago
Rubidium 3c488e1eb8 Codechange: don't check things outside the lock, that could change while waiting on the lock 3 months ago
Rubidium ec4104ec6c Codechange: do not pass the socket when the receiver already knows it 3 months ago
Patric Stout 3e625b5b1a
Add: track savegame size to report with survey (#12304) 3 months ago
translators b394c20519 Update: Translations from eints
korean: 43 changes by telk5093
persian: 33 changes by CptMcWill
ukrainian: 4 changes by StepanIvasyn
dutch: 26 changes by Afoklala
portuguese (brazilian): 70 changes by pasantoro
3 months ago
SamuXarick a7625b8ae0 Fix #12280: Allow ships 90 degree turns if only choice
If there is no path found, a random path is created which forbids 90 degrees.
Allow 90 degrees if they're the only choice.
3 months ago
translators 9db285a32b Update: Translations from eints
norwegian (bokmal): 6 changes by eriksorngard
ukrainian: 3 changes by StepanIvasyn
dutch: 5 changes by RogierVC
portuguese (brazilian): 76 changes by pasantoro
3 months ago
Jonathan G Rennison 3fcfe5b53e Fix `help dump_version` console command also executing command
See: #668
3 months ago
translators 2d2191fbb3 Update: Translations from eints
norwegian (bokmal): 11 changes by eriksorngard
chinese (simplified): 1 change by WenSimEHRP
finnish: 23 changes by hpiirai
ukrainian: 21 changes by StepanIvasyn
danish: 32 changes by bscargo
spanish: 6 changes by MontyMontana
portuguese (brazilian): 50 changes by pasantoro
3 months ago
Ivan Fefer 23d733be95
Add: Basic autocompletion on tab for console commands (#12163) 3 months ago
Rubidium 24efdf6ac5 Codefix 363e251: incorrect trace debug message 3 months ago
Jonathan G Rennison 4200757db3 Scheduled dispatch: Fix handling of missing last/next dispatch times
In some cases
3 months ago
SamuXarick 14d95ef1c9
Fix #12279: Update random path each step (#12286) 3 months ago
Loïc Guilloux 100c043599
Codechange: [Win32] Disable assert message box when no GUI (#12291) 3 months ago
translators 0cff40dd19 Update: Translations from eints
norwegian (bokmal): 203 changes by eriksorngard
italian: 45 changes by Rivarossi
german: 42 changes by Wuzzy2
ukrainian: 13 changes by StepanIvasyn
turkish: 25 changes by jnmbk
portuguese (brazilian): 25 changes by pasantoro
3 months ago
Jonathan G Rennison f0832fa9b5 Fix debug version of TileAdd 3 months ago
Jonathan G Rennison 8d141b767c Crashlog: Windows: Handle simultaneous crashes in multiple threads 3 months ago
Jonathan G Rennison c4a1436362 Workaround missing std::bit_cast on some compilers 3 months ago
Jonathan G Rennison a887333f00 Crashlog: Unix: Handle simultaneous crash signals in multiple threads
Avoid changing signal handler during crash
Just adjust the signal proc mask and vary response of signal handler
3 months ago
Jonathan G Rennison af867a4b33 Fix crash downscaling sprites from 2x for max sprite resolution setting 3 months ago
Jonathan G Rennison 9f205727bf Extend industry production/transported totals to 32 bits 3 months ago
Jonathan G Rennison cc2521ddf5 Add helper function for unsigned saturating add 3 months ago
Jonathan G Rennison fe730bce31 Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/codeql.yml
#	.github/workflows/release-linux.yml
#	.github/workflows/release-macos.yml
#	.github/workflows/release-windows.yml
#	src/map.cpp
#	src/music/midifile.hpp
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/pathfinder/yapf/yapf_rail.cpp
#	src/pbs.cpp
#	src/saveload/afterload.cpp
#	src/saveload/saveload.h
#	src/saveload/vehicle_sl.cpp
#	src/script/api/script_text.cpp
#	src/ship_cmd.cpp
#	src/train_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehicle_func.h
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
#	src/viewport.cpp
#	src/waypoint_cmd.cpp
3 months ago
Jonathan G Rennison c7d3e291d2 Fix divide by zero when autosave uses real time and autosave both disabled
See: #666
3 months ago
translators 1addeddc07 Update: Translations from eints
english (au): 45 changes by krysclarke
norwegian (bokmal): 256 changes by eriksorngard
welsh: 41 changes by Ansbaradigeidfran
english (us): 45 changes by 2TallTyler
russian: 11 changes by Ln-Wolf
finnish: 18 changes by hpiirai
ukrainian: 20 changes by StepanIvasyn
catalan: 167 changes by J0anJosep
danish: 11 changes by bscargo
spanish: 35 changes by lrlopez
french: 41 changes by ottdfevr
portuguese: 44 changes by jcteotonio
portuguese (brazilian): 168 changes by pasantoro
3 months ago
Richard Wheeler 8a37f6479a Change: Update OpenTTD TTF fonts to v0.6
Adds missing characters for Chuvash and Serbian translations. Adds support for combining diacritics (needed for for Cyrillic es with accent) and corrects miscoded Cyrillic es with descender.
3 months ago
Rubidium a06814c173 Codechange: use std::source_location over __FILE__ and __LINE__ for Random 3 months ago
Koen Bussemaker 984202b101 Codechange: Remove outdated YAPF example code 3 months ago
Patric Stout d7b99cbe26
Codefix: [CI] Store vcpkg outside the repository folder (#12271)
Otherwise tools like CodeQL can pick up on vcpkg files.
3 months ago
Patric Stout c768f4fc7a Codechange: [CI] build some targets every night, instead of every PR
This mainly as they are not expected to fail, or give more information
than the other targets already would. And this is just hogging up
the CI pipeline. On average, these targets take ~80 CPU-minutes to
finish.
3 months ago
Patric Stout ee22fa34d7 Codechange: [CI] Split the ci-build into smaller components 3 months ago
Patric Stout eaf62f3969
Codechange: [CI] manual build CodeQL to improve speed (#12251)
Autobuild also fetches dependencies and other things, while those
are already ready on the system. This seems to cost ~1 minutes,
for no actual good reason.
3 months ago
Peter Nelson b9ca3ead8b
Change: Use (at least) standard toolbar button size for signal selection buttons. (#12265)
Signal selection buttons could be very narrow, with a very wide spacer, depending on loaded signal types and fonts.
3 months ago
Peter Nelson dc6305e8c1
Codechange: Use std::make_unique instead of passing new into a unique_ptr. (#12263)
std::make_unique will also initialise the data so MemSetT is not needed.
3 months ago
translators 95a8fab339 Update: Translations from eints
swedish: 7 changes by joeax910
norwegian (bokmal): 242 changes by eriksorngard
welsh: 609 changes by Ansbaradigeidfran
english (us): 3 changes by 2TallTyler
chinese (simplified): 1 change by WenSimEHRP
ukrainian: 21 changes by StepanIvasyn
latvian: 1 change by lexuslatvia
dutch: 1 change by Jaws3rd
esperanto: 53 changes by legoscia
portuguese (brazilian): 19 changes by pasantoro
3 months ago
Peter Nelson 8b60fc3d35
Codechange: Use vector for waypoint layout. (#12264)
This replaces manual new/delete of byte array, and matches how it is used for station layouts.
3 months ago
Rubidium 2f0fe22d63 Fix #12255: inconsistent punctuation in English 3 months ago
Peter Nelson 649c1cf14c
Fix: Off-by-one in EnsureVisibleCaption. (#12261)
An off-by-one in EnsureVisibleCaption causes the minimum visible caption height to be 13 scaled pixels and 1 unscaled pixel. At 1x interface scale, this 'happens' to be the complete height of a caption, but at other interface scales it is not.

Instead of using a scaled fixed value, correct the off-by-one and just use the window's actual caption height instead.
3 months ago
Rubidium ecf534522c Codechange: replace macro with function for TileAdd(XY) 3 months ago
Rubidium 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 3 months ago
Rubidium df461b0329 Codechange: simplify TileAdd by using simple asserts 3 months ago
Kuhnovic 005892bfdb
Fix #12250: YAPF Trivial rail pathfinding crashes due to #12217 (#12258) 3 months ago
Patric Stout cca9dcdd57
Codechange: [DorpsGek] announce failures in nightlies to IRC / Discord (#12256) 3 months ago
Patric Stout 9c95fbdb07
Remove: official support for MSVC 2019 (#12254) 3 months ago
Jonathan G Rennison f6ba65317c Fix rail pathfinding with YAPF
Partial revert of 30e1a61c04.

See: https://github.com/OpenTTD/OpenTTD/issues/12250
3 months ago
Jonathan G Rennison dd194960f5 Fix handling of title game zoom when changing UI scaling 3 months ago
Jonathan G Rennison 2140e3fc3b Departure boards: Fix handling of invalid/empty dispatch schedules 3 months ago
Jonathan G Rennison fae9df329e Fix drawing of black text with TC_FORCED 3 months ago
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 3 months ago
Rubidium e4b3f3f495 Codechange: use std::source_location over __FILE__ and __LINE__ for NOT_REACHED 3 months ago
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 3 months ago
Patric Stout 381dee2e01
Codechange: [CI] switch to arm64 for MacOS builds (#12242)
This creates more variety in our CI builds, increasing the odds
of us finding issues.
3 months ago
translators 738624ded4 Update: Translations from eints
english (au): 1 change by krysclarke
norwegian (bokmal): 545 changes by eriksorngard
chinese (traditional): 75 changes by wpi3
galician: 24 changes by pvillaverde
chinese (simplified): 1 change by WenSimEHRP
russian: 1 change by Ln-Wolf
finnish: 4 changes by hpiirai
ukrainian: 16 changes by StepanIvasyn
catalan: 1 change by J0anJosep
danish: 1 change by bscargo
french: 3 changes by ottdfevr
portuguese: 1 change by azulcosta
esperanto: 203 changes by legoscia
portuguese (brazilian): 21 changes by pasantoro
polish: 1 change by pAter-exe
3 months ago
Jonathan G Rennison 7796451b6c Disable MSVC warning 4244 for src/3rdparty/monocypher/monocypher.cpp
See: #664
3 months ago
Jonathan G Rennison 04755a6138 Disable -Wstringop-overflow warning on MinGW 3 months ago
Jonathan G Rennison 0e76f774eb Merge branch 'master' into jgrpp
# Conflicts:
#	src/landscape.cpp
#	src/landscape.h
#	src/misc_gui.cpp
#	src/newgrf_commons.cpp
#	src/order_cmd.cpp
#	src/pathfinder/yapf/yapf_base.hpp
#	src/station_cmd.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/water_cmd.cpp
#	src/window.cpp
3 months ago
Jonathan G Rennison 5b88ea6857 Revert "Add setting to disable script parameter randomisation"
This reverts commit 2bb5c9ac84.
3 months ago
Jonathan G Rennison ba79f7b2ba Merge branch 'master' into jgrpp
# Conflicts:
#	src/base_station_base.h
#	src/newgrf_roadstop.cpp
#	src/newgrf_station.cpp
#	src/object_gui.cpp
#	src/saveload/settings_sl.cpp
#	src/saveload/station_sl.cpp
#	src/settings.cpp
#	src/settings_internal.h
#	src/timer/timer_game_calendar.cpp
3 months ago
Peter Nelson 55a328c586
Codechange: Replace type-punning with `std::bit_cast` in squirrel. (#12224) 3 months ago
Peter Nelson de8a840db5
Codefix: Fully initialise `MidiFile::DataBlock` to avoid gcc warning. (#12240) 3 months ago
Loïc Guilloux 82430a1086
Fix ab315d0: Don't show "insert order" errors in the console (#12245) 3 months ago
rubidium42 e0e0d5f8fb Revert #11606: Don't auto-build past tunnelbridge ends
This reverts commit 59f6c199bf.
3 months ago
Patric Stout ebd258b404
Change: [CI] switch MacOS to the macos-14 runner (#12237)
This runner contains a newer XCode, with better C++20 support.
3 months ago
Tyler Trahan 32b0fb9f6e
Fix #12010: Use economy timer for vehicle stats minimum age, not calendar (#12142) 3 months ago
Patric Stout 04ce1c08ae
Codechange: [CI] manually install vcpkg for all targets (#12241)
From macos-14, vcpkg is no longer installed on the runner-image.
It stands to reason that this will also roll out to new images
for other OSes. To be pre-emptive about it, start using our own
cloned vcpkg for all targets.
3 months ago
Tyler Trahan ab315d0dc9
Fix #12118: When adding an unbunching order, properly check for unsafe conditions (#12136) 3 months ago
Patric Stout 6e0f58f700
Codechange: [CI] use "cargo install --locked" to use pinned dependency versions (#12243)
Normally "cargo install" will use the latest dependencies, but
this causes an issue with "dump_syms". Use "--locked" makes sure
we use the dependency versions as indicated by "dump_syms", instead
of the latest version.
3 months ago
glx22 3a71f36393 Change: [Script] Match FormatString behaviour more closely 3 months ago
glx22 ae27ce12a7 Fix 0858377: [Script] Don't output parameters more than once 3 months ago
translators ce3d0097f6 Update: Translations from eints
chinese (simplified): 27 changes by WenSimEHRP
korean: 2 changes by telk5093
greek: 42 changes by Xertoveizer
indonesian: 32 changes by tsaqibfs
slovak: 184 changes by ApplePie420
danish: 2 changes by bscargo
latvian: 2 changes by lexuslatvia
dutch: 2 changes by Afoklala
portuguese: 16 changes by jcteotonio
portuguese (brazilian): 77 changes by pasantoro
3 months ago
Kuhnovic 08ff1ab93e
Fix #12236: Ship pathfinder causes crash when ship is already at destination (#12238) 3 months ago
Kuhnovic ab353f8ad5
Update: Developer credits (#12235) (#12235) 3 months ago
Michael Lutz 8b9f59d320 Codechange: Use references for non-optional in/out values of slope functions 3 months ago
Michael Lutz 8dda387f82 Codechange: Use std::tuple for slope functions with two return values 3 months ago
Tyler Trahan 5806c2aba4
Fix #12203: When unbunching at a depot, don't overlook implicit orders (#12220) 3 months ago
SamuXarick 0c432bdc4d Fix 3947453: GetNextDecisionNode ignored go to nearest depot when combined with stop at depot 3 months ago
SamuXarick ab52f7eecf Fix ccb4c37: Aircraft could route to hangars outside their range when stopping at them 3 months ago
merni-ns b8b80cb42e
Fix #12134: Use correct error messages if clearing drive-through road stops fails (#12139) 3 months ago
rubidium42 aef8a345b2
Codefix #12162, 3105d0b: Textbuf::Assign read beyond std::string_view (#12177) 3 months ago
jcteotonio 63b9284a7e
Add: Portuguese Escudo currency (#12108) 3 months ago
Peter Nelson a9de766fa6
Fix: Train running sounds should only be produced for engine parts. (#12229) 3 months ago
Kuhnovic 30e1a61c04
Fix: YAPF doesn't check destination for start nodes (#12217) 3 months ago
translators 216905ce1f Update: Translations from eints
chinese (simplified): 2 changes by WenSimEHRP
luxembourgish: 2 changes by phreeze83
hungarian: 2 changes by PstasDev
german: 2 changes by Wuzzy2
ukrainian: 10 changes by StepanIvasyn
slovak: 197 changes by ApplePie420
catalan: 2 changes by J0anJosep
portuguese (brazilian): 35 changes by pasantoro
3 months ago
Peter Nelson 25aeb1c5a5
Change: Use same audio buffer size (and config parameter) for all sound drivers. (#12227)
Windows drivers used a default buffer size of 8192 instead of 1024, which results in a considerable 186ms latency.
3 months ago
translators 8fb26612c0 Update: Translations from eints
english (au): 2 changes by krysclarke
vietnamese: 1 change by KhoiCanDev
estonian: 4 changes by RM87
russian: 8 changes by Ln-Wolf
ukrainian: 27 changes by StepanIvasyn
slovak: 34 changes by palsoft333
tamil: 41 changes by Aswn
spanish: 4 changes by MontyMontana
portuguese (brazilian): 72 changes by pasantoro
polish: 3 changes by pAter-exe
3 months ago
Loïc Guilloux ef40c5e240
Fix #12225, 977aba7: [Script] Missing AI:ResetConfig support for running AI config (#12226) 3 months ago
translators 634b67bf13 Update: Translations from eints
estonian: 66 changes by siimsoni
greek: 41 changes by gh658804
ukrainian: 6 changes by StepanIvasyn
slovak: 30 changes by palsoft333
portuguese (brazilian): 41 changes by pasantoro
3 months ago
Kuhnovic 1a2b54498b
Change: Show tile index as decimal number in land info window (#12104) 3 months ago
Peter Nelson 2d48829999
Codechange: Scan station catchment tiles when removing station from nearby towns/industries. (#12129)
Avoid iterating all towns and industries when updating station catchment, and scan a limited portion of the map instead.

This provides a modest performance benefit when many towns/industries exist.
3 months ago
Peter Nelson 00b442d6f9
Fix: Maximum permitted sound volume from NewGRF is 128. (#12222) 3 months ago
Peter Nelson bc3bd642b9
Fix: Relocate main toolbar and statusbar before other windows. (#12218)
When repositioning all windows, the main toolbar and statusbar need to already be in position to ensure that window captions are visible.
3 months ago
Loïc Guilloux 845b894fd8
Remove: [Script] random_deviation from setting description table (#12221) 3 months ago
translators 0fd576bfbc Update: Translations from eints
chinese (simplified): 2 changes by WenSimEHRP
russian: 1 change by Ln-Wolf
ukrainian: 9 changes by StepanIvasyn
portuguese (brazilian): 66 changes by pasantoro
3 months ago
James103 230eaabb5c
Fix 2bb5c9ac84: typo in disable script parameter randomisation helptext (#663) 3 months ago
Jonathan G Rennison 1c83ea8694 Fix double-leave of crashed road vehicle in drive-through stop
See: #662
3 months ago
translators 626ee4ab41 Update: Translations from eints
chinese (simplified): 6 changes by WenSimEHRP
serbian: 16 changes by nkrs
ukrainian: 1 change by StepanIvasyn
portuguese (brazilian): 234 changes by pasantoro
3 months ago
Peter Nelson 8172e25273
Codechange: Use range-for when iterating station speclists. (#12212)
This replaces indexed access.
3 months ago
Jonathan G Rennison c29a7128c6 Bump upstream content version to 14.0 3 months ago
Jonathan G Rennison 1ba9806002 Add case parameter to FormatArrayAsHex
Use upper case where needed for vanilla compatibility
3 months ago
Peter Nelson b2ca6e1ac8
Codefix: Remove no-longer used ship special-case. (#12192)
This special-case has not been triggered since multi-tile docks were introduced.
3 months ago
Peter Nelson cff48c0f63 Codechange: Templatise SlStationSpecList to reduce duplication.
SlStationSpecList now handles both StationSpec and RoadStopSpec, and replaces indexed array access with range-for and reserve/emplace_back pattern.
3 months ago
Peter Nelson 41b3314d76 Codechange: Replace separate Station/RoadStopSpecList with template struct.
Reduces duplication and simplifies reuse.

Additionally naming an item that is used in a list as a ...List was
pretty weird.
3 months ago
Peter Nelson 278c3a7db1 Codechange: Use reference instead of copy of NewGRF speclist item. 3 months ago
Kuhnovic c5afc9173c
Fix #12176: Ships are circling in one place (#12181) 3 months ago
Jonathan G Rennison f180262aee
Fix #12154: Incorrect calendar day lengths with minutes per year setting (#12158) 3 months ago
Jonathan G Rennison 9d65fd9c2a Adjust handling of vehicles introduced before vehicle expiry stop year
See: #646
3 months ago
translators d7c485d4b9 Update: Translations from eints
estonian: 166 changes by siimsoni, 22 changes by RM87
chinese (simplified): 6 changes by WenSimEHRP
serbian: 172 changes by nkrs
ukrainian: 11 changes by StepanIvasyn
spanish: 1 change by MontyMontana
portuguese (brazilian): 149 changes by pasantoro
3 months ago
Patric Stout 8f22066b9a
Fix #12147: reset all saved settings to their default before loading a game (#12210) 4 months ago
Jonathan G Rennison 679a59875b Changelog: Fix spelling error 4 months ago
Rubidium aff09306de Fix #12076: Do not allow 'join' command on dedicated servers 4 months ago
Loïc Guilloux 253ba0d354
Fix #12195: Reset cursor when no Object is selected (#12207) 4 months ago
Jonathan G Rennison b37f4da1b3 Version: Committing version data for tag: jgrpp-0.58.1 4 months ago
Jonathan G Rennison 2bb5c9ac84 Add setting to disable script parameter randomisation 4 months ago
Jonathan G Rennison e730956213 Re-add "path signals only" mode to the signal cycle setting 4 months ago
TELK 7241b28199
Update: Korean translation (#661)
Update: Korean translation
4 months ago
Jonathan G Rennison 3a4398b613 Fix signed/unsigned comparison warning 4 months ago
Jonathan G Rennison b04a356f53 Merge branch 'master' into jgrpp
# Conflicts:
#	src/vehicle.cpp
4 months ago
Loïc Guilloux b53d79b1d2
Codechange: Don't use NOT_REACHED() when catching unhandled thread exceptions (#12199) 4 months ago
Peter Nelson a602845d0a
Fix #12202: Race condition when using sprite picker. (#12204)
When using the sprite picker the screen is redrawn so that the sprites under the mouse cursor can be captured. This redraw also caused the sprite aligner window to be redrawn before the OnInvalidateData event that updates its scrollbars with the list count.
4 months ago
Tyler Trahan 3fd5c33ae6
Fix f6dd505: Only reset unbunching departure data in the correct depot (#12155) 4 months ago
Patric Stout 7824ae5b59 Fix #12196: disable "select upgrade" button when filtering 4 months ago
Patric Stout b307541099 Fix #12196: always show selected content, even when filtering 4 months ago
Jonathan G Rennison cb5c6abc00 Fix display of ships entering viewports on an aqueduct 4 months ago
Tyler Trahan 890040ceea
Update: Developer credits (#12173) 4 months ago
Jonathan G Rennison 9e807d2072 Fix desync after joining a server with flood_from_edges setting enabled 4 months ago
translators 667adf7df9 Update: Translations from eints
chinese (simplified): 26 changes by WenSimEHRP
korean: 5 changes by telk5093
dutch: 9 changes by Afoklala
portuguese (brazilian): 25 changes by pasantoro
4 months ago
Jonathan G Rennison 421a937112 Fix plan window add lines button text when active 4 months ago
Peter Nelson f0a891c4f7
Cleanup: Remove unused last_num_specs from SlRoadStopTileData. (#12198)
Inadvertently copy & pasted from another Sl handler.
4 months ago
Jonathan G Rennison 26fc78d2bf Fix incorrect accounting of company quarterly statistics 4 months ago
translators c0b5510a94 Update: Translations from eints
portuguese (brazilian): 157 changes by pasantoro
polish: 5 changes by pAter-exe
4 months ago
Jonathan G Rennison a816829cd1 Merge branch 'master' into jgrpp
# Conflicts:
#	src/station_gui.cpp
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
4 months ago
Jonathan G Rennison f403d99c90 Saveload: Add helper to iterate orders from order lists and vehicles 4 months ago
translators c4f9479507 Update: Translations from eints
chinese (simplified): 19 changes by WenSimEHRP
ukrainian: 9 changes by StepanIvasyn
portuguese (brazilian): 43 changes by pasantoro
4 months ago
Jonathan G Rennison 12b092aa91 Stop engine reliability decay once no vehicles expire after year is reached
Instead of maximum of expire and introduction year settings

See: #646
4 months ago
Loïc Guilloux fad77261ea
Fix f6dd505: Missing savegame conversion for current_order (#12188) 4 months ago
Jonathan G Rennison cd40eba453 Add an option to disable use of tagged pointers 4 months ago
Peter Nelson d4f0f0e2c5
Codechange: Use `GetVisibleRangeIterators()` in more places. (#12190)
This replaces more first/last index calculation, along with indexed array/vector access, with iterator access instead.
4 months ago
Jonathan G Rennison 7e0acd686e Add NewGRF signal style flag to draw on both sides 4 months ago
Jonathan G Rennison 55410152a2 Merge branch 'master' into jgrpp
# Conflicts:
#	src/openttd.cpp
#	src/script/api/script_text.cpp
#	src/settings_type.h
4 months ago
translators 529d813496 Update: Translations from eints
hungarian: 96 changes by titanicbobo, 11 changes by pnpBrumi
ukrainian: 19 changes by StepanIvasyn
latvian: 1 change by lexuslatvia
spanish: 9 changes by MontyMontana
portuguese (brazilian): 94 changes by pasantoro
4 months ago
Jonathan G Rennison 7a2ea83654 Plans: Adjust button tooltips 4 months ago
Jonathan G Rennison 5047b2ef4e Plans: Allow taking ownership of unowned plans
Except for unauthed network clients
4 months ago
Peter Nelson e93d081a4a
Codechange: Use range-for instead of indexed loop. (#12191) 4 months ago
Jonathan G Rennison 3a301cd986 Add helper functions for network settings admin state 4 months ago
Peter Nelson 59420d57ec
Codechange: Use vehicle tile hash to build depot vehicle list. (#12186)
This avoids iterating the entire vehicle pool.
4 months ago
Peter Nelson a61311fcb0 Codefix: DrawEngineList does not accept EngineID.
Replace min/max parameters of DrawEngineList with scrollbar reference, and use iterators instead of indices.
4 months ago
Peter Nelson bf865dc536 Codechange: Add `GetVisibleRangeIterators()` to `Scrollbar`. 4 months ago
Loïc Guilloux f612bc6ee2
Fix bf4b6696: [Script] Broken ScriptText circular reference detection (#12187) 4 months ago
Kuhnovic 2fb1593550
Fix e38c3c5: Added missing return statement (#12185) 4 months ago
Patric Stout e775ef2b70
Fix: initialize _switch_mode_time so crash-logs before first game have a realistic time (#12184) 4 months ago
Jonathan G Rennison f186b640f6 Plans: Add initial scenario editor support
See: #655
4 months ago
Jonathan G Rennison e5a34feaed Plans: Remove visibility/window code from CmdAddPlan, use callback 4 months ago
Jonathan G Rennison a20f862cd0 Plans: Adjust command flags 4 months ago
Jonathan G Rennison d09f93879b Fix main viewport only partial redraw when changing UI scale using slider 4 months ago
Jonathan G Rennison 1e0ff41d33 Add UI setting to show speed before destination in vehicle status bar 4 months ago
Jonathan G Rennison 5d7c87f5e4 Add setting for whether to show vehicle running costs per calendar year
See #660
4 months ago
Jonathan G Rennison a429bddbac Batch depot order removals when deleting companies 4 months ago
Jonathan G Rennison 8caa4d8708 Use btree_set in Station::RemoveFromAllNearbyLists 4 months ago
Peter Nelson 5462204930 Codechange: Scan station catchment tiles when removing station from nearby towns/industries.
Avoid iterating all towns and industries when updating station catchment, and scan a limited portion of the map instead.

This provides a modest performance benefit when many towns/industries exist.

(cherry picked from commit c28762019ee4c0a60815b2c4df433a0d9bc82094)
4 months ago
translators 149592e4dd Update: Translations from eints
english (us): 9 changes by 2TallTyler
chinese (simplified): 10 changes by WenSimEHRP
luxembourgish: 21 changes by phreeze83
greek: 11 changes by Xertoveizer
hungarian: 60 changes by titanicbobo
german: 37 changes by frosch123
french: 9 changes by Bulest
portuguese (brazilian): 74 changes by pasantoro
polish: 5 changes by pAter-exe
4 months ago
Jonathan G Rennison 828d2146eb Merge branch 'master' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	bin/ai/CMakeLists.txt
#	bin/game/CMakeLists.txt
#	src/ai/ai_info.cpp
#	src/company_base.h
#	src/economy.cpp
#	src/game/game_info.cpp
#	src/gfx_type.h
#	src/linkgraph/linkgraph_gui.cpp
#	src/palette.cpp
#	src/palette_func.h
#	src/saveload/saveload.h
#	src/saveload/vehicle_sl.cpp
#	src/ship_cmd.cpp
#	src/train_cmd.cpp
#	src/vehicle_base.h
#	src/window.cpp
#	src/window_func.h
4 months ago
Jonathan G Rennison cc04fe5005 Duplicate vehicle status bar velocity strings 4 months ago
Jonathan G Rennison 18e1d57fc6 Duplicate STR_ORDERS_GO_TO_TOOLTIP string 4 months ago
Jonathan G Rennison 567e235883 Merge branch 'master' into jgrpp
# Conflicts:
#	src/saveload/saveload.h
4 months ago
Patric Stout e939f59cbb
Codechange: replace "byte" with "uint8_t" in settings (#12179) 4 months ago
Jonathan G Rennison c09fdb0444 Fix company infrastructure windows not being marked as a company window
Fixes it not being removed on company deletion, which could cause a crash
4 months ago
Jonathan G Rennison 0d20a54dc5 Use pointer tags instead of dereferencing in RebuildVehicleTickCaches 4 months ago
Jonathan G Rennison bd04aff725 Use front/vehicle type filtered iteration in ScriptVehicleList 4 months ago
Jonathan G Rennison ac683bc278 ScriptList: Generalise FillList pool iteration 4 months ago
Jonathan G Rennison 746e3874c5 Fix VF_STOP_LOADING flag not always being cleared when leaving station 4 months ago
translators 7b1e3cfeb5 Update: Translations from eints
english (au): 1 change by krysclarke
swedish: 1 change by niklasva
chinese (simplified): 6 changes by WenSimEHRP
korean: 21 changes by telk5093
hungarian: 1 change by PstasDev
italian: 1 change by Rivarossi
belarusian: 7 changes by KorneySan
russian: 7 changes by Ln-Wolf, 3 changes by KorneySan
catalan: 9 changes by J0anJosep
danish: 7 changes by bscargo
french: 7 changes by ottdfevr
portuguese: 1 change by jcteotonio
hindi: 2 changes by michaelsmassey
portuguese (brazilian): 115 changes by pasantoro
polish: 1 change by pAter-exe
4 months ago
Jonathan G Rennison 93bf033107 Add whether the vehicle is non-front to the vehicle pool pointer tag
Add iteration filters which check this
4 months ago
Jonathan G Rennison 05e237f8d1 Add wrapper to iterate vehicle pool with vehicle type filter
Without needing to dereference vehicle pointers if using tagged pointers
4 months ago
Jonathan G Rennison be4aea0dad Rationalise handling of train too heavy advice messages 4 months ago
Peter Nelson 86be6d7e0b Codechange: Off-by-one in colour gradient initialisation.
Remap sprites start with a count byte followed by 256 entries, but
SetupColoursAndInitialWindow did not take account of this extra byte and
therefore started at palette index 0xC5 instead of 0xC6. This caused the
first colour of each gradient to be incorrect and all shades were actually
1 step lower in the gradient than indicated.
4 months ago
Peter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 4 months ago
Peter Nelson ae3390fe48 Codechange: Add ColourShade enum. 4 months ago
Peter Nelson 0463d4c198 Codechange: Remove direct access to _colour_gradient.
Access is now through GetColourGradient, which ensures parameters are in range.
4 months ago
Peter Nelson 56cf89d189
Change: Use bitmap for free unit ID generation. (#12165)
This improves performance of finding the next free unit number for a vehicle.

Based loosely on pool's used slot bitmap.
4 months ago
Jonathan G Rennison 601071744e Fix timetabled waiting in depots
See: #658
4 months ago
Peter Nelson 8afef45d4e
Fix d3c673e: Don't defer OnResize() after ReInit() (#12174)
Some windows resize themselves during painting and issue ReInit(). In this case deferred OnResize() causes a visible glitch as the event is handled on the next redraw.
4 months ago
Jonathan G Rennison 528aae3f3b Saveload: Remove unused engine save/load desc 4 months ago
Jonathan G Rennison ee7a347287 Fix 07278a41: Narrowing conversion warning fix 4 months ago
Jonathan G Rennison 090656bd7f Adjust handling of year display in wallclock mode and company inauguration years
See: #657
4 months ago
Jonathan G Rennison 1bfcbf823c Use tagged pointers in the vehicle pool on supported (64 bit) platforms
Use to avoid needing to dereference each pointer to get the vehicle
type when doing per-vehicle type iteration
4 months ago
translators ddb3914074 Update: Translations from eints
english (au): 6 changes by krysclarke
swedish: 19 changes by sereneavatar
estonian: 30 changes by RM87
chinese (simplified): 3 changes by Kevin-mao0721
hungarian: 60 changes by titanicbobo
italian: 6 changes by Rivarossi
russian: 3 changes by Ln-Wolf, 3 changes by KorneySan
finnish: 6 changes by hpiirai
ukrainian: 7 changes by StepanIvasyn
latvian: 6 changes by lexuslatvia
portuguese: 37 changes by azulcosta
portuguese (brazilian): 19 changes by pasantoro
polish: 6 changes by SzyZuu
4 months ago
Tyler Trahan 677ec70b0e
Fix fd9e72a: Helptext for timekeeping unit setting erroneously refers to vehicle movement (#12172) 4 months ago
Jonathan G Rennison 07278a41e5 Fix narrowing conversion warnings in pool resize capacity calculation 4 months ago
Jonathan G Rennison 3891ab57f8 Workflow: Upgrade image and actions for linux-dedicated build 4 months ago
Jonathan G Rennison 3429c324f6 Workflow: Update actions in Linux distros release 4 months ago
Jonathan G Rennison 96df846138 Workflow: Remove linux-legacy release 4 months ago
Jonathan G Rennison 680085fc2d Version: Committing version data for tag: jgrpp-0.58.0 4 months ago
Jonathan G Rennison 64be289942 Workaround: Replace use of std::filesystem in signature.cpp
Creates DWARF generation problem with LTO and -g1 on MinGW
4 months ago
Richard Wheeler c25d9f5c81
Fix: Make link graph node borders scale with GUI (#12167) 4 months ago
Jonathan G Rennison 222832f1d4
Fix #12166: Crash when opening tram road stop build window (#12168) 4 months ago
Jonathan G Rennison 0978bd18bf Fix crash when opening tram road stop build window
See: https://github.com/OpenTTD/OpenTTD/issues/12166
4 months ago
translators 7135330819 Update: Translations from eints
vietnamese: 3 changes by KhoiCanDev
chinese (simplified): 5 changes by WenSimEHRP
hungarian: 63 changes by titanicbobo
belarusian: 47 changes by KorneySan
finnish: 2 changes by hpiirai
ukrainian: 25 changes by StepanIvasyn
danish: 38 changes by bscargo
portuguese (brazilian): 158 changes by pasantoro
4 months ago
Jonathan G Rennison 0fbb32403c Add exponential behaviour to pool growth reallocation 4 months ago
SamuXarick b22fb43cea
Fix #10490: Allow ships to exit depots if another is not moving at the exit point (#12161) 4 months ago
frosch fcad801685 Fix #12127, 555a379: Truncation ellipses rendered shadows even for black font without shadows (#12132)
(cherry picked from commit bb86023d50)
4 months ago
frosch 89b6773c93 Fix: Shadows of individual character glyphs could be drawn over other characters (#12115)
(cherry picked from commit 555a37930b)
4 months ago
Jonathan G Rennison d3bbb4fb1c Adjust ordering of date/tick setup in InitializeGame 4 months ago
Jonathan G Rennison b38321b9b4 Add setting to only spawn primary industries 4 months ago
Jonathan G Rennison c7e95d5b03 Close graph windows when changing timekeeping mode 4 months ago
Peter Nelson 2b79e7cdf5
Fix b7630b0: Incorrect padding for text purchase list. (#12160)
Restore to original (and more normal) framerect padding.
4 months ago
frosch bb86023d50
Fix #12127, 555a379: Truncation ellipses rendered shadows even for black font without shadows (#12132) 4 months ago
Jonathan G Rennison c511f93f24 Scheduled dispatch: Disable in wallclock mode if not using time in minutes 4 months ago
Jonathan G Rennison d8ecb9c016 Use absolute display units for the departure board 4 months ago
Jonathan G Rennison 91d83335c7 Add helper to get timetable absolute display unit size 4 months ago
Jonathan G Rennison 33cbfc3e76 Cache current ticks per calendar day 4 months ago
Jonathan G Rennison 45b6079899 Add string code for absolute timetable time 4 months ago
Jonathan G Rennison 6b12539e3f Implement StateTicksToCalendarDate for wallclock mode 4 months ago
Jonathan G Rennison 91b3e9c1ab Initial support for relative timetabling in wallclock mode 4 months ago
Jonathan G Rennison 7581ce0010 Fix changing time keeping units incorrectly updating state ticks offset 4 months ago
Rubidium 4c117dd2d8 Revert #11993: new number format system does not and cannot work for CJK languages
There are too many intricacies that I am unaware of that are popping up after
asking whether things are right or not.
I do not want to keep playing whack-a-mole, so just revert the whole thing.

This reverts:
15be383b93
360fe8b0b6
1aa9a5c0ab
59f56941e5
7e2eefb91f
b741b2ba6f
609d0071d5
9f8fd80112
a253205b93
819c6c756e
4 months ago
Jonathan G Rennison bbd34bb6db Increase information shown in getfulldate console command 4 months ago
Jonathan G Rennison bd955c4117 Fix calendar day length in wallclock mode
See: https://github.com/OpenTTD/OpenTTD/issues/12154
4 months ago
translators 8015d96a50 Update: Translations from eints
english (au): 2 changes by krysclarke
spanish (mexican): 149 changes by Can202
estonian: 11 changes by RM87
chinese (simplified): 18 changes by WenSimEHRP
hungarian: 2 changes by PstasDev
italian: 195 changes by Rivarossi
serbian: 42 changes by nkrs
german: 2 changes by Wuzzy2
belarusian: 537 changes by KorneySan
russian: 25 changes by KorneySan
ukrainian: 21 changes by StepanIvasyn
turkish: 14 changes by jnmbk
latvian: 2 changes by lexuslatvia
dutch: 1 change by iamthedutchdude
spanish: 15 changes by MontyMontana
french: 2 changes by ottdfevr
portuguese: 2 changes by jcteotonio, 2 changes by azulcosta
portuguese (brazilian): 149 changes by pasantoro
polish: 2 changes by pAter-exe
4 months ago
Jonathan G Rennison 5605650e26 Saveload: Don't apply state ticks offset on load if not stored in save 4 months ago
Jonathan G Rennison 58f2e0cdf0 Clamp link graph compression ticks when loading old saves 4 months ago
Jonathan G Rennison 57a4586f08 Set flood from edges setting to false when loading old saves before then 4 months ago
Jonathan G Rennison 593a81d421 Saveload: Rename IsSavegameVersionUntil to IsSavegameVersionBeforeOrAt
To match upstream
4 months ago
Jonathan G Rennison ea0fa2194a Add debug console command to unblock bay road stops with incorrect occupancy state 4 months ago
Jonathan G Rennison 16d77d9268 Fix deleting road vehicle in bay stop not unmarking as occupied 4 months ago
Jonathan G Rennison 53b06a3d04 Add event flag for removing invalid RVs during load 4 months ago
Jonathan G Rennison 675b31887a Saveload: Fix recalculation of _state_ticks
For XSLFI_VARIABLE_DAY_LENGTH versions 1 to 3
4 months ago
Jonathan G Rennison f52d56249d Saveload: Use table format for industry build data chunks 4 months ago
Jonathan G Rennison 0e262620d2 Saveload: Use table format for NewGRF/ID mapping chunks 4 months ago
Jonathan G Rennison b3bd1bb5ad Use upstream load for non-table script chunks 4 months ago
Jonathan G Rennison a92377fe98 Use upstream save/load for various unchanged chunks 4 months ago
Jonathan G Rennison b178be36f3 Saveload: Maintain map of chunk ID to (first byte) block mode 4 months ago
Jonathan G Rennison dadbad2bfc Saveload: Log changes in SlExecWithSlVersion 4 months ago
Jonathan G Rennison 6dec7a5b35 Saveload: Add PeekByte method to ReadBuffer 4 months ago
Jonathan G Rennison bd2358f6cc Saveload: Tidy up logging of chunk IDs
Add helper to dump chunk IDs as strings
Avoid duplicate logging of load steps for upstream load paths
4 months ago
Jonathan G Rennison ba1fa3ad29 Saveload: Fix SlNullPointers with upstream chunks 4 months ago
Jonathan G Rennison b58ecb0cd8 Saveload: Remove unnecessary auto-length use for tracerestrict 4 months ago
Jonathan G Rennison 8e8d698b24 Fix comment spelling errors 4 months ago
Rubidium 5d2e6e4efa Fix #12148, fca8166: Do not draw decimals when number of digits is 0 4 months ago
Jonathan G Rennison ca146c8ddd Fix #12145: Incorrect date handling in date cheat in wallclock time-keeping mode 4 months ago
Jonathan G Rennison 409c073eca Codefix: Off by one in TimerGameEconomy::ConvertDateToYMD wallclock mode 4 months ago
merni-ns 7bab2c1cc3 Fix #12119: Remove red warning text when maximum loan is zero 4 months ago
Jonathan G Rennison 158fbe19f8 Fix missing includes 4 months ago
Jonathan G Rennison 1f08ea54e5 Script: Fix narrowing conversion warning 4 months ago
Jonathan G Rennison aad6fadd7f Fix noreturn tag in window crash log 4 months ago
Jonathan G Rennison c2d581a928 Revert "Iconv: Ensure that OTTD2FS/FS2OTTD are thread-safe"
This reverts commit 94d326b1e0.
4 months ago
Jonathan G Rennison 4469925605 Add missing typename specifier 4 months ago
Jonathan G Rennison a7c7e3d618 Add missing includes for std::runtime_error 4 months ago
Loïc Guilloux d310a04276 Fix #12133: [Script] Don't crash when emergency saving (#12138)
(cherry picked from commit 25d1238907)
4 months ago
Loïc Guilloux 5098c77c38 Fix: [Script] Only show debug script window at the end of savegame loading (#12135)
(cherry picked from commit 2d7ad9f717)
4 months ago
Jonathan G Rennison ff0d212705 Fix incorrect assert of LinkGraph LastCompression date 4 months ago
Jonathan G Rennison 69ae516353 Fix loading of depot unbunch bit from vanilla saves 4 months ago
Jonathan G Rennison c637d376d0
Fix cb588d8d: Ordering of command per tick limit and pause mode filtering (#12126)
The command per tick limit should be applied after the pause mode filter
4 months ago
merni-ns ad9080338c
Codefix: Correct coding style on fall through (#12140) 4 months ago
Jonathan G Rennison 37e6f36b1f Fix off by one in wallclock mode ConvertDateToYMD 4 months ago
translators bff69e192b Update: Translations from eints
english (us): 24 changes by 2TallTyler
vietnamese: 13 changes by KhoiCanDev
estonian: 7 changes by RM87
german: 16 changes by Wuzzy2
belarusian: 328 changes by KorneySan
russian: 6 changes by KorneySan, 5 changes by Ln-Wolf
ukrainian: 9 changes by StepanIvasyn
catalan: 18 changes by J0anJosep
danish: 61 changes by bscargo
french: 8 changes by ottdfevr
portuguese: 29 changes by jcteotonio, 12 changes by azulcosta
portuguese (brazilian): 185 changes by pasantoro
polish: 1 change by pAter-exe
4 months ago
Jonathan G Rennison 79388e4207 Include dates and tick counters in state checksum 4 months ago
Jonathan G Rennison 24cd52616c Add getter for calendar sub date fract 4 months ago
Jonathan G Rennison f32eef4f38 Allow changing time-keeping mode in-game 4 months ago
Jonathan G Rennison 471934e685 Add a helper to get the number of days in a given calendar month 4 months ago
Loïc Guilloux 25d1238907
Fix #12133: [Script] Don't crash when emergency saving (#12138) 4 months ago
Loïc Guilloux 2d7ad9f717
Fix: [Script] Only show debug script window at the end of savegame loading (#12135) 4 months ago
Jonathan G Rennison 6e10f01f59 Fix timetable durations when loading old saves
With version 1 of XSLFI_TT_WAIT_IN_DEPOT or without XSLFI_TIMETABLE_EXTRA
4 months ago
Jonathan G Rennison 0993622f09 Fix production cargo icon in industry window 4 months ago
Jonathan G Rennison 40f5f17e32 Tidy up focus management for vehicle dropdowns 4 months ago
Jonathan G Rennison fc2f746b80 Increase river pathfinding node limit 4 months ago
Jonathan G Rennison d512602369 Charge scripts for use of ScriptList::FillList
See: https://github.com/OpenTTD/OpenTTD/issues/12128
4 months ago
Jonathan G Rennison 351c607dad Call ProcessScheduledResize from FinishInitNested
This is to make sure that OnResize is called at least once before
the window is first drawn, to set up scrollbar capacities, etc

See: d3c673e2
4 months ago
Damian Laczak 2aa574a48f Fix #10983: [AdminPort] Correct order of messages
(cherry picked from commit 49c3215751)
4 months ago
Peter Nelson 5c35a87ed7 Fix a258833: Don't invalidate station list on vehicle load/unload. (#12112)
a258833 fixed a bug but as a result causes the station list to be rebuilt every time (once per game tick) a vehicle loads/unloads.

Instead just mark the window for redraw.

(cherry picked from commit f20d241e81)
4 months ago
Koen Bussemaker 69af0e8f26 Codechange: Skip non-water water region patches in neigbor search
(cherry picked from commit 8a1cea2ab6)
4 months ago
Jonathan G Rennison a98a56669b Merge branch 'master' into jgrpp
# Conflicts:
#	regression/regression/result.txt
#	src/autoreplace_cmd.cpp
#	src/industry_gui.cpp
#	src/landscape.cpp
#	src/network/network_content.cpp
#	src/newgrf_roadstop.cpp
#	src/pathfinder/yapf/yapf_ship.cpp
#	src/road_gui.cpp
#	src/saveload/ai_sl.cpp
#	src/saveload/saveload.h
#	src/saveload/vehicle_sl.cpp
#	src/station.cpp
#	src/station_gui.cpp
#	src/video/cocoa/cocoa_ogl.h
#	src/video/sdl2_opengl_v.h
#	src/video/video_driver.hpp
#	src/video/win32_v.h
#	src/widget_type.h
#	src/widgets/dropdown.cpp
#	src/widgets/dropdown_type.h
#	src/window.cpp
4 months ago
Jonathan G Rennison 4097fc4e33 Saveload: Enable upstream mode SlAutolength
Use non-upstream implementation for SlCopyBytes
4 months ago
Jonathan G Rennison 8a85055c68 Saveload: Use std::span for autosave temporary buffer view 4 months ago
translators f1bf39f38b Update: Translations from eints
english (au): 12 changes by krysclarke
chinese (simplified): 84 changes by WenSimEHRP
russian: 13 changes by Ln-Wolf
finnish: 12 changes by hpiirai
ukrainian: 12 changes by StepanIvasyn
latvian: 19 changes by lexuslatvia
french: 1 change by ZarTek-Creole
portuguese (brazilian): 169 changes by pasantoro
polish: 12 changes by pAter-exe
4 months ago
Jonathan G Rennison 75dd135e8d Merge tag '14.0-beta3' into jgrpp
# Conflicts:
#	regression/regression/result.txt
#	src/industrytype.h
#	src/network/core/config.h
#	src/network/core/network_game_info.cpp
#	src/network/core/network_game_info.h
#	src/network/core/packet.cpp
#	src/network/core/packet.h
#	src/network/core/tcp.cpp
#	src/network/core/tcp.h
#	src/network/core/tcp_admin.cpp
#	src/network/core/tcp_content.cpp
#	src/network/core/tcp_coordinator.cpp
#	src/network/core/tcp_game.cpp
#	src/network/core/tcp_game.h
#	src/network/core/tcp_turn.cpp
#	src/network/core/udp.cpp
#	src/network/core/udp.h
#	src/network/network_admin.cpp
#	src/network/network_client.cpp
#	src/network/network_client.h
#	src/network/network_command.cpp
#	src/network/network_content.cpp
#	src/network/network_internal.h
#	src/network/network_query.cpp
#	src/network/network_query.h
#	src/network/network_server.cpp
#	src/network/network_server.h
#	src/network/network_turn.cpp
#	src/network/network_udp.cpp
#	src/rail_gui.cpp
#	src/road_gui.cpp
4 months ago
FedelloKirfed 2e3e93fe32 Update Galician Translations
(cherry picked from commit 10596e84cf)

#653
4 months ago
Jonathan G Rennison 1040f9612f Saveload: Tag duplicate detection in SlTableHeader as maybe unused 4 months ago
Jonathan G Rennison a874bb70b1 Remove unused saveload desc in cheats_sl.cpp 4 months ago
Jonathan G Rennison 6ab1f9a416 Use CargoID instead of CargoSpec in town_production_cargoes 4 months ago
Jonathan G Rennison 19e4895ffd Add cargo mask of town production cargoes
Use for all non-GUI cases (where display sort order is not required)
4 months ago
Jonathan G Rennison 8581808952 Merge tag '14.0-beta2' into jgrpp
# Conflicts:
#	CMakeLists.txt
#	src/cargotype.cpp
#	src/console_cmds.cpp
#	src/graph_gui.cpp
#	src/industry_cmd.cpp
#	src/industrytype.h
#	src/misc_gui.cpp
#	src/network/network_client.cpp
#	src/newgrf.cpp
#	src/newgrf_town.cpp
#	src/object_cmd.cpp
#	src/openttd.cpp
#	src/pathfinder/water_regions.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/table/build_industry.h
#	src/table/engines.h
#	src/vehicle.cpp
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
4 months ago
Jonathan G Rennison c6893388ab Fix order flags collision in OT_GOTO_DEPOT
Move depot wait is timetabled flag to xflags
4 months ago
Jonathan G Rennison 821c5970db Disallow unbunching if auto-separation, scheduled dispatch or per-cargo full load 4 months ago
Jonathan G Rennison f9e8a49df0 Auto-separation: Do not allow enabling if unbunching is present
Check for scheduled dispatch/unbunching in enable command
Show in button tooltip
4 months ago
Jonathan G Rennison df2d4bd83c Scheduled dispatch: Do not allow enabling if unbunching is present
Check for auto-separation/unbunching in enable command
Show in enable button tooltip and summary text
4 months ago
Jonathan G Rennison 0fd3f93310 Debug: Add unbunching state to debug info 4 months ago
Jonathan G Rennison 8f9783e7d3 Debug: Adjust vehicle debug text order/indentation 4 months ago
Jonathan G Rennison fdd666f66a Merge tag '14.0-beta1' into jgrpp
# Conflicts:
#	src/3rdparty/squirrel/squirrel/sqcompiler.cpp
#	src/aircraft.h
#	src/animated_tile.h
#	src/base_consist.h
#	src/cargotype.h
#	src/company_gui.cpp
#	src/console_cmds.cpp
#	src/core/overflowsafe_type.hpp
#	src/engine_gui.cpp
#	src/industry_gui.cpp
#	src/lang/english.txt
#	src/music/extmidi.cpp
#	src/network/core/network_game_info.cpp
#	src/network/network_server.cpp
#	src/newgrf.cpp
#	src/newgrf_industries.cpp
#	src/order_base.h
#	src/order_cmd.cpp
#	src/order_gui.cpp
#	src/order_type.h
#	src/os/macosx/misc_osx.cpp
#	src/os/windows/crashlog_win.cpp
#	src/rail_gui.cpp
#	src/rail_gui.h
#	src/roadveh.h
#	src/roadveh_cmd.cpp
#	src/saveload/afterload.cpp
#	src/saveload/company_sl.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/saveload/saveload_error.hpp
#	src/script/api/script_town.cpp
#	src/settingsgen/settingsgen.cpp
#	src/ship.h
#	src/ship_cmd.cpp
#	src/smallmap_gui.cpp
#	src/spritecache.cpp
#	src/stdafx.h
#	src/strgen/strgen.cpp
#	src/strgen/strgen.h
#	src/table/settings/script_settings.ini
#	src/timetable_cmd.cpp
#	src/timetable_gui.cpp
#	src/town.h
#	src/town_cmd.cpp
#	src/town_cmd.h
#	src/town_gui.cpp
#	src/train.h
#	src/train_cmd.cpp
#	src/tree_cmd.cpp
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehiclelist.cpp
#	src/waypoint_base.h
#	src/widget.cpp
4 months ago
Rubidium a4d4301a0c Codechange: We are heading to 15 4 months ago
translators 73bed054b8 Update: Translations from eints
english (au): 2 changes by krysclarke
korean: 5 changes by telk5093
russian: 2 changes by Ln-Wolf
tamil: 45 changes by Aswn
portuguese: 1 change by azulcosta
hindi: 85 changes by NisheshTyagi
portuguese (brazilian): 119 changes by pasantoro
4 months ago
Rubidium 15be383b93 Fix a253205: remove (now) unused currency separator 4 months ago
Tyler Trahan 4f1bc39bf7
Change: Show speed before destination in vehicle status bar (#11932) 4 months ago
Tyler Trahan 87a80c7ff2
Change: When adding orders, Ctrl+Click on a depot to unbunch, instead of service if required (#12023) 4 months ago
frosch 555a37930b
Fix: Shadows of individual character glyphs could be drawn over other characters (#12115) 4 months ago
Damian Laczak 49c3215751 Fix #10983: [AdminPort] Correct order of messages 4 months ago
Peter Nelson f20d241e81
Fix a258833: Don't invalidate station list on vehicle load/unload. (#12112)
a258833 fixed a bug but as a result causes the station list to be rebuilt every time (once per game tick) a vehicle loads/unloads.

Instead just mark the window for redraw.
4 months ago
Koen Bussemaker 8a1cea2ab6 Codechange: Skip non-water water region patches in neigbor search 4 months ago
Rubidium 360fe8b0b6 Fix a253205: division by zero when attempting to format some short currencies 4 months ago
Jonathan G Rennison f0fdc882ea Fix town action description texts in wallclock mode 4 months ago
translators 03e3553230 Update: Translations from eints
estonian: 15 changes by RM87
portuguese (brazilian): 42 changes by pasantoro
polish: 30 changes by pAter-exe
4 months ago
Peter Nelson 2ecc3c90f7
Change: Improve performance of finding free pool slots. (#12055)
Add a bitmap of used pool slots which allows finding a free pool slot without having to check if each index is already used or not.

Loosely based on a JGRPP patch.
4 months ago
Rubidium 1aa9a5c0ab Update: Use proper number formats and abbreviations for Chinese, Japanese, Korean and German 4 months ago
Rubidium 59f56941e5 Update: Number format configuration based on old digitsep and STR_CURRENCY_SHORT_* values 4 months ago
Rubidium 7e2eefb91f Cleanup: Remove digit group separators from strgen and languages 4 months ago
Rubidium b741b2ba6f Feature: Fully user configurable number format and abbreviations 4 months ago
Rubidium 609d0071d5 Change: Remove saving of digit group and decimal separator configurations from the savegame 4 months ago
Rubidium e67fc33172 Codechange: Add support for NULL strings in SaveLoadCompat 4 months ago
Rubidium 9f8fd80112 Feature: Fully customisable number abbreviations per translation 4 months ago
Rubidium a253205b93 Feature: Fully customisable number format per translation 4 months ago
Rubidium 819c6c756e Codechange: Add support for number format and abbreviations pragmas/attributes to strgen 4 months ago
Rubidium fca8166087 Codechange: Simplify FormatNumber by moving out zero fill and decimal support 4 months ago
Rubidium a44bd81280 Codechange: Move determining the decimal separator to a separate function 4 months ago
Rubidium f0c50ad529 Codechange: Add function to get the power of ten for a given number 4 months ago
Jonathan G Rennison d4d6ad2dfc Debug: Include various speed/acceleration values in vehicle debug window 4 months ago
Jonathan G Rennison 94d326b1e0 Iconv: Ensure that OTTD2FS/FS2OTTD are thread-safe 4 months ago
Jonathan G Rennison 838b166726 Merge branch 'master' into jgrpp
# Conflicts:
#	src/cheat_gui.cpp
#	src/command.cpp
#	src/command_func.h
#	src/company_base.h
#	src/debug.cpp
#	src/debug.h
#	src/economy.cpp
#	src/engine_type.h
#	src/graph_gui.cpp
#	src/misc_cmd.cpp
#	src/misc_cmd.h
#	src/network/core/os_abstraction.cpp
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/settings_type.h
#	src/ship_cmd.cpp
#	src/stdafx.h
#	src/tests/bitmath_func.cpp
#	src/town_cmd.cpp
#	src/town_gui.cpp
4 months ago
Jonathan G Rennison 074447138c Add method for whether calendar is frozen 4 months ago
rubidium42 8bccb5805a
Fix 0ca4b4e: Ctrl+Click style inconsistency in base language (#12099) 4 months ago
Jonathan G Rennison 7938844d1d Vehicles age at calendar speed in wallclock mode 4 months ago
Jonathan G Rennison b940fa9466 Do not scale shown running costs by the day length factor
Show in original years
4 months ago
translators bb2446c058 Update: Translations from eints
welsh: 5 changes by Ansbaradigeidfran
estonian: 108 changes by siimsoni, 50 changes by RM87
luxembourgish: 276 changes by phreeze83
hungarian: 81 changes by PstasDev
indonesian: 6 changes by tsaqibfs
italian: 191 changes by AlphaJack
bulgarian: 118 changes by lamarin1
ukrainian: 16 changes by StepanIvasyn
tamil: 408 changes by Aswn
turkish: 43 changes by metsysma
esperanto: 103 changes by JadedCtrl
portuguese (brazilian): 57 changes by pasantoro
polish: 61 changes by pAter-exe
4 months ago
Jonathan G Rennison 3ec77973df Fix setting callbacks when using setting_newgame console command
See: https://github.com/OpenTTD/OpenTTD/issues/12059
4 months ago
Jonathan G Rennison bd74340416 Disable settings inapplicable for the current timekeeping mode 4 months ago
Jonathan G Rennison 75645b8563 Allow disabling a setting via guiproc 4 months ago
Jonathan G Rennison c45bfccc2e Always use 27ms/tick in wallclock timing mode 4 months ago
Jonathan G Rennison 450c6b76d6 Ensure tile loop counts and cargo scalers updated when day length changed 4 months ago
Jonathan G Rennison 86a6f63e2f Merge branch 'master' into jgrpp
# Conflicts:
#	.github/workflows/ci-build.yml
#	.github/workflows/codeql.yml
#	.github/workflows/commit-checker.yml
#	.github/workflows/release-linux-legacy.yml
#	.github/workflows/release-linux.yml
#	.github/workflows/release-macos.yml
#	.github/workflows/release-windows-store.yml
#	.github/workflows/release-windows.yml
#	.github/workflows/upload-cdn.yml
#	.github/workflows/upload-gog.yml
#	.github/workflows/upload-steam.yml
#	src/console_cmds.cpp
#	src/core/math_func.hpp
#	src/fios.cpp
#	src/fios.h
#	src/intro_gui.cpp
#	src/network/network_server.cpp
#	src/openttd.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/settings_internal.h
#	src/settings_table.cpp
#	src/settings_type.h
#	src/table/settings.h.preamble
#	src/table/settings/company_settings.ini
#	src/table/settings/currency_settings.ini
#	src/table/settings/difficulty_settings.ini
#	src/table/settings/economy_settings.ini
#	src/table/settings/game_settings.ini
#	src/table/settings/gui_settings.ini
#	src/table/settings/linkgraph_settings.ini
#	src/table/settings/locale_settings.ini
#	src/table/settings/misc_settings.ini
#	src/table/settings/multimedia_settings.ini
#	src/table/settings/network_private_settings.ini
#	src/table/settings/network_settings.ini
#	src/table/settings/news_display_settings.ini
#	src/table/settings/old_gameopt_settings.ini
#	src/table/settings/pathfinding_settings.ini
#	src/table/settings/script_settings.ini
#	src/table/settings/win32_settings.ini
#	src/table/settings/window_settings.ini
#	src/table/settings/world_settings.ini
#	src/viewport.cpp
#	src/viewport_func.h
#	src/window.cpp
4 months ago
Peter Nelson adb796a21a Change: Show 6 or 2 orientation buttons in NewGRF road stop picker as appropriate.
This replaces the normal method of masking unusable buttons.
4 months ago
Peter Nelson 8c22690ce1 Codechange: Update window's widget lookup map when switching displayed plane. 4 months ago
Jonathan G Rennison cbde4b00ab Crashlog: Change ordering to put settings and command log before gamelog 4 months ago
Jonathan G Rennison a48e15dce0 Add wallclock time settings 4 months ago
Jonathan G Rennison 58f8971f17 Add console command to get version information
See: #652
4 months ago
translators 3d591c2094 Update: Translations from eints
swedish: 1 change by SpamixOfficial
welsh: 280 changes by Ansbaradigeidfran
vietnamese: 245 changes by myquartz
estonian: 1 change by siimsoni
czech: 64 changes by LubosKolouch, 29 changes by adamek0202
arabic (egypt): 17 changes by AviationGamerX
luxembourgish: 247 changes by phreeze83
hungarian: 9 changes by nemesbala
indonesian: 21 changes by tsaqibfs, 19 changes by K4smun1
italian: 13 changes by AlphaJack
hebrew: 20 changes by Boltyansky
bulgarian: 107 changes by lamarin1
finnish: 4 changes by lanurmi
ukrainian: 18 changes by StepanIvasyn
catalan: 1 change by arnaullv
turkish: 120 changes by metsysma, 43 changes by EndChapter
danish: 23 changes by mamure, 23 changes by bscargo
dutch: 1 change by Jaws3rd
french: 1 change by Lishouuu
portuguese (brazilian): 362 changes by pasantoro
polish: 60 changes by pAter-exe
4 months ago
Jonathan G Rennison 53f86b3aab Allow using strong type with SetDParamMaxValue 4 months ago
Tyler Trahan b5b12da91b Add: AI/GS Time Mode to choose between economy (default) and calendar time (#11603)
(cherry picked from commit bbdbf9a589)
4 months ago
Jonathan G Rennison 1f5b35fac4 Change link graph join and compression times to use scaled tick counter 4 months ago
Jonathan G Rennison edbbaeb5d9 Add ScaledTickCounter type 4 months ago
Jonathan G Rennison c5f026ba66 Fix multi-cargo ship capacity display in autoreplace and available ships windows 4 months ago
Jonathan G Rennison b13b2781bd Add string codes for upstream wallclock mode, add upstream language changes 4 months ago
Jonathan G Rennison fc40f485ff Fix changing the day length setting not immediately taking effect 4 months ago
SamuXarick 8584d1b5bb
Add: [Script] GetAirportNumHelipads (#12085)
Adds a function for Scripts to get the number of helipads of an airport type.
4 months ago
Peter Nelson a64ca2e0c5
Cleanup: Remove declaration of non-existent function. (#12091) 4 months ago
Peter Nelson 4ffe1da540
Fix: NewGRF roadstops were ignored if only in default class. (#12089)
If a NewGRF defines roadstops in the default class and no other classes are defined, they would be ignored and not selectable.
4 months ago
translators ac5eaecd15 Update: Translations from eints
english (au): 1 change by krysclarke
english (us): 1 change by 2TallTyler
czech: 74 changes by adamek0202
chinese (simplified): 3 changes by WenSimEHRP
luxembourgish: 42 changes by phreeze83
korean: 1 change by telk5093
german: 1 change by Wuzzy2
romanian: 19 changes by ALEX11BR
russian: 1 change by Ln-Wolf
finnish: 6 changes by lanurmi
ukrainian: 13 changes by StepanIvasyn
turkish: 26 changes by metsysma
danish: 18 changes by bscargo
latvian: 3 changes by lexuslatvia
portuguese: 1 change by azulcosta
portuguese (brazilian): 273 changes by pasantoro
4 months ago
Jonathan G Rennison e98d9a1d1d Strings: Remove DATE_WALLCLOCK_* string codes, add TT_TIME 4 months ago
Jonathan G Rennison 7ce06e22b8 Split date types into calendar and economy dates
See: 735abfe1
4 months ago
Peter Nelson 1e82d75fa2
Fix f1144de: "knots" missing from settings units list. (#12082)
Knots were added as a setting but not included in the settings list so were saved as a number instead of string.
4 months ago
Jonathan G Rennison fad5ee56e7 Update fmt StrongType adapter 4 months ago
Jonathan G Rennison 5b38b874c5 Allow StrongType types in settings tables 4 months ago
translators 4cea9a61ce Update: Translations from eints
swedish: 132 changes by sereneavatar
spanish (mexican): 31 changes by absay
english (us): 2 changes by 2TallTyler
czech: 6 changes by Caesar008
arabic (egypt): 76 changes by AviationGamerX
turkish: 91 changes by metsysma
danish: 9 changes by mamure
portuguese: 9 changes by azulcosta
portuguese (brazilian): 253 changes by pasantoro
polish: 14 changes by pAter-exe
4 months ago
Jonathan G Rennison f02d04fa12 Debug: Add vehicle engine cargo load speed and cargo ageing factors 4 months ago
Tyler Trahan f5126cba08
Fix: Accurately describe Ctrl+Clicking on a waypoint in Go To tooltip (#12081) 4 months ago
Florian 02b59920ed
Fix #12050: Add default size, shade and pin control buttons to company livery widget. (#12080) 4 months ago
Peter Nelson 14b31c8fed
Add: Show cargo icons on subsidy list window. (#12079) 4 months ago
Jonathan G Rennison 5bf478a902 Zoning: Disable company-only overlay modes in spectator 4 months ago
Jonathan G Rennison 7460e73252 SaveLoad: Fix crash when joining network server which used GRF custom town zones 4 months ago
Patric Stout 15c14a896f
Fix: survey-time seconds for clients was calculated wrong (#12078) 4 months ago
Patric Stout bad31f2d42
Fix #10079: don't render at 1000fps if HW acceleration + vsync is requested but not active (#12067) 4 months ago
Loïc Guilloux 79374bc003
Fix #12074: Don't allow "part" command for dedicated servers (#12075) 4 months ago
translators a3e6f82150 Update: Translations from eints
english (au): 2 changes by krysclarke
swedish: 307 changes by sereneavatar
galician: 127 changes by pvillaverde
romanian: 165 changes by bnegrut
spanish: 8 changes by MontyMontana
portuguese: 89 changes by azulcosta
portuguese (brazilian): 335 changes by pasantoro
4 months ago
Jonathan G Rennison 7234cdd9fd Advance state ticks in the title menu game 4 months ago
Jonathan G Rennison 2f1d2a9f4b Survey: Don't transmit invalid realtime duration 4 months ago
Patric Stout 839f2e025c
Fix: visually also disable vsync when not using HW acceleration (#12066) 4 months ago
Jonathan G Rennison 5ab5f4ace7
Codefix df691eb3: Reloading GRFs destructed small UFO targeting road vehicle (#12072) 4 months ago
Peter Nelson 481fa7dbb5
Change: Show cargo icons on Industry View window. (#12071) 4 months ago
Jonathan G Rennison 903adceab5 Maintain map of targeted road vehicles to small UFO disaster vehicle 4 months ago
Loïc Guilloux 3ffa176870
Change: [Script] Store randomizers in savegame (#12063) 4 months ago
Peter Nelson d6f34a21e8
Codefix: Incorrect storage type in cargo field of industry cargo chains window. (#12051)
`supp_cargoes` and `cust_cargoes` actually contains a column index, however this index is always stored at the indexed position...

Replace with a bitmask instead, which stores if the column indices are linked.
4 months ago
Peter Nelson df691eb31e
Codechange: Don't scan vehicle pool to find targeting disaster vehicle when deleting any vehicle. (#12064)
* Codechange: Don't scan vehicle pool to find targeting disaster vehicle when deleting any vehicle.

When deleting a vehicle, the vehicle pool is scanned to find a targetting disaster vehicle. With lots of vehicles this can take some time, especially when deleting multiple consecutive vehicles.

Disasters vehicles can actually only target road vehicles. Store the DisasterVehicle index in the road vehicle, so that no pool scan is necessary.

* Change: Small UFOs no longer target a vehicle which is already a target.
4 months ago
Patric Stout fa6f270f23
Codefix 36e1b32: remove left-over debug statement (#12068) 4 months ago
Peter Nelson 58ed38be03 Change: Avoid adjacent fence fields.
This restores pre-r23168 behaviour of only a single fence between adjacent fields.
4 months ago
Peter Nelson d6c5efd795 Change: Draw north-side farm fences/hedges/walls on tile edge, instead of 1/16th in.
This matches original TTD drawing behaviour, which is what the original baseset sprites are designed for, and avoids alignment issues (which are more problematic with high detail 4x sprites.)
4 months ago
SamuXarick fa64fff4a5
Fix #10405, a3dd750: [Script] Test engine and vehicle type validity for ScriptGroup::GetNumEngines (#11887) 4 months ago
Patric Stout 5b3bfe4c4c
Fix fdfcb09: for content service, fallback to TCP downloads when HTTP stalls (#12056) 4 months ago
Loïc Guilloux 8d9fa0ea89
Change: [Script] Use company randomizer when adding random deviation (#12065) 4 months ago
translators 378dab3750 Update: Translations from eints
galician: 85 changes by pvillaverde
estonian: 1 change by RM87
czech: 7 changes by JakMel
chinese (simplified): 1 change by WenSimEHRP
korean: 10 changes by telk5093
german: 191 changes by Wuzzy2
romanian: 122 changes by bnegrut
russian: 29 changes by Ln-Wolf
catalan: 28 changes by J0anJosep
french: 6 changes by glx22
portuguese (brazilian): 252 changes by pasantoro
4 months ago
Joan Josep 1b33b4058e
Fix: Redraw orders when a station feature is added/removed. (#12061) 4 months ago
Peter Nelson 9ec9c8d8b5
Fix: Industry tiles and houses could accept incorrect cargo types. (#12062)
Ensure the default label is cleared when NewGRFs set industry tile or house acceptance.

This was missed by #12053.
4 months ago
Jonathan G Rennison 1e2834a422 Use upstream/table format for game log chunk 4 months ago
Patric Stout d02b1547f6
Remove: setting "no_http_content_downloads" (#12058)
As we now use HTTPS, it is very likely this will work on most systems.
For systems that do have HTTPS blocked, it will fail instantly,
and it will fallback to TCP anyway. That makes this setting no longer
very useful.
4 months ago
Jonathan G Rennison 0f7eb3d8d5 Add road vehicle direction to order window manage order dropdown 4 months ago
Jonathan G Rennison b05738284b Windows: Avoid destruction of unjoined std::thread on ExitProcess
See: #649
4 months ago
Peter Nelson 8db08da148
Fix #12052: NewGRFs clearing industry cargo slots could fallback to default instead of empty. (#12053)
Ensure the default label is cleared when NewGRF sets a produced/accepted cargo slot, so that default fallback isn't used.
4 months ago
Jonathan G Rennison 09b91260b7 Adjust Korean translation 4 months ago
TELK 9396eb36bc
Update: Missing Korean translation (#647)
* Update: Korean translation up to 0.57.0

* Update: Missing Korean translation
4 months ago
Jonathan G Rennison c0a4169afd Include intrin.h in cpu.cpp for MSVC intrinsics 4 months ago
Jonathan G Rennison 3407b3edc0 Fix tile hash cache check warnings when loading very old savegames
See: #648
4 months ago
Jonathan G Rennison 11f75933bf Saveload: Use table format for DATE, VIEW, MAPS chunks
Merge MISC into DATE
4 months ago
Jonathan G Rennison 195b3b6d1d Saveload: Add initial table chunk support to non-upstream save backend 4 months ago
Tyler Trahan 7b32d9cff5 Fix #12019: Correctly highlight depot unbunch action in dropdown 4 months ago
Tyler Trahan 771615cb4b Fix #12020: Unbunch and service if needed should be mutually exclusive depot order types 4 months ago
Patric Stout 84e6c7aef3
Doc: Update documentation how to make commit message (#12046)
By writing more in the style we need for the changelog,
we avoid requiring lots of work when making a changelog.
4 months ago
Jonathan G Rennison 5aaff39164 Fix wrong saveload types for std::string 4 months ago
translators 2f35a484fe Update: Translations from eints
swedish: 1 change by SpamixOfficial
english (us): 7 changes by 2TallTyler
galician: 123 changes by pvillaverde
estonian: 5 changes by RM87
czech: 46 changes by justidan4
romanian: 19 changes by ALEX11BR
russian: 13 changes by gisterecis
finnish: 6 changes by rikkerton
catalan: 188 changes by J0anJosep
turkish: 29 changes by densxd
latvian: 7 changes by lexuslatvia
portuguese: 33 changes by azulcosta
portuguese (brazilian): 546 changes by pasantoro
polish: 24 changes by pAter-exe
4 months ago
Jonathan G Rennison 26e00d022a Fix crash when showing overwrite warning for a save with no readable version 4 months ago
Jonathan G Rennison 60e59a8233 Saveload: Add wrapper to simplify conditionally upstream chunks
Where they're always saved as upstream and conditional on a feature
4 months ago
Loïc Guilloux b84b68e959
Codechange: Rework regression output filtering (#12049) 4 months ago
Jonathan G Rennison 25e100a465 Calculate airport noise level in permissive mode as same as lenient 4 months ago
Jonathan G Rennison 2ef2142d95 Disable non-noise town airport limit in local authority permissive mode 4 months ago
Loïc Guilloux 977aba73be
Change: Store running AI config inside Company (#12003) 4 months ago
Peter Nelson 466e6bb524
Fix #12037: Blurry OpenTTD font on Mac OS. (#12047) 4 months ago
Jonathan G Rennison 516e8defb5 Add wrappers to get and update the current effective day length factor 4 months ago
Jonathan G Rennison db8b77a72e Remove empty DayLengthPreChange 4 months ago
Jonathan G Rennison a6dcc0c624 Add messages from ShowNewGrfVehicleError to special events log 4 months ago
Jonathan G Rennison 130d9cb650 Fix crash when road vehicle changed length in drive-through road stop
Due to refit and incorrectly implemented NewGRF
4 months ago
Jonathan G Rennison cfebbfac8c Merge branch 'master' into jgrpp
# Conflicts:
#	src/autoreplace_cmd.cpp
#	src/company_base.h
#	src/company_gui.cpp
#	src/cpu.cpp
#	src/debug.h
#	src/group.h
#	src/group_cmd.cpp
#	src/house.h
#	src/industry.h
#	src/newgrf_house.cpp
#	src/news_type.h
#	src/openttd.cpp
#	src/saveload/company_sl.cpp
#	src/settings_type.h
#	src/sl/oldloader_sl.cpp
#	src/story.cpp
#	src/table/town_land.h
#	src/viewport.cpp
4 months ago
Patric Stout 48e7dceb3c
Revert: Build signals to the next junction when dragging regardless of the Ctrl state (#12034)
This reverts commit b370ae1212.
4 months ago
Jonathan G Rennison bed3ef6f6b
Cleanup: Incorrect savegame number for SLV_DEPOT_UNBUNCHING constant (#12045) 4 months ago
Kuhnovic e38c3c59f3
Fix #11840: Ship pathfinder always returns a valid trackdir if one is available (#12031) 4 months ago
Loïc Guilloux b68d263d5f
Fix #12014: Remove water when area clearing ship depot (#12030) 4 months ago
Tyler Trahan 10bcf0172e
Fix #12022: Adjust economy date when changing timekeeping units in Scenario Editor (#12042) 4 months ago
Loïc Guilloux 165f92c00b
Fix #12041, 0c81579: Tarball extraction failing due to incorrect filename (#12044) 4 months ago
Jonathan G Rennison e1d629dba3 Also use custom sprite sorting for catenary pylons under bridges 4 months ago
Jonathan G Rennison a484a5eb77 Use custom sprite sorting rules for vehicles diagonally under bridges
Extend bb sprite south for comparisons, but only for vehicles underneath
This is to avoid creating sprite sorting problems for vehicles
on top of the bridge

Adjust ParentSpriteToDraw struct
4 months ago
translators 9b323b4ef9 Update: Translations from eints
english (au): 7 changes by krysclarke
galician: 1 change by pvillaverde
chinese (simplified): 3 changes by WenSimEHRP
italian: 29 changes by Giredson
german: 53 changes by MagnumSociety
ukrainian: 37 changes by StepanIvasyn
dutch: 7 changes by rcpaul
spanish: 144 changes by MontyMontana
french: 4 changes by Lishouuu
portuguese: 48 changes by azulcosta
portuguese (brazilian): 156 changes by pasantoro
polish: 22 changes by azabost, 6 changes by pAter-exe
4 months ago
Jonathan G Rennison ea8aa47832 Add missing braces around calls to ViewportMapDraw in ViewportDoDraw 4 months ago
Tyler Trahan 16e6da020d
Cleanup: Remove unnecessary Trackdir casts (#12038) 4 months ago
Loïc Guilloux 82470f5c0d
Codechange 80ebcc7: OptionMenuEntries prefix is OME not ONE (#12036) 4 months ago
Patric Stout 11f5ac72a9
Fix #12029: don't show Sandbox Options in multiplayer (#12032) 4 months ago
Jonathan G Rennison 9aa8059c79 Include elapsed state ticks since load in crash/failure logs
Consolidate game load date/time variables
4 months ago
Jonathan G Rennison d456f4a3a5 Replace DATE_UNIT_SIZE macro with a function 4 months ago
Jonathan G Rennison d39236d50c Store state ticks directly in savegame instead of the offset
Initialise the state ticks value to a constant for new games,
instead of using an implicit offset of 0
4 months ago
Jonathan G Rennison 0ea57528c9 Rename DateTicksScaled to StateTicks
Rename various other related/derived types and variables
4 months ago
Heikki Piirainen 42a88fc1d6
Fix: Finnish thousands separator (#12028)
In Finnish, the recommended digit group separator is a space rather than a dot.
4 months ago
translators d2a4f3123d Update: Translations from eints
galician: 25 changes by pvillaverde
czech: 182 changes by justidan4
hungarian: 31 changes by titanicbobo, 13 changes by Norodix
indonesian: 27 changes by tsaqibfs
german: 58 changes by UnsuspiciousGooball
russian: 18 changes by Ln-Wolf
finnish: 6 changes by hpiirai, 5 changes by lanurmi
ukrainian: 39 changes by StepanIvasyn
turkish: 3 changes by metsysma
danish: 55 changes by mamure, 6 changes by bscargo
dutch: 111 changes by Afoklala, 2 changes by robert5800
spanish: 196 changes by MontyMontana
portuguese: 4 changes by azulcosta
portuguese (brazilian): 148 changes by pasantoro
polish: 42 changes by pAter-exe, 16 changes by azabost
4 months ago
Jonathan G Rennison 39b4772a34 Convert speed units in station rating tooltip
See: #645
4 months ago
Jonathan G Rennison b6b665e989 Set GoodsEntry last_vehicle_type when resetting time_since_pickup 4 months ago
Peter Nelson 2c78146da5 Change: Limit cargo types in station cargo filter, with "More..." option to show all. 4 months ago
Peter Nelson e517e55620 Change: Include count of stations per cargo type in station cargo filter.
Cargo types with no stations are shaded to make the list clearer.
4 months ago
Peter Nelson 46da56b191 Change: Replace long list of cargo filter buttons with a multi-select dropdown list.
As before, hold ctrl while clicking on an item to toggle selections.
4 months ago
Peter Nelson 0ce30d05c8 Codechange: Add method to replace the content of a dropdown menu.
If necessary the dropdown list window will be resized and scrollbar enabled/disabled.
4 months ago
Peter Nelson ac44c001a4 Codechange: Expose `FindChildWindow()` as a method of `Window`. 4 months ago
Peter Nelson 4c44e1eae0 Codechange: Add parameter to persist dropdown menus.
If a dropdown menu is set to persist, it will not close when an item is selected. It will close as normal if the window loses focus.

Closing the list is the responsibility of the caller.
4 months ago
Peter Nelson b1c5e03df1
Fix: Don't issue autoreplace failed news message for command test mode. (#12026) 4 months ago
Peter Nelson 1f8533ebe0
Fix #12024: Autoreplace failed news message for trains must go to lead engine. (#12025) 4 months ago
Patric Stout b085f610e2
Doc: Prepare for 14.0-beta3 release (#12018)
Co-authored-by: Michael Lutz <michi@icosahedron.de>
4 months ago
Jonathan G Rennison e8c17f634b Remove randombytes from 3rdparty 4 months ago
Loïc Guilloux b0f3417025
Add: [Script] ScriptTileList_StationCoverage (#12015) 4 months ago
Jonathan G Rennison f966153ae2 Saveload: Remove use of randombytes in company passwords storage
Use RandomBytesWithFallback
Replace related key/data arrays with std::array
4 months ago
Jonathan G Rennison 9492aa1c0d Saveload: Add span overloads to ReadBuffer and MemoryDumper 4 months ago
Jonathan G Rennison 17712af318 Random: Try a little bit harder in the random bytes fallback path 4 months ago
Loïc Guilloux 0858377e9e
Fix: [Script] Don't kill GS misusing GSText (#12009) 4 months ago
merni-ns 34b05465d5
Fix 5a88027: [Script] Avoid overflow in scripts when infinite money is enabled (#12016) 4 months ago
Jonathan G Rennison f44ec32011 Replace NetworkRandomBytesWithFallback with RandomBytesWithFallback
Replace related key/data arrays with std::array
4 months ago
Jonathan G Rennison bb627e944c Serialisation: Add std::span wrappers for Recv_binary, Send_binary 4 months ago
translators 02cdd5ba8b Update: Translations from eints
spanish (mexican): 7 changes by Skinazo
english (us): 4 changes by 2TallTyler
czech: 37 changes by justidan4
chinese (simplified): 1 change by WenSimEHRP
finnish: 50 changes by Finjet-cyber, 22 changes by hpiirai
spanish: 13 changes by MontyMontana
french: 4 changes by ottdfevr
portuguese (brazilian): 141 changes by pasantoro
polish: 68 changes by pAter-exe
4 months ago
Jonathan G Rennison 2208d70e33 Merge branch 'master' into jgrpp
# Conflicts:
#	src/3rdparty/monocypher/CHANGELOG.md
#	src/3rdparty/monocypher/CMakeLists.txt
#	src/3rdparty/monocypher/README.md
#	src/3rdparty/monocypher/monocypher.h
#	src/core/random_func.cpp
#	src/misc.cpp
4 months ago
Peter Nelson e9ea837311
Fix #12012: Crash when opening orders of another company. (#12013)
Orders window changes tooltip depending on vehicle type but did check if widget exists.
4 months ago
dP e2d36f626b
Fix: Focus hotkey in road/tram stop building window (#12008) 4 months ago
Peter Nelson ae30ad7802
Fix #12001: Use correct valid cargo check for old-style NewGRF town house 3rd cargo set up. (#12006) 4 months ago
Peter Nelson 5c630e10b7
Fix 2fd90960: Missing default vehicles and industry acceptance/production. (#12000)
* Fix 2fd90960: Missing default vehicles and industry acceptance/production.

Some default definitions are used across multiple climate types and relied on climate-independent cargo slot even though they specified a climate-dependent cargo type.

Add MixedCargoType that indirectly allows multiple labels to be specified for these.
4 months ago
Tyler Trahan b2b4cceb49
Fix #11997: Adjust economy date by 1920 when loading TTD/TTO savegames (#12007) 4 months ago
translators 05e23f8fc9 Update: Translations from eints
english (au): 4 changes by krysclarke
chinese (simplified): 21 changes by WenSimEHRP
korean: 4 changes by CoconutKR
finnish: 94 changes by hpiirai
catalan: 20 changes by J0anJosep
danish: 7 changes by bscargo
latvian: 4 changes by lexuslatvia
esperanto: 31 changes by JadedCtrl
portuguese (brazilian): 283 changes by pasantoro
polish: 75 changes by pAter-exe
4 months ago
Rubidium 3534214dfc Codechange: use reference instead of pointer for CommandPacket 4 months ago
Rubidium cb588d8d3f Codechange: use std::vector for the incoming command queue 4 months ago
Rubidium b3aa8a9c35 Codechange: use std::vector for the outgoing command "queues" 4 months ago
Peter Nelson 09a12f230f
Fix: Signals were incorrectly shifted by 1 pixel when selected. (#12005)
Most shifting when pressed was removed by 884b9e66.
4 months ago
Jonathan G Rennison 347862504f Fix rail toolbar layout when polyrail button hidden at init 4 months ago
Rubidium 63708609fb Codechange: define the size of the PacketType enumerations 4 months ago
Rubidium 6f77c2eaa2 Codechange: use size_t for the MTU limits and remove default parameter 4 months ago
Rubidium 72a44b0df6 Codechange: use references for handling received TCP packets 4 months ago
Rubidium 794f12dc24 Codechange: cascade through SendNeedGame/CompanyPassword functions, instead of duplicating logic for determining whether to call these functions 4 months ago
Rubidium 8add0bf8ec Codechange: use references for game info serialization 4 months ago
Rubidium 84623d2123 Codechange: use references for UDP packets 4 months ago
Rubidium 031a9d4e26 Codechange: use std::unique_ptr for the Packets created to send via TCP 4 months ago
Rubidium 36e1b32ccf Codechange: use std::deque of std::unique_ptr to queue packets 4 months ago
Rubidium c77a45ed86 Codechange: use std::unique_ptr for receiving network packets 4 months ago
Richard Wheeler 4ba62594e5
Change: Update OpenTTD TTF fonts to v0.5 (#11994)
Corrects line height in Windows to the exact intended pixel values, along with change of OpenTTD Sans to use tabular lining numerals and minor bugfixes.
4 months ago
Patric Stout 60b6c6c7ee
Doc: Prepare for 14.0-beta2 release (#11988)
Co-authored-by: Charles Pigott <charlespigott@googlemail.com>
Co-authored-by: Michael Lutz <michi@icosahedron.de>
4 months ago
Koen Bussemaker 35c89d57f8 Codechange: Added debug printing for Water Regions 4 months ago
Koen Bussemaker 4b94457bf1 Fix #11802: Made determining water region edge traversability more robust 4 months ago
translators 9cc17230e8 Update: Translations from eints
english (au): 11 changes by krysclarke
english (us): 11 changes by 2TallTyler
galician: 3 changes by pvillaverde
chinese (simplified): 17 changes by WenSimEHRP
korean: 14 changes by telk5093
german: 78 changes by SecretIdetity
russian: 11 changes by Ln-Wolf
catalan: 23 changes by J0anJosep
danish: 2 changes by bscargo
latvian: 229 changes by lexuslatvia
french: 29 changes by glx22
portuguese: 33 changes by azulcosta
portuguese (brazilian): 28 changes by pasantoro
4 months ago
Jonathan G Rennison 5b894edde8 Fix mismatch between struct Blitter and class Blitter declarations 4 months ago
Jonathan G Rennison 77772725be Version: Committing version data for tag: jgrpp-0.57.1 4 months ago
Loïc Guilloux 64611a7d12
Fix #11975, 27a920c: Running AIs also occupy a slot (#11976) 4 months ago
dP ff618230fe
Codechange: Replace magic value with a variable (#11980) 4 months ago
Peter Nelson 2fd9096070
Change: Decouple and remove landscape-dependent cargo types. (#11719)
Cargo types of default engines, industries and houses are now specified in terms of label.
4 months ago
Peter Nelson 83d63464db
Fix #11966: Scrollbar may be incorrect on first opening of text file window. (#11981)
The scrollbar is set up before the true monospace is loaded, so reinitialise the window after loading.
4 months ago
Loïc Guilloux 75015cdad2
Fix 6f6f099: Signals exist only on plain rail tiles (#11977) 4 months ago
Biswapriyo Nath 0937158499
Fix: [CMake] Link test executable with log library in Android (#11979) 4 months ago
Peter Nelson d9461e52af
Fix #11972: Incorrect minimum width allocated to graph. (#11974)
Width was based on actual number of data points instead of possible number of data points.
4 months ago
Jonathan G Rennison cb13ee90ef Fix: Second colour vehicle-type default liveries not being updated
When changing company default second colour
4 months ago
Tyler Trahan d5e936c9d4
Fix #11968: Always set string parameters to avoid undefined behavior (#11973) 4 months ago
Jonathan G Rennison b2b96fff13 Disable threaded rendering when showing widget outlines
Because these are drawn outside the window boundary, so it is not
technically thread-safe due to non-deterministic drawing order
4 months ago
Jonathan G Rennison 16589041f2 Prevent dragging plan lines across viewports
As this leads to erratic plans
4 months ago
Jonathan G Rennison d4381d06ea Revert "Add scoped helper to temporarily override current blitter"
This reverts commit ae701a3bd8.
4 months ago
Jonathan G Rennison 4a9803c6f0 Do not override global blitter to render overlay/plans to cache buffer
Creates thread safety issues with active draw jobs
4 months ago
Jonathan G Rennison 816d4eb657 Fix ff0c77ee: Wrong pitch used to fill in scrolled plan/overlay caches 4 months ago
Jonathan G Rennison 3365efa5b2 Ensure that sprite aligner click to pick sprites is thread safe
Use a mutex for list of sprite IDs found in (threaded) draw jobs
4 months ago
Jonathan G Rennison 736539280b Fix second colour vehicle-type default liveries not being updated
When changing company default second colour
4 months ago
Tyler Trahan d0c753465d Fix f6dd505: Remove unneeded error when switching between depot actions 4 months ago
Tyler Trahan 80a704ba11 Fix f6dd505: Split depot action tooltip by vehicle type 4 months ago
Jonathan G Rennison ff0c77ee3b Blitter: Do not override global screen pitch to use 8bpp blitter
8bpp blitter keep a point to pitch (default screen pitch)
4 months ago
Rubidium 7a740eefa0 Codechange: use std::unique_ptr for managing SaveLoadParams 4 months ago
Rubidium 4b372b6050 Codechange: use std::shared_ptr to manage saveload filters instead of manually trying to avoid double frees 4 months ago
Patric Stout 22eed9616e
Doc: Prepare for 14.0-beta1 release (#11964) 4 months ago
translators bc4ed9085d Update: Translations from eints
english (au): 3 changes by krysclarke
english (us): 3 changes by 2TallTyler
chinese (simplified): 3 changes by WenSimEHRP
korean: 4 changes by telk5093
russian: 19 changes by Ln-Wolf
latvian: 67 changes by lexuslatvia
portuguese: 3 changes by azulcosta
portuguese (brazilian): 3 changes by pasantoro
4 months ago
Jonathan G Rennison 539ca43525 Replace asserts with exits in GfxFillRect 4 months ago
kiwitreekor 16574946da Add: Station variable 6B to get extended station id of nearby tiles (#10953)
(cherry picked from commit 8d62a8f0f0)
4 months ago
Jonathan G Rennison 728971ddbc Road stops: Remove 0x6B as alias of roadstop_road_info_nearby_tiles 4 months ago
Jonathan G Rennison 28b156d95c Fix rounding of right edge of viewport mark dirty area
Could result in vehicles leaving pixels behind when moving left
4 months ago
Patric Stout 0dfba564ab
Add: "restart current" console command to regenerate the map based on current settings (#11963) 4 months ago
Jonathan G Rennison 41299128e5 Explicitly cast time units when calculating wait time in LoadUnloadVehicle 4 months ago
Peter Nelson 17d02ed45f
Feature: NewGRF properties to set town production effect and multiplier. (#11947)
Town production effect is modelled on town acceptance (growth) effect, and so takes an original cargo slot for behaviour instead of a direct value.

NewGRF feature 0x0B, property 0x1E, takes 1 byte.

Valid values are:
- 0x00 to behave like passengers
- 0x02 to behave like mail
- 0xFF to behave like other cargo (i.e. not produced.)

If not set, town production effect is set based on the cargo label ('PASS' or 'MAIL').

Town production multiplier allows adjusting the amount of cargo produces when Town Production Effect is set, without needing to use callbacks.

NewGRF feature 0x0B (cargo), property 0x1F, accepts a 2 byte (word) value, similar to the cargo capacity multiplier property. The default value is 256 which means 100%, i.e. normal rate.
4 months ago
Tyler Trahan f6dd5053a3
Feature: Order flag to unbunch vehicles at depot (#11945) 4 months ago
Jonathan G Rennison 2941567c02 Fix leftover strings in Korean translation
See: #642
4 months ago
TELK 1174794c82 Update: Korean translation up to 0.57.0 4 months ago
Jonathan G Rennison 04fc0c37dc Crashlog: Tag image base with [[maybe_unused]] 4 months ago
Jonathan G Rennison 7d92f185d3 Fix picker tool item selection in rail/road station and waypoint windows 4 months ago
glx22 48c97d6cde Fix 48b6b18: Increase MAX_VALUATE_OPS to match the previous limit
(cherry picked from commit a502453033)
4 months ago
Patric Stout a0c480c4e4
Change: "restart" now uses your newgame settings, where "reload" uses the current settings (#11962) 4 months ago
Charles Pigott 59f6c199bf
Fix #11528: Don't auto-build past tunnelbridge ends (#11606) 4 months ago
kiwitreekor 8d62a8f0f0
Add: Station variable 6B to get extended station id of nearby tiles (#10953) 4 months ago
Patric Stout 849fd5ae03
Change: [Script] replace easy/medium/hard values with default value (#11959) 4 months ago
Loïc Guilloux 27a920c4a8
Change: Allow to configure AI slots above max_no_competitors (#11961) 4 months ago
Patric Stout fe4494ec11
Change: only open story-book in center when a GS does it (#11916) 4 months ago
Patric Stout 59a046de9c
Fix: don't use non-owning string pointer in StringParameter (#11952)
The string pointer can become invalid before the reference is
dropped, causing out-of-bound access in windows like ErrorWindow,
or News that copy 10 or 20 parameters for their internals.

Co-authored-by: Jonathan G Rennison <j.g.rennison@gmail.com>
4 months ago
frosch b1718478c8 Codechange: Replace old non-standard attributes with C++17/20 standard attributes. 4 months ago
frosch 8a4f0c4b02 Codechange: Simplify error throwing/catching in squirrel compiler. 4 months ago
Jonathan G Rennison 66e57e6b2d Crashlog: Handle image relocation in MinGW BFD symbol lookup 4 months ago
Jonathan G Rennison d00424008f Crashlog: Adjust Linux stacktrace format when using BFD 4 months ago
Jonathan G Rennison a4c14171a7 Crashlog: Re-use BFD instances for the same object 4 months ago
Tyler Trahan f2db624e85
Change: Add dividers between signal groups (#11897) 4 months ago
Tyler Trahan 6f6f09910d
Fix #10118: Cycle through current signal group, not just path signals (#11798) 4 months ago
Peter Nelson 2e6c6b719f Change: Link houses production on industry chain graph by TPE_PASSENGERS or TPE_MAIL cargo. 4 months ago
Peter Nelson 03b2640ea1 Change: Passenger subsidies are generated for any TPE_PASSENGER cargo type. 4 months ago
Peter Nelson 6d93fa649c Change: Towns generate cargo based on town production effect.
This replaces the fixed handling of passengers and mail.
4 months ago
Peter Nelson 8d69d0549d Codechange: Add town production effect type and assign to cargo types. 4 months ago
Peter Nelson 60dcf3b5e2 Codechange: Rename TownEffect to TownAcceptanceEffect.
This makes it clearer that TownEffect only affects acceptance behaviour.
4 months ago
translators 782cbe95d6 Update: Translations from eints
chinese (simplified): 49 changes by WenSimEHRP
russian: 47 changes by Ln-Wolf
catalan: 71 changes by J0anJosep
dutch: 114 changes by Afoklala
portuguese: 46 changes by azulcosta
portuguese (brazilian): 29 changes by pasantoro
4 months ago
Jonathan G Rennison fcc6529b6a Ensure scroll count and engine list size match in build vehicle window 4 months ago
Loïc Guilloux 4e26e33805
Change: Improve ScriptSettings windows (#11958) 4 months ago
Loïc Guilloux 0e738dda88
Fix #11948: [Win32] Convert error messages to utf8 (#11951) 4 months ago
Loïc Guilloux 3545decf2d
Cleanup e28edf6945: [Script] Left over CONFIG_RANDOM reference in documentation (#11954) 4 months ago
Loïc Guilloux a2f31c4e61
Change: Improve AIConfig window (#11949) 4 months ago
Jonathan G Rennison 860af4de29 Fix sort by total cargo in build ship window 4 months ago
Jonathan G Rennison c0b8e58404 Codechange: Simplify SetBitIterator
Use FindFirstBit and KillFirstBit, allowing simpler iterator equality
Add simple test
4 months ago
Patric Stout dce7d5d9b0
Fix #8253: allow rendering graphs with values over 2**31 / 10 (#11915) 4 months ago
Patric Stout 770ca3a624
Fix #8253: don't use INVALID_DATAPOINT for a valid value (#11913) 4 months ago
Jonathan G Rennison 3886ea75a6 Picker tool: Add support for industries 4 months ago
dP 9a2f247de9 Fix: Display rank correcly with more than 15 companies in a league table 4 months ago
Jonathan G Rennison 9f55550417 Multi-cargo ships: Sprite group cargo thresholds refer to entire ship 4 months ago
translators e1fbaf6f7f Update: Translations from eints
english (au): 5 changes by krysclarke
english (us): 5 changes by 2TallTyler
chinese (simplified): 8 changes by WenSimEHRP
korean: 5 changes by telk5093
russian: 14 changes by Ln-Wolf
latvian: 4 changes by lexuslatvia
portuguese: 11 changes by azulcosta
portuguese (brazilian): 5 changes by pasantoro
4 months ago
Jonathan G Rennison 47393b42dc VarAction2: Fix procedure calls being incorrectly eliminated
In the case where they were only referenced by substitution candidates
4 months ago
Jonathan G Rennison 000ae23eb2 VarAction2: Fix loads of temporary variable 0 not being tracked 4 months ago
Loïc Guilloux ab1407fc43
Fix: [Script] Apply random deviation only at script start (#11944) 5 months ago
Jonathan G Rennison b49a38bf6c Fix build and refit with multi-cargo ships only refitting first part 5 months ago
Patric Stout e28edf6945
Remove: [Script] CONFIG_RANDOM from AddSetting flags (#11942)
It had a very weird interaction, and was only ever used by a single
AI.
5 months ago
Jonathan G Rennison a5a315b55d Fix inconsistent order of ship running cost and capacity 5 months ago
merni-ns ccaa383e85
Fix #11938: Check infinite money setting in cases where it was missed (#11939) 5 months ago
Patric Stout 363e251a10
Change: make -dnet=9 give traces of the details of the network protocol (#11931) 5 months ago
translators bbae16574a Update: Translations from eints
english (au): 10 changes by krysclarke
english (us): 10 changes by 2TallTyler
vietnamese: 10 changes by KhoiCanDev
chinese (simplified): 62 changes by WenSimEHRP, 4 changes by XiaoJi-Game
korean: 11 changes by telk5093
russian: 5 changes by Ln-Wolf
finnish: 32 changes by hpiirai
portuguese (brazilian): 12 changes by pasantoro
5 months ago
Patric Stout 3e6ed6f44a
Fix #9697: don't extend the Online Players window too wide on opening (#11936) 5 months ago
Patric Stout 232151788d
Fix #9655: [Emscripten] install the correct files on install (#11934)
Co-authored-by: Stepan Dyatkovskiy (kaomoneus) <ml@dyatkovskiy.com>
5 months ago
Patric Stout 16c40d0844
Codechange: a wild quote appeared; it is gone now (#11935) 5 months ago
frosch 4d2fc28834 Codechange: wrap 'if' in macros into 'do { ... } while (false)', so it does not break on following 'else'. 5 months ago
frosch e0bd1dd42e Codechange: replace a macro with a lambda. 5 months ago
Patric Stout 46b1114c67
Change: forcefully enable prefixing logs with date (#11930)
Additionally, add the log-level to the log message.
5 months ago
Tyler Trahan 41f2eed425
Feature: Settings to scale cargo production of towns and industries (#10606) 5 months ago
Jonathan G Rennison 73bcd40776 Fix taking over a company using shares using the wrong news string
See: #637
5 months ago
Jonathan G Rennison 38b7c68623 Docs: Unmark road NewGRF road stops as patch feature in landscape docs 5 months ago
Jonathan G Rennison 7d086ae686 Tracerestrict: Only apply wait at PBS for intermediary signals in forward direction 5 months ago
merni-ns 96651b5ada
Cleanup: Use standard comment format (#11929) 5 months ago
translators 3e5ba614ab Update: Translations from eints
chinese (simplified): 7 changes by WenSimEHRP
russian: 24 changes by Ln-Wolf
finnish: 61 changes by hpiirai
spanish: 1 change by MontyMontana
french: 134 changes by glx22
portuguese: 22 changes by azulcosta
portuguese (brazilian): 57 changes by pasantoro
5 months ago
Jonathan G Rennison b4b61beeec Fix slot acquire on PBS reservation end on tunnel/bridge entrance signals 5 months ago
glx22 a502453033 Fix 48b6b18: Increase MAX_VALUATE_OPS to match the previous limit 5 months ago
dP 897b59c158
Add: [GS] Allow to set max loan for each company separately (#11224) 5 months ago
dP b370ae1212
Change: Build signals to the next junction when dragging regardless of the Ctrl state (#9637) 5 months ago
Jonathan G Rennison 3835500c9a Fix non-text time input dialog (when using time in minutes)
See: #638
5 months ago
merni-ns 5a88027a19
Feature: Infinite money mode (#11902) 5 months ago
Jonathan G Rennison 2b92ebade8 Fix wrong year in changelog 5 months ago
Patric Stout 7acf78964f
Remove: "generation_seed" from config, as it was a write-only value (#11927) 5 months ago
Patric Stout a05b7acec8
Change: position error window closer to cursor on large screens (#11923) 5 months ago
Tyler Trahan 2b1f78d2ca
Fix: Use alternate timekeeping units in savegame title (#11912) 5 months ago
Peter Nelson 435d48e182
Fix: Sandbox window does not reduce height when interface scale is reduced. (#11924)
line_height was only ever made larger, and icon.height ignored.
5 months ago
Patric Stout 4024bb5554
Fix #11910: use economy timer for dmp_cmds files (#11925) 5 months ago
Patric Stout f1842f9144
Add: {CURRENCY_SHORT} only did k / m suffix. Add bn / tn and make translatable. (#11921)
64bit numbers are REALLY large, but our compact method was build
for 32bit numbers. Extend it to 64bit.
5 months ago
translators 1d4b10a8b8 Update: Translations from eints
english (au): 86 changes by krysclarke
english (us): 105 changes by 2TallTyler
chinese (simplified): 29 changes by WenSimEHRP
korean: 156 changes by telk5093
russian: 4 changes by Ln-Wolf
danish: 1 change by bscargo
spanish: 132 changes by lrlopez
portuguese: 52 changes by azulcosta
portuguese (brazilian): 181 changes by pasantoro
5 months ago
dP acaceb45ba
Codechange: Make command constant names consistent with command proc (#11920) 5 months ago
Peter Nelson bf013097a7
Fix #11918: Houses should build only next to road stops, not any station type. (#11919) 5 months ago
Loïc Guilloux 90084dc74d
Codechange: ignore duplicate script messages in regression output (#11905) 5 months ago
translators 809b599c21 Update: Translations from eints
english (au): 48 changes by krysclarke
english (us): 32 changes by 2TallTyler
vietnamese: 10 changes by KhoiCanDev
chinese (simplified): 46 changes by WenSimEHRP, 2 changes by XiaoJi-Game
korean: 58 changes by telk5093
russian: 57 changes by Ln-Wolf
finnish: 22 changes by hpiirai
catalan: 30 changes by J0anJosep
danish: 12 changes by bscargo
dutch: 45 changes by Afoklala
spanish: 214 changes by lrlopez
french: 8 changes by glx22
portuguese: 23 changes by azulcosta
portuguese (brazilian): 30 changes by pasantoro
polish: 4 changes by pAter-exe
5 months ago
Koen Bussemaker 5a55c4a934 Feature: [NewGRF] Allow higher max speeds for ships 5 months ago
Loïc Guilloux 461d69a8f6
Fix #11907: Allow genders for time related {UNITS_XXX} (#11908) 5 months ago
frosch 17dfc1a49a Codechange: Replace SF_GUI_NEGATIVE_IS_SPECIAL with a settings value callback. 5 months ago
frosch 28c83089f6 Codechange: Remove TKM string code. 5 months ago
frosch 9344b50435 Codechange: Remove TKM from settings texts. 5 months ago
frosch 9e9a8ca7f6 Codechange: Add callbacks to IntSettingDesc to support dynamic strings for title, help and values. 5 months ago
frosch 022b9e92d2 Codechange: Move settings string formatting into IntSettingDesc members. 5 months ago
frosch a9d1078434 Codechange: Remove TKM from town action tooltips. 5 months ago
frosch abfeeea849 Codechange: Compose engine preview text from multiple strings. 5 months ago
frosch 68c64d2511 Codechange: Remove TKM string codes by duplicating strings. 5 months ago
frosch bd3d687bf9 Codechange: Merge all BaseGraphWindow widget enums into one.
Previously it relied on some enum entries using the same integer value.
5 months ago
frosch 69f47caf3f Codechange: Remove TKM from vehicle list sorting dropdowns. 5 months ago
frosch 9741510396 Fix: Wallclock setting should not affect percent-based service interval increments. 5 months ago
Tyler Trahan 86981c0983
Fix: Extra refit button when train/RV is in a depot (#11904) 5 months ago
Patric Stout 05b253b33b
Fix ea8c1d85: improve smoothness of smooth-scrolling for 60+Hz screens (#11884) 5 months ago
SamuXarick 0c4e509b60
Fix #10439: [GS] Validate story page button colour, flags, cursor and vehicle type (#11892)
Adds GSStoryPage::IsValidStoryPageButtonColour, GSStoryPage::IsValidStoryPageButtonFlags and GSStoryPage::IsValidStoryPageButtonCursor to the API.

Add missing enforced preconditions to validate parameters passed to MakePushButtonReference, MakeTileButtonReference and MakeVehicleButtonReference.
5 months ago
SamuXarick 76f0f9e386
Fix #10438: [GS] Validate story page element type for ScriptStoryPage::NewElement (#11888)
Fixes a crash that happens if an invalid StoryPageElementType is passed to ScriptStoryPage::NewElement.

Adds an enforced precondition that tests the validity of StoryPageElementType.

Adds GSStoryPage::IsValidStoryPageElementType to the API.
5 months ago
Peter Nelson 6d276698b6
Fix: Memory leak in ICUParagraphLayout::NextLine() (#11895)
This function calls icu::BreakIterator::createLineInstance() but does not clean up after it.

Instead use a static instance that is cloned (for thread-safety) and deleted as necessary.
5 months ago
Jonathan G Rennison 1df7b21ee3
Fix #11889: ConstructWindow not called from SurveyResultTextfileWindow constructor (#11903) 5 months ago
Patric Stout 250cf4f153
Doc: Forwardport changelog from 13.x branch (#11901) 5 months ago
Peter Nelson d3c673e20b
Fix #11894: Defer window OnResize event to avoid processing multiple times per input tick. (#11900) 5 months ago
Patric Stout 8c5ad1ade7
Fix fd9e72a7: actually use the parameter value instead of the current date (#11898) 5 months ago
Patric Stout c6dc9570f0
Fix 62d7d92a: [CI] tibdex/github-app-token's syntax changed with v2 (#11893) 5 months ago
Peter Nelson fef0bfcfd3
Fix: TextfileWindow called virtual methods before constructor completed. (#11889)
SetStringParameters() was called during widget tree init in the constructor.

Calls within a constructor cannot call the derived classes methods. This would result in invalid data being passed to the string system, which could then crash.
5 months ago
Kuhnovic 8a4a99b7e8
Fix #5713: FindClosestShipDepot only considers depots that are actually reachable (#11768) 5 months ago
Patric Stout 89520f5665
Add: show in multiplayer the amount of hours a game has been unpaused (#11886) 5 months ago
Patric Stout 2bbc95cac3
Fix: update server as offline when unexpected disconnect during refresh (#11891) 5 months ago
Richard Wheeler 8770ef6bd9
Change: Make street lights transparent with houses (#11828) 5 months ago
Rubidium 7916e97c62 Update: opengl; glext header to 20231129, wglext header to 20231018 5 months ago
Rubidium a23cd4aef7 Update: nlohmann/json to 3.11.3 5 months ago
Rubidium 79b684b8ac Update: fmt to 10.2.0 5 months ago
Patric Stout 80ebcc72fb
Change: rebrand Cheats as Sandbox Options (#11874) 5 months ago
Tyler Trahan 28716548d2
Feature: Setting to automatically restart server based on hours played (#11142) 5 months ago
Patric Stout 37fd69b604
Remove: [CI] Linux Legacy support (#11882)
Although created not long ago, you battled to be relevant.
Sadly, GitHub Runners didn't agree with you.
You can't run node20.
And that makes you a broken legacy.
So many potential.
But here we are. Bye Linux Legacy. Thank you for being.
5 months ago
Loïc Guilloux 09b66751cf
Fix b38d3c2208: missing water regions invalidation when building locks (#11879) 5 months ago
dependabot[bot] 62d7d92a0e
Upgrade: [CI] bump the actions group with 9 updates (#11881)
Bumps the actions group with 9 updates:

| Package | From | To |
| --- | --- | --- |
| [actions/checkout](https://github.com/actions/checkout) | `3` | `4` |
| [actions/cache](https://github.com/actions/cache) | `3` | `4` |
| [actions/github-script](https://github.com/actions/github-script) | `6` | `7` |
| [OpenTTD/actions](https://github.com/openttd/actions) | `2` | `5` |
| [github/codeql-action](https://github.com/github/codeql-action) | `2` | `3` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `3` | `4` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `3` | `4` |
| [tibdex/github-app-token](https://github.com/tibdex/github-app-token) | `1` | `2` |
| [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) | `2` | `3` |

Updates `actions/checkout` from 3 to 4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

Updates `actions/cache` from 3 to 4
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

Updates `actions/github-script` from 6 to 7
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v6...v7)

Updates `OpenTTD/actions` from 2 to 5
- [Release notes](https://github.com/openttd/actions/releases)
- [Commits](https://github.com/openttd/actions/compare/v2...v5)

Updates `github/codeql-action` from 2 to 3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

Updates `actions/download-artifact` from 3 to 4
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v3...v4)

Updates `actions/upload-artifact` from 3 to 4
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

Updates `tibdex/github-app-token` from 1 to 2
- [Release notes](https://github.com/tibdex/github-app-token/releases)
- [Commits](https://github.com/tibdex/github-app-token/compare/v1...v2)

Updates `peter-evans/repository-dispatch` from 2 to 3
- [Release notes](https://github.com/peter-evans/repository-dispatch/releases)
- [Commits](https://github.com/peter-evans/repository-dispatch/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/github-script
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: OpenTTD/actions
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: tibdex/github-app-token
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: peter-evans/repository-dispatch
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
5 months ago
Patric Stout cd75adfb71
Add: [Dependabot] introduce Dependabot to keep our workflows up-to-date (#11880) 5 months ago
Patric Stout 36579dd18b
Change: set smooth-scrolling on by default (#11860) 5 months ago
Patric Stout ea8c1d8597 Change: make for smooth-scrolling based on actual time
This means if rendering takes a bit longer, scrolling goes a bit
quicker, making travel time always about the same time for the
same distance.
5 months ago
Jonathan G Rennison cbb24b5d71
Codechange: Split bit numbers from values in RailTypeFlags, RoadTypeFlags enums (#11877) 5 months ago
Tyler Trahan 21581b6ab3
Feature: Setting for minutes per calendar year (#11428) 5 months ago
translators be8ed26db6 Update: Translations from eints
norwegian (nynorsk): 5 changes by translators
slovenian: 5 changes by translators
faroese: 5 changes by translators
hebrew: 5 changes by translators
afrikaans: 5 changes by translators
urdu: 5 changes by translators
persian: 5 changes by translators
bulgarian: 5 changes by translators
belarusian: 5 changes by translators
basque: 5 changes by translators
russian: 23 changes by Ln-Wolf
finnish: 1 change by hpiirai
malay: 5 changes by translators
scottish gaelic: 5 changes by translators
croatian: 5 changes by translators
latin: 5 changes by translators
french: 49 changes by glx22, 8 changes by ottdfevr
portuguese (brazilian): 80 changes by pasantoro
icelandic: 5 changes by translators
5 months ago
Tyler Trahan fd9e72a7e7
Feature: Use real-time "wallclock" timekeeping units (#11341) 5 months ago
Tyler Trahan bbdbf9a589
Add: AI/GS Time Mode to choose between economy (default) and calendar time (#11603) 5 months ago
Patric Stout a1487ce620
Add: list_[scenario|heightmap] and load_[scenario|height] console commands (#11867) 5 months ago
Tyler Trahan 76499b96fb
Fix fa479c4: Typo in vehicle list tooltip (#11871) 5 months ago
Patric Stout 090616b4c9
Add: allow loading heightmaps from command-line (#11870)
If you want to load a file from tar, you have to give the file
inside the tar in order for it to work:

<tar-file>/<dir-in-tar>/<file>.png
5 months ago
Kuhnovic bf3fd6526b
Fix: use correct size parameter type in TileArea constructors (#11869) 5 months ago
Patric Stout 11d4f1b2bd
Fix d3b2a576: LOAD_HEIGHTMAP / LOAD_SCENARIO are Scenario Editor modes (#11868) 5 months ago
Patric Stout d3b2a576de
Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc (#11628) 5 months ago
Patric Stout 75f21065c9
Codechange: refactor DecodeHexText to a generic purpose ConvertHexToBytes (#11866)
DecodeHexText() does more than just decoding hex. ConvertHexToBytes()
now only does pure hex decoding. This required a bit of refactoring
for the code using DecodeHexText().
5 months ago
translators 786cc85e86 Update: Translations from eints
english (au): 155 changes by krysclarke
norwegian (bokmal): 9 changes by v0nNemizez
english (us): 155 changes by 2TallTyler
chinese (simplified): 9 changes by WenSimEHRP
russian: 41 changes by Ln-Wolf
finnish: 1 change by hpiirai
5 months ago
Tyler Trahan 735abfe111
Codechange: Split dates and timers into Economy and Calendar time (#10700) 5 months ago
EmperorJake 419f48dfb3
Change: set amount of smoke/sparks to "realistic" by default (#11624) 5 months ago
Kuhnovic b38d3c2208
Change: simplified water region evaluation, removed savegame data (#11750) 5 months ago
Patric Stout 1985e7415b
Fix: smooth-scrolling large distances didn't got smoothly in one direction (#11861) 5 months ago
Peter Nelson c7d5cedc7b
Codechange: Replace C-style TICC/TOCC macros with C++ RAII implementation. (#11857)
Usage is more robust, and will always include timing when the TicToc object goes out of scope.
5 months ago
Peter Nelson 691c628b07
Codechange: Use named initialization for unscaled WidgetDimensions. (#11859)
Remove now-unused WD_* enums.
5 months ago
Patric Stout 0c81579363
Fix #6377: two tarballs with the same folder in them were considered as one (#11855) 5 months ago
SamuXarick 6588680ccc Revert #6923: start_date parameter is no longer in use
There was an issue with the start_date parameter for AIs. It did not let Random AIs to have their configure button clickable once the game has started, and this was due to the start_date not being pushed into the config.

But now that start_date is no longer in use since #10653, this workaround can be safely removed.
5 months ago
Patric Stout f35e257adc
Fix #9722: create vital windows as soon as local_company is set (#11858)
Many places use local_company to detect whether world generation is
done, and blindly assume all vital windows exists when local_company
is set.
5 months ago
Peter Nelson a9a0bfffc1
Change: Disable building rail infrastructure if train build limit is zero. (#11847)
This matches the behaviour of road, ship and aircraft infrastructure.
5 months ago
Peter Nelson 89474701bc
Codechange: Use templates to deduplicate goal widgets. (#11852) 5 months ago
Patric Stout fa8294ebe7
Remove: rdtsc and TIC/TOC based on CPU ticks (#11856)
Use TIC/TOC based on std::chrono instead. This information is also
easier to compare with others, as although it depends on CPU, it
means a bit more if "yours takes 4ms and mine takes 10ms".
5 months ago
Patric Stout fe035c306e
Codechange: prevent out-of-bound read (even if the result is never used) (#11853) 5 months ago
Peter Nelson 8797cc7ef2
Codechange: Replace GroupStatistics' num_engines with std::map. (#11849)
This removes manual memory management with calloc/free calls, and prevents potentially large arrays being allocated for each group.
5 months ago
Peter Nelson c0ab436077
Codechange: Store Colours in Colours type. (#11625)
This reduces casts, some magic numbers, and introduces a bit of type-safety.
5 months ago
Peter Nelson 0841978304
Codechange: Use vector and iterators to store old/new vehicles during autoreplace. (#11851)
This avoids malloc/free of 3 arrays along index counting, and the data for each part is kept together.
5 months ago
Patric Stout 66a16d5ddf
Fix: [CI] wait for all targets to succeeded before uploading to any (#11845)
Otherwise it is possible Steam upload happens while CDN upload
does not, which is a bit awkward.
5 months ago
Patric Stout 526a0db956
Fix: [CI] don't share Rust cache between legacy and generic linux (#11848)
The resulting binaries of generic can't run on legacy.
5 months ago
Rubidium 2d77f09a81 Codechange: use std::shared_ptr for vector of TCPConnecters 5 months ago
Patric Stout 71b8801b61
Fix bd85f61a: [Linux] don't include sys/random.h on older glibc systems (#11844) 5 months ago
Tyler Trahan fa479c4a7c
Cleanup: Describe modifier keys more consistently in tooltips (#11716) 5 months ago
Tyler Trahan 500870627d
Change: Rewrite a few main toolbar tooltips (#11717) 5 months ago
translators 4d79d86812 Update: Translations from eints
catalan: 18 changes by J0anJosep
5 months ago
Peter Nelson d6ccfdbbd9
Fix #11827: Make Layouter::GetCharPosition() aware of ligatures. (#11831)
When ligatures happen the precise individual character position is not known, so instead return the previous position (which is that of the ligature.)
5 months ago
Rubidium 086cbd0d72 Codechange: add constexpr to math functions where applicable 5 months ago
Rubidium dfe70181f1 Codechange: add constexpr to bitmath functions where applicable 5 months ago
Rubidium 4c51534b6a Remove: LeastCommonMultiple / GreatestCommonDivisor
Use std::lcm / std::gcd instead.
5 months ago
Rubidium 1403f24fa9 Codechange: replace LeastCommonMultiple with std::lcm 5 months ago
Patric Stout bd85f61a40 Change: use a stronger hash and actual random information to generate Uids 5 months ago
Patric Stout 37244bc8c5 Codechange: MacOS already has MIN/MAX macros defined
This is caused because we use PreCompile Headers, and one of them
includes a system headers which defines MIN/MAX.
5 months ago
Patric Stout 63a3d56b8a Add: monocypher 4.0.2
Monocypher will take care of all our encryption needs; as most
OSes and vcpkg doesn't have it available, we vendor it.
5 months ago

@ -14,3 +14,7 @@ notifications:
pull-request:
issue:
tag-created:
workflow-run:
only:
- .github/workflows/release.yml
- .github/workflows/ci-nightly.yml

@ -1,3 +1,13 @@
<!--
Commit message:
- Please use Feature / Add / Change / Fix for player-facing changes. E.g.: "Feature: My cool new feature".
- Please use Feature / Add / Change / Fix followed by "[NewGRF]" or "[Script]" for moddable changes. E.g.: "Feature: [NewGRF] My cool new NewGRF addition".
- Please use Codechange / Codefix for developer-facing changes. E.g.: "Codefix #1234: Validate against nullptr properly".
See https://github.com/OpenTTD/OpenTTD/blob/master/CODINGSTYLE.md#commit-message for more details.
-->
## Motivation / Problem
<!--

@ -1,4 +1,4 @@
name: CI
name: CI - Build
on:
pull_request:
@ -22,87 +22,22 @@ jobs:
emscripten:
name: Emscripten
runs-on: ubuntu-20.04
container:
# If you change this version, change the number in the cache step too.
image: emscripten/emsdk:3.1.42
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup cache
uses: actions/cache@v3
with:
path: /emsdk/upstream/emscripten/cache
key: 3.1.42-${{ runner.os }}
- name: Patch Emscripten to support LZMA
run: |
cd /emsdk/upstream/emscripten
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
- name: Build (host tools)
run: |
mkdir build-host
cd build-host
echo "::group::CMake"
cmake .. -DOPTION_TOOLS_ONLY=ON
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) --target tools
echo "::endgroup::"
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
run: |
mkdir build
cd build
echo "::group::CMake"
emcmake cmake .. -DHOST_BINARY_DIR=../build-host
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) -t openttd
echo "::endgroup::"
uses: ./.github/workflows/ci-emscripten.yml
secrets: inherit
linux:
strategy:
fail-fast: false
matrix:
include:
- name: Clang - Debug
compiler: clang-15
cxxcompiler: clang++-15
libraries: libsdl2-dev
- name: Clang - Release
- name: Clang
compiler: clang-15
cxxcompiler: clang++-15
libraries: libsdl2-dev
extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
- name: GCC - SDL2
compiler: gcc
cxxcompiler: g++
libraries: libsdl2-dev
- name: GCC - SDL1.2
compiler: gcc
cxxcompiler: g++
libraries: libsdl1.2-dev
- name: GCC - Dedicated
compiler: gcc
cxxcompiler: g++
@ -112,338 +47,57 @@ jobs:
name: Linux (${{ matrix.name }})
runs-on: ubuntu-latest
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.cxxcompiler }}
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
uses: ./.github/workflows/ci-linux.yml
secrets: inherit
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install dependencies
run: |
echo "::group::Update apt"
sudo apt-get update
echo "::endgroup::"
echo "::group::Install dependencies"
sudo apt-get install -y --no-install-recommends \
liballegro4-dev \
libcurl4-openssl-dev \
libfontconfig-dev \
libharfbuzz-dev \
libicu-dev \
liblzma-dev \
libzstd-dev \
liblzo2-dev \
${{ matrix.libraries }} \
zlib1g-dev \
# EOF
echo "::group::Install vcpkg dependencies"
# Disable vcpkg integration, as we mostly use system libraries.
mv vcpkg.json vcpkg-disabled.json
# We only use breakpad from vcpkg, as its CMake files
# are a bit special. So the Ubuntu's variant doesn't work.
#vcpkg install breakpad
echo "::endgroup::"
env:
DEBIAN_FRONTEND: noninteractive
- name: Get OpenGFX
run: |
mkdir -p ~/.local/share/openttd/baseset
cd ~/.local/share/openttd/baseset
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
run: |
mkdir build
cd build
echo "::group::CMake"
cmake .. ${{ matrix.extra-cmake-parameters }}
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) -t all openttd_test
echo "::endgroup::"
- name: Test
run: |
(
cd build
ctest -j $(nproc) --timeout 120
)
# Re-enable vcpkg.
mv vcpkg-disabled.json vcpkg.json
# Check no tracked files have been modified.
git diff --exit-code
with:
compiler: ${{ matrix.compiler }}
cxxcompiler: ${{ matrix.cxxcompiler }}
libraries: ${{ matrix.libraries }}
extra-cmake-parameters: ${{ matrix.extra-cmake-parameters }}
macos:
strategy:
fail-fast: false
matrix:
include:
- arch: x64
full_arch: x86_64
name: Mac OS (${{ matrix.arch }})
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install OpenGFX
run: |
mkdir -p ~/Documents/OpenTTD/baseset
cd ~/Documents/OpenTTD/baseset
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
run: |
mkdir build
cd build
- name: arm64 - Debug
arch: arm64
full_arch: arm64
extra-cmake-parameters: -DCMAKE_BUILD_TYPE=Debug
- name: arm64 - Release
arch: arm64
full_arch: arm64
extra-cmake-parameters: -DCMAKE_BUILD_TYPE=RelWithDebInfo -DOPTION_USE_ASSERTS=OFF
echo "::group::CMake"
cmake .. \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.full_arch }} \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-osx \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
# EOF
echo "::endgroup::"
name: Mac OS (${{ matrix.name }})
echo "::group::Build"
echo "Running on $(sysctl -n hw.logicalcpu) cores"
cmake --build . -j $(sysctl -n hw.logicalcpu) -t all openttd_test
echo "::endgroup::"
uses: ./.github/workflows/ci-macos.yml
secrets: inherit
- name: Test
run: |
cd build
ctest -j $(sysctl -n hw.logicalcpu) --timeout 120
with:
arch: ${{ matrix.arch }}
full_arch: ${{ matrix.full_arch }}
extra-cmake-parameters: ${{ matrix.extra-cmake-parameters }}
windows:
strategy:
fail-fast: false
matrix:
os: [windows-latest, windows-2019]
arch: [x86, x64]
name: Windows (${{ matrix.os }} / ${{ matrix.arch }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install OpenGFX
shell: bash
run: |
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
cd "C:/Users/Public/Documents/OpenTTD/baseset"
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master
- name: Configure developer command prompt for ${{ matrix.arch }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.arch }}
- name: Build
shell: bash
run: |
mkdir build
cd build
echo "::group::CMake"
cmake .. \
-GNinja \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
# EOF
echo "::endgroup::"
echo "::group::Build"
cmake --build . -t all openttd_test
echo "::endgroup::"
- name: Test
shell: bash
run: |
cd build
ctest --timeout 120
msys2:
strategy:
fail-fast: false
matrix:
include:
- msystem: MINGW64
arch: x86_64
- msystem: MINGW32
arch: i686
name: MinGW (${{ matrix.arch }})
runs-on: windows-latest
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.msystem }}
release: false
install: >-
git
make
mingw-w64-${{ matrix.arch }}-cmake
mingw-w64-${{ matrix.arch }}-gcc
mingw-w64-${{ matrix.arch }}-lzo2
mingw-w64-${{ matrix.arch }}-libpng
- name: Install OpenGFX
shell: bash
run: |
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
cd "C:/Users/Public/Documents/OpenTTD/baseset"
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
shell: msys2 {0}
run: |
mkdir build
cd build
- os: windows-latest
arch: x86
- os: windows-latest
arch: x64
echo "::group::CMake"
cmake .. -DOPTION_NO_WARN_UNINIT=1 -G"MSYS Makefiles"
echo "::endgroup::"
name: Windows (${{ matrix.arch }})
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) -t all openttd_test
echo "::endgroup::"
uses: ./.github/workflows/ci-windows.yml
secrets: inherit
- name: Test
shell: msys2 {0}
run: |
cd build
ctest --timeout 120
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
check_annotations:
name: Check Annotations
@ -452,7 +106,6 @@ jobs:
- linux
- macos
- windows
- msys2
if: always() && github.event_name == 'pull_request'
@ -460,4 +113,4 @@ jobs:
steps:
- name: Check annotations
uses: OpenTTD/actions/annotation-check@v3
uses: OpenTTD/actions/annotation-check@v5

@ -0,0 +1,69 @@
name: CI (Emscripten)
on:
workflow_call:
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
emscripten:
name: CI
runs-on: ubuntu-20.04
container:
# If you change this version, change the number in the cache step too.
image: emscripten/emsdk:3.1.42
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup cache
uses: actions/cache@v4
with:
path: /emsdk/upstream/emscripten/cache
key: 3.1.42-${{ runner.os }}
- name: Patch Emscripten to support LZMA
run: |
cd /emsdk/upstream/emscripten
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
- name: Build (host tools)
run: |
mkdir build-host
cd build-host
echo "::group::CMake"
cmake .. -DOPTION_TOOLS_ONLY=ON
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) --target tools
echo "::endgroup::"
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
run: |
mkdir build
cd build
echo "::group::CMake"
emcmake cmake .. -DHOST_BINARY_DIR=../build-host
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) --target openttd
echo "::endgroup::"

@ -0,0 +1,131 @@
name: CI (Linux)
on:
workflow_call:
inputs:
compiler:
required: true
type: string
cxxcompiler:
required: true
type: string
libraries:
required: true
type: string
extra-cmake-parameters:
required: true
type: string
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
linux:
name: CI
runs-on: ubuntu-latest
env:
CC: ${{ inputs.compiler }}
CXX: ${{ inputs.cxxcompiler }}
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Install dependencies
run: |
echo "::group::Update apt"
sudo apt-get update
echo "::endgroup::"
echo "::group::Install dependencies"
sudo apt-get install -y --no-install-recommends \
liballegro4-dev \
libcurl4-openssl-dev \
libfontconfig-dev \
libharfbuzz-dev \
libicu-dev \
liblzma-dev \
libzstd-dev \
liblzo2-dev \
${{ inputs.libraries }} \
zlib1g-dev \
# EOF
echo "::group::Install vcpkg dependencies"
# Disable vcpkg integration, as we mostly use system libraries.
mv vcpkg.json vcpkg-disabled.json
# We only use breakpad from vcpkg, as its CMake files
# are a bit special. So the Ubuntu's variant doesn't work.
#${{ runner.temp }}/vcpkg/vcpkg install breakpad
echo "::endgroup::"
env:
DEBIAN_FRONTEND: noninteractive
- name: Get OpenGFX
run: |
mkdir -p ~/.local/share/openttd/baseset
cd ~/.local/share/openttd/baseset
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
run: |
mkdir build
cd build
echo "::group::CMake"
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ inputs.extra-cmake-parameters }}
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) --target all openttd_test
echo "::endgroup::"
- name: Test
run: |
(
cd build
ctest -j $(nproc) --timeout 120
)
# Re-enable vcpkg.
mv vcpkg-disabled.json vcpkg.json
# Check no tracked files have been modified.
git diff --exit-code

@ -0,0 +1,97 @@
name: CI (MacOS)
on:
workflow_call:
inputs:
arch:
required: true
type: string
full_arch:
required: true
type: string
extra-cmake-parameters:
required: false
type: string
default: ""
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
macos:
name: CI
runs-on: macos-14
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
steps:
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Install OpenGFX
run: |
mkdir -p ~/Documents/OpenTTD/baseset
cd ~/Documents/OpenTTD/baseset
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
run: |
mkdir build
cd build
echo "::group::CMake"
cmake .. \
-DCMAKE_OSX_ARCHITECTURES=${{ inputs.full_arch }} \
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-osx \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
${{ inputs.extra-cmake-parameters }} \
# EOF
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(sysctl -n hw.logicalcpu) cores"
cmake --build . -j $(sysctl -n hw.logicalcpu) --target all openttd_test
echo "::endgroup::"
- name: Test
run: |
cd build
ctest -j $(sysctl -n hw.logicalcpu) --timeout 120

@ -0,0 +1,91 @@
name: CI (MinGW)
on:
workflow_call:
inputs:
arch:
required: true
type: string
msystem:
required: true
type: string
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
mingw:
name: CI
runs-on: windows-latest
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ inputs.msystem }}
release: false
install: >-
git
make
mingw-w64-${{ inputs.arch }}-cmake
mingw-w64-${{ inputs.arch }}-gcc
mingw-w64-${{ inputs.arch }}-lzo2
mingw-w64-${{ inputs.arch }}-libpng
mingw-w64-${{ inputs.arch }}-lld
mingw-w64-${{ inputs.arch }}-ninja
- name: Install OpenGFX
shell: bash
run: |
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
cd "C:/Users/Public/Documents/OpenTTD/baseset"
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install GCC problem matcher
uses: ammaraskar/gcc-problem-matcher@master
- name: Build
shell: msys2 {0}
env:
NINJA_STATUS: "[%f/%t -- %e] " # [finished_edges/total_edges -- elapsed_time], default value is "[%f/%t] "
run: |
mkdir build
cd build
echo "::group::CMake"
cmake .. \
-GNinja \
-DCMAKE_CXX_FLAGS="-fuse-ld=lld" \
-DOPTION_NO_WARN_UNINIT=1 \
# EOF
echo "::endgroup::"
echo "::group::Build"
cmake --build . --target all openttd_test
echo "::endgroup::"
- name: Test
shell: msys2 {0}
run: |
cd build
ctest --timeout 120

@ -0,0 +1,84 @@
name: CI - Nightly
on:
workflow_dispatch:
inputs:
ref:
description: 'Ref to build (for Pull Requests, use refs/pull/NNN/head)'
required: true
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
linux:
strategy:
fail-fast: false
matrix:
include:
- name: GCC - SDL1.2
compiler: gcc
cxxcompiler: g++
libraries: libsdl1.2-dev
name: Linux (${{ matrix.name }})
uses: ./.github/workflows/ci-linux.yml
secrets: inherit
with:
compiler: ${{ matrix.compiler }}
cxxcompiler: ${{ matrix.cxxcompiler }}
libraries: ${{ matrix.libraries }}
extra-cmake-parameters:
macos:
strategy:
fail-fast: false
matrix:
include:
- arch: x64
full_arch: x86_64
name: Mac OS (${{ matrix.arch }})
uses: ./.github/workflows/ci-macos.yml
secrets: inherit
with:
arch: ${{ matrix.arch }}
full_arch: ${{ matrix.full_arch }}
mingw:
strategy:
fail-fast: false
matrix:
include:
- msystem: MINGW64
arch: x86_64
- msystem: MINGW32
arch: i686
name: MinGW (${{ matrix.arch }})
uses: ./.github/workflows/ci-mingw.yml
secrets: inherit
with:
msystem: ${{ matrix.msystem }}
arch: ${{ matrix.arch }}
check_annotations:
name: Check Annotations
needs:
- linux
- macos
- mingw
if: always()
runs-on: ubuntu-latest
steps:
- name: Check annotations
uses: OpenTTD/actions/annotation-check@v5

@ -0,0 +1,94 @@
name: CI (Windows)
on:
workflow_call:
inputs:
arch:
required: true
type: string
os:
required: true
type: string
env:
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
windows:
name: CI
runs-on: ${{ inputs.os }}
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg
${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics
- name: Install OpenGFX
shell: bash
run: |
mkdir -p "C:/Users/Public/Documents/OpenTTD/baseset"
cd "C:/Users/Public/Documents/OpenTTD/baseset"
echo "::group::Download OpenGFX"
curl -L https://cdn.openttd.org/opengfx-releases/0.6.0/opengfx-0.6.0-all.zip -o opengfx-all.zip
echo "::endgroup::"
echo "::group::Unpack OpenGFX"
unzip opengfx-all.zip
echo "::endgroup::"
rm -f opengfx-all.zip
- name: Install MSVC problem matcher
uses: ammaraskar/msvc-problem-matcher@master
- name: Configure developer command prompt for ${{ inputs.arch }}
uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ inputs.arch }}
- name: Build
shell: bash
env:
NINJA_STATUS: "[%f/%t -- %e] " # [finished_edges/total_edges -- elapsed_time], default value is "[%f/%t] "
run: |
mkdir build
cd build
echo "::group::CMake"
cmake .. \
-GNinja \
-DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
# EOF
echo "::endgroup::"
echo "::group::Build"
cmake --build . --target all openttd_test
echo "::endgroup::"
- name: Test
shell: bash
run: |
cd build
ctest --timeout 120

@ -30,14 +30,27 @@ jobs:
steps:
- name: Checkout
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Setup vcpkg caching
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Install dependencies
run: |
echo "::group::Update apt"
@ -56,25 +69,46 @@ jobs:
libsdl2-dev \
zlib1g-dev \
# EOF
echo "::group::Install vcpkg dependencies"
# Disable vcpkg integration, as we mostly use system libraries.
mv vcpkg.json vcpkg-disabled.json
# We only use breakpad from vcpkg, as its CMake files
# are a bit special. So the Ubuntu's variant doesn't work.
${{ runner.temp }}/vcpkg/vcpkg install breakpad
echo "::endgroup::"
env:
DEBIAN_FRONTEND: noninteractive
- name: Set number of make jobs
- name: Prepare build
run: |
echo "MAKEFLAGS=-j$(nproc)" >> $GITHUB_ENV
mkdir build
cd build
echo "::group::CMake"
cmake .. -DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake
echo "::endgroup::"
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Build
run: |
cd build
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc)
echo "::endgroup::"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: /language:cpp
upload: False
@ -92,6 +126,6 @@ jobs:
output: sarif-results/cpp.sarif
- name: Upload results
uses: github/codeql-action/upload-sarif@v2
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: sarif-results/cpp.sarif

@ -25,7 +25,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
@ -35,7 +35,7 @@ jobs:
git checkout -b pr${{ github.event.pull_request.number }}
- name: Setup cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: /emsdk/upstream/emscripten/cache
key: 3.1.42-${{ runner.os }}

@ -7,6 +7,7 @@ on:
- synchronize
branches:
- master
- release/**
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}

@ -15,7 +15,7 @@ jobs:
steps:
- name: Download source
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: internal-source
@ -78,7 +78,7 @@ jobs:
echo "::endgroup::"
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-docs
path: build/bundles/*.tar.xz

@ -14,14 +14,14 @@ jobs:
runs-on: ubuntu-latest
container:
# manylinux2014 is based on CentOS 7, and already has a lot of things
# manylinux_2_28 is based on AlmaLinux 8, and already has a lot of things
# installed and preconfigured. It makes it easier to build OpenTTD.
# This distro is based on glibc 2.17, released in 2012.
image: quay.io/pypa/manylinux2014_x86_64
# This distro is based on glibc 2.28, released in 2018.
image: quay.io/pypa/manylinux_2_28_x86_64
steps:
- name: Download source
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: internal-source
@ -29,34 +29,14 @@ jobs:
run: |
tar -xf source.tar.gz --strip-components=1
# curl is too old for most of the tools to work properly. For example,
# rust-toolchain doesn't work properly, neither vcpkg caching.
# The easier solution here is to upgrade curl.
- name: Update curl
run: |
yum install -y \
openssl-devel \
# EOF
mkdir /curl
cd /curl
curl -o curl-7.81.0.zip https://curl.se/download/curl-7.81.0.zip
unzip curl-7.81.0.zip
cd curl-7.81.0
./configure --with-ssl --with-zlib --prefix=/usr --libdir=/usr/lib64
make -j $(nproc)
make install
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Enable Rust cache
uses: Swatinem/rust-cache@v2.7.0
with:
key: dedicated
uses: Swatinem/rust-cache@v2
- name: Setup vcpkg caching
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
@ -82,15 +62,6 @@ jobs:
cp /usr/share/aclocal/* /usr/local/share/aclocal/
echo "::endgroup::"
# The container we use is old enough, that it doesn't know SHF_COMPRESSED.
# But, breakpad needs this symbol to exist. So we patch it in our system
# libraries.
(
cd /
patch -p1 < ${GITHUB_WORKSPACE}/os/linux/shf-compressed.patch
)
echo "::endgroup::"
# We use vcpkg for our dependencies, to get more up-to-date version.
echo "::group::Install vcpkg and dependencies"
@ -101,17 +72,6 @@ jobs:
./bootstrap-vcpkg.sh -disableMetrics
)
# Make Python3 available for other packages. This needs to be done
# first, as otherwise dependencies fail to build because Python3 is
# not available.
(
cd /
/vcpkg/vcpkg install python3
ln -sf /vcpkg/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3
)
echo "::endgroup::"
- name: Patch bundle name
run: |
sed -i 's/generic/dedicated/g' cmake/InstallAndPackage.cmake
@ -153,7 +113,7 @@ jobs:
echo "::endgroup::"
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-linux-dedicated
path: build/bundles

@ -39,7 +39,7 @@ jobs:
steps:
- name: Download source
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: internal-source
@ -116,7 +116,7 @@ jobs:
echo "::endgroup::"
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-linux-${{ matrix.bundle_name }}
path: build/bundles

@ -1,206 +0,0 @@
name: Release (Linux, Legacy)
on:
workflow_call:
inputs:
survey_key:
required: false
type: string
default: ""
jobs:
linux:
name: Linux (Legacy)
runs-on: ubuntu-latest
container:
# manylinux2014 is based on CentOS 7, and already has a lot of things
# installed and preconfigured. It makes it easier to build OpenTTD.
# This distro is based on glibc 2.17, released in 2012.
image: quay.io/pypa/manylinux2014_x86_64
steps:
- name: Download source
uses: actions/download-artifact@v3
with:
name: internal-source
- name: Unpack source
run: |
tar -xf source.tar.gz --strip-components=1
# curl is too old for most of the tools to work properly. For example,
# rust-toolchain doesn't work properly, neither vcpkg caching.
# The easier solution here is to upgrade curl.
- name: Update curl
run: |
yum install -y \
openssl-devel \
# EOF
mkdir /curl
cd /curl
curl -o curl-7.81.0.zip https://curl.se/download/curl-7.81.0.zip
unzip curl-7.81.0.zip
cd curl-7.81.0
./configure --with-ssl --with-zlib --prefix=/usr --libdir=/usr/lib64
make -j $(nproc)
make install
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Enable Rust cache
uses: Swatinem/rust-cache@v2.7.0
with:
key: legacy
- name: Setup vcpkg caching
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install dependencies
run: |
echo "::group::Install system dependencies"
# perl-IPC-Cmd, wget, and zip are needed to run vcpkg.
# autoconf-archive is needed to build ICU.
yum install -y \
autoconf-archive \
perl-IPC-Cmd \
wget \
zip \
# EOF
# aclocal looks first in /usr/local/share/aclocal, and if that doesn't
# exist only looks in /usr/share/aclocal. We have files in both that
# are important. So copy the latter to the first, and we are good to
# go.
cp /usr/share/aclocal/* /usr/local/share/aclocal/
echo "::endgroup::"
# The yum variant of fluidsynth depends on all possible audio drivers,
# like jack, ALSA, pulseaudio, etc. This is not really useful for us,
# as we route the output of fluidsynth back via our sound driver, and
# as such do not use these audio driver outputs at all.
# The vcpkg variant of fluidsynth depends on ALSA. Similar issue here.
# So instead, we compile fluidsynth ourselves, with as few
# dependencies as possible. We do it before anything else is installed,
# to make sure it doesn't pick up on any of the drivers.
echo "::group::Install fluidsynth"
wget https://github.com/FluidSynth/fluidsynth/archive/v2.3.3.tar.gz
tar xf v2.3.3.tar.gz
(
cd fluidsynth-2.3.3
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
cmake --build . -j $(nproc)
cmake --install .
)
# The container we use is old enough, that it doesn't know SHF_COMPRESSED.
# But, breakpad needs this symbol to exist. So we patch it in our system
# libraries.
(
cd /
patch -p1 < ${GITHUB_WORKSPACE}/os/linux/shf-compressed.patch
)
echo "::endgroup::"
echo "::group::Install audio drivers"
# These audio libs are to make sure the SDL version of vcpkg adds
# sound-support; these libraries are not added to the resulting
# binary, but the headers are used to enable them in SDL.
yum install -y \
alsa-lib-devel \
jack-audio-connection-kit-devel \
pulseaudio-libs-devel \
# EOF
echo "::endgroup::"
echo "::group::Install video drivers"
# These video libs are to make sure the SDL version of vcpkg adds
# video-support; these libraries are not added to the resulting
# binary, but the headers are used to enable them in SDL.
yum install -y \
libX11-devel \
libXcursor-devel \
libXext-devel \
libXfixes-devel \
libXi-devel \
libxkbcommon-devel \
libXrandr-devel \
libXScrnSaver-devel \
# EOF
echo "::endgroup::"
# We use vcpkg for our dependencies, to get more up-to-date version.
echo "::group::Install vcpkg and dependencies"
git clone https://github.com/microsoft/vcpkg /vcpkg
(
cd /vcpkg
./bootstrap-vcpkg.sh -disableMetrics
)
# Make Python3 available for other packages. This needs to be done
# first, as otherwise dependencies fail to build because Python3 is
# not available.
(
cd /
/vcpkg/vcpkg install python3
ln -sf /vcpkg/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3
)
echo "::endgroup::"
- name: Patch bundle name
run: |
sed -i 's/generic/legacy/g' cmake/InstallAndPackage.cmake
- name: Build
run: |
mkdir -p build
cd build
echo "::group::CMake"
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_BUILD_TYPE=Release \
-DOPTION_COMPRESS_DEBUG=ON \
-DOPTION_LTO=ON \
-DOPTION_TRIM_PATH_PREFIX=ON \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
-DOPTION_PACKAGE_DEPENDENCIES=ON \
# EOF
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc) --target openttd
echo "::endgroup::"
- name: Create bundles
run: |
cd ${GITHUB_WORKSPACE}/build
echo "::group::Run CPack"
cpack
echo "::endgroup::"
echo "::group::Cleanup"
# Remove the sha256 files CPack generates; we will do this ourself at
# the end of this workflow.
rm -f bundles/*.sha256
echo "::endgroup::"
- name: Store bundles
uses: actions/upload-artifact@v3
with:
name: openttd-linux-legacy
path: build/bundles
retention-days: 5

@ -21,7 +21,7 @@ jobs:
steps:
- name: Download source
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: internal-source
@ -36,7 +36,7 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: Setup vcpkg caching
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
@ -162,7 +162,7 @@ jobs:
echo "::endgroup::"
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-linux-generic
path: build/bundles

@ -12,13 +12,18 @@ jobs:
macos:
name: MacOS
runs-on: macos-latest
runs-on: macos-14
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
steps:
- name: Setup Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Download source
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: internal-source
@ -33,13 +38,18 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: Setup vcpkg caching
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}/vcpkg
${{ runner.temp }}/vcpkg/bootstrap-vcpkg.sh -disableMetrics
- name: Install dependencies
env:
HOMEBREW_NO_AUTO_UPDATE: 1
@ -89,7 +99,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=arm64 \
-DVCPKG_TARGET_TRIPLET=arm64-osx \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=Release \
-DOPTION_TRIM_PATH_PREFIX=ON \
@ -111,7 +121,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=x86_64 \
-DVCPKG_TARGET_TRIPLET=x64-osx \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_TOOLCHAIN_FILE=${{ runner.temp }}/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=Release \
-DOPTION_TRIM_PATH_PREFIX=ON \
@ -187,7 +197,7 @@ jobs:
mv _CPack_Packages/*/Bundle/openttd-*.zip bundles/
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-macos-universal
path: build-x64/bundles

@ -30,14 +30,14 @@ jobs:
steps:
- name: Checkout (Release)
if: github.event_name == 'release'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We generate a changelog; for this we need the full git log.
fetch-depth: 0
- name: Checkout (Manual)
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
# We generate a changelog; for this we need the full git log.
@ -45,7 +45,7 @@ jobs:
- name: Checkout (Trigger)
if: github.event_name == 'repository_dispatch'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.client_payload.ref }}
# We generate a changelog; for this we need the full git log.
@ -193,14 +193,14 @@ jobs:
echo "::endgroup::"
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-source
path: build/bundles/*
retention-days: 5
- name: Store source (for other jobs)
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: internal-source
path: source.tar.gz

@ -30,7 +30,7 @@ jobs:
steps:
- name: Download source
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: internal-source
@ -46,13 +46,18 @@ jobs:
uses: Swatinem/rust-cache@v2
- name: Setup vcpkg caching
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg ${{ runner.temp }}\vcpkg
${{ runner.temp }}\vcpkg\bootstrap-vcpkg.bat -disableMetrics
- name: Install dependencies
shell: bash
run: |
@ -89,22 +94,6 @@ jobs:
with:
arch: ${{ matrix.host }}
- name: Import code signing certificate
if: ${{ false }} # Disabled
shell: powershell
# If this is run on a fork, there may not be a certificate set up - continue in this case
continue-on-error: true
run: |
$tempFile = [System.IO.Path]::GetTempFileName()
$bytes = [System.Convert]::FromBase64String($env:WINDOWS_CERTIFICATE_P12)
[IO.File]::WriteAllBytes($tempFile, $bytes)
$pwd = ConvertTo-SecureString $env:WINDOWS_CERTIFICATE_PASSWORD -AsPlainText -Force
Import-PfxCertificate -FilePath $tempFile -CertStoreLocation Cert:\CurrentUser\My -Password $pwd
Remove-Item $tempFile
env:
WINDOWS_CERTIFICATE_P12: ${{ secrets.WINDOWS_CERTIFICATE_P12 }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
- name: Build (with installer)
if: inputs.is_tag == 'true'
shell: bash
@ -116,12 +105,11 @@ jobs:
cmake ${GITHUB_WORKSPACE} \
-GNinja \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
-DOPTION_USE_NSIS=ON \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
-DWINDOWS_CERTIFICATE_COMMON_NAME="${WINDOWS_CERTIFICATE_COMMON_NAME}" \
# EOF
echo "::endgroup::"
@ -129,7 +117,12 @@ jobs:
cmake --build . --target openttd
echo "::endgroup::"
env:
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_NAME }}
- name: Build (without installer)
if: inputs.is_tag != 'true'
@ -142,11 +135,10 @@ jobs:
cmake ${GITHUB_WORKSPACE} \
-GNinja \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
-DCMAKE_TOOLCHAIN_FILE="${{ runner.temp }}\vcpkg\scripts\buildsystems\vcpkg.cmake" \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
-DWINDOWS_CERTIFICATE_COMMON_NAME="${WINDOWS_CERTIFICATE_COMMON_NAME}" \
# EOF
echo "::endgroup::"
@ -154,7 +146,12 @@ jobs:
cmake --build . --target openttd
echo "::endgroup::"
env:
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_NAME }}
- name: Create bundles
shell: bash
@ -179,16 +176,18 @@ jobs:
- name: Sign installer
if: ${{ false }} # inputs.is_tag == 'true'
shell: bash
# If this is run on a fork, there may not be a certificate set up - continue in this case
continue-on-error: true
run: |
cd ${GITHUB_WORKSPACE}/build/bundles
../../os/windows/sign.bat *.exe "${WINDOWS_CERTIFICATE_COMMON_NAME}"
${GITHUB_WORKSPACE}/os/windows/sign.bat "${GITHUB_WORKSPACE}/build/bundles"
env:
WINDOWS_CERTIFICATE_COMMON_NAME: ${{ secrets.WINDOWS_CERTIFICATE_COMMON_NAME }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CODESIGN_ACCOUNT_NAME: ${{ secrets.AZURE_CODESIGN_ACCOUNT_NAME }}
AZURE_CODESIGN_ENDPOINT: ${{ secrets.AZURE_CODESIGN_ENDPOINT }}
AZURE_CODESIGN_PROFILE_NAME: ${{ secrets.AZURE_CODESIGN_PROFILE_NAME }}
- name: Store bundles
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: openttd-windows-${{ matrix.arch }}
path: build/bundles

@ -31,16 +31,6 @@ jobs:
with:
version: ${{ needs.source.outputs.version }}
linux-legacy:
name: Linux (Legacy)
needs: source
uses: ./.github/workflows/release-linux-legacy.yml
secrets: inherit
with:
survey_key: ${{ needs.source.outputs.survey_key }}
linux:
name: Linux (Generic)
needs: source

@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check for finding script functions that require company/deity mode enforcement/checks
run: |

@ -15,7 +15,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check for unused strings
run: |

@ -1,2 +1,2 @@
jgrpp-0.57.0 20240130 0 8364ba3ce78fbaa30ad26171784e31f830ab6074 1 0 2024
50ff4d967f593d25dd3963ecf5b55a7cee0ed0b2dfac9e83bbeb100384edf6eb -
jgrpp-0.59.1 20240519 0 5e971bfc026aa9a58773d89c583e78765156b9e4 1 0 2024
f0d82005ae0e64dc0f833d5cbd6776afb06c9a513cc83119ce8fd0a2e5be097b -

@ -5,7 +5,7 @@ if(NOT BINARY_NAME)
endif()
project(${BINARY_NAME}
VERSION 14.0
VERSION 15.0
)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
@ -350,6 +350,10 @@ if(NOT OPTION_NO_SPLIT_LIB)
target_link_libraries(openttd openttd_lib)
target_link_libraries(openttd_test PRIVATE openttd_lib)
if(ANDROID)
target_link_libraries(openttd_test PRIVATE log)
endif()
include(Catch)
catch_discover_tests(openttd_test)
endif()
@ -524,6 +528,7 @@ if(WIN32)
usp10
psapi
winhttp
bcrypt
)
endif()
@ -531,6 +536,10 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DPOINTER_IS_64BIT)
endif()
if(OPTION_NO_TAGGED_PTRS)
add_definitions(-DNO_TAGGED_PTRS)
endif()
enable_testing()
add_subdirectory(regression)

@ -157,7 +157,7 @@ enum SomeEnumeration {
* Use curly braces and put the contained statements on their own lines (e.g., don't put them directly after the **if**).
* Opening curly bracket **{** stays on the first line, closing curly bracket **}** gets a line to itself (except for the **}** preceding an **else**, which should be on the same line as the **else**).
* When only a single statement is contained, the brackets can be omitted. In this case, put the single statement on the same line as the preceding keyword (**if**, **while**, etc.). Note that this is only allowed for if statements without an **else** clause.
* All fall throughs must be documented, using a **FALLTHROUGH** define/macro.
* Non-trivial fall throughs must be documented, using a `[[fallthrough]]` attribute.
* The NOT_REACHED() macro can be used in default constructs that should never be reached.
* Unconditional loops are written with **`for (;;) {`**
@ -180,7 +180,7 @@ switch (a) {
case 1:
DoSomething();
FALLTHROUGH;
[[fallthrough]];
case 2:
DoMore();
@ -191,7 +191,7 @@ switch (a) {
int r = 2;
DoEvenMore(a);
FALLTHROUGH;
[[fallthrough]];
}
case 4: {
@ -248,7 +248,7 @@ Templates are a very powerful C++ tool, but they can easily confuse beginners. T
* Templates are to be documented in a very clear and verbose manner. Never assume anything in the documentation.
* the template keyword and the template layout get a separate line. typenames are either "T" or preceded by a "T", integers get a single capital letter or a descriptive name preceded by "T".
```c++
template <typename T, typename Tsomething, int N, byte Tnumber_of_something>
template <typename T, typename Tsomething, int N, uint8_t Tnumber_of_something>
int Func();
```
@ -416,36 +416,57 @@ There is a check-script on the git server (also available for clients, see below
The first line of a message must match:
```
<keyword>( #<issue>| <commit>(, (<keyword> #<issue>|<commit>))*)?: ([<section])? <Details>
<keyword>( #<issue>|<commit>(, (#<issue>|<commit>))*)?: ([<component>])? <details>
```
Keywords are:
* Add, Feature: Adding new stuff. Difference between "Feature" and "Add" is somewhat subjective. "Feature" for user-point-of-view stuff, "Add" for other.
* Change: Changing behaviour from user-point-of-view.
* Remove: Removing something from user-point-of-view.
* Codechange, Cleanup: Changes without intentional change of behaviour from user-point-of-view. Difference between "Codechange" and "Cleanup" is somewhat subjective.
* Fix, Revert: Fixing stuff.
* Doc, Update: Documentation changes, version increments, translator commits.
* Prepare: Preparation for bigger changes. Rarely used.
If you commit a fix for an [issue](https://github.com/OpenTTD/OpenTTD/issues), add the corresponding issue number in the form of #NNNN. Do it as well if you implement a feature with a matching entry.
Keywords can either be player-facing, NewGRF / Script author-facing, or developer-facing.
In the case of bugfixes, if you know what revision the bug was introduced (eg regression), please mention that revision as well just after the prefix. Finding the trouble-causing revision is highly encouraged as it makes backporting/branching/releases that much easier.
For player-facing changes, we have these keywords:
* Feature: Adding a significant new functionality to the game. This can be small in code-size, but is meant for the bigger things from a player perspective.
* Add: Similar to Feature, but for small functionalities.
* Change: Changing existing behaviour to an extent the player needs to know about it.
* Fix: Fixing an issue with the game (as seen by the player).
* Remove: Completely removing a functionality.
* Revert: Reverting an earlier Feature / Add / Change / Fix / Remove.
* Doc: Update to (player-facing) documentation, like in the `docs/` folder etc.
* Update: Translator commits.
To further structure the changelog, you can add sections. Example are:
* "Network" for network specific changes
* "NewGRF" for NewGRF additions
* "YAPP", "NPF", for changes in these features
* "OSX", "Debian", "win32", for OS-specific packaging changes
For NewGRF / Script author-facing changes, we use the same keywords as player-facing changes, followed by `[NewGRF]` / `[Script]` component.
This also means the commit is aimed (and worded) towards the NewGRF / Script authors, rather than players.
Further explanations, general bitching, etc. don't go into the first line. Use a new line for those.
For developer-facing changes, we have these keywords:
* Codechange: Changes to the code the player is not going to notice. Refactors, modernization, etc.
* Cleanup: Similar to Codechange, but when it is more about removing old code, rather than an actual change.
* Codefix: Fixing problems in earlier commits that the player is not actually going to notice. Wrong comments, missing files, CI changes.
If you commit a `Fix` for an [issue](https://github.com/OpenTTD/OpenTTD/issues), add the corresponding issue number in the form of #NNNNN.
In the case of `Fix`es, if you know the hash of the commit in which the bug was introduced (eg regression), please mention that hash (the first 7 characters) as well just after the keyword (or, if present, after the issue number).
Finding the trouble-causing commit is highly encouraged as it makes backporting / branching / releases that much easier.
Do not mention two keywords; if two apply, pick one that best represents the commit (for example, "Fix #123" is mostly always better than "Revert", even if both are true).
The `<details>` part starts with a capital and does not end with a dot.
Try to be descriptive to what the player will notice, not to what is actually being changed in the code.
See `changelog.txt` for inspiration.
To further structure the changelog, you can add components. Example are:
* "Network" for network specific changes.
* "NewGRF" for NewGRF additions.
* "Script" for AI / GS additions.
* "YAPF", "NPF", for changes in these features.
* "MacOS", "Linux", "Windows", for OS-specific changes.
* "CI", "CMake", for changes to the (build) infrastructure.
Further explanations, more details, etc. don't go into the first line. Use a new line for those.
Complete examples:
* Fix: [YAPF] Infinite loop in pathfinder.
* Fix #5926: [YAPF] Infinite loop in pathfinder.
* Fix 80dffae130: Warning about unsigned unary minus.
* Fix #6673, 99bb3a95b4: Store the map variety setting in the samegame.
* Revert d9065fbfbe, Fix #5922: ClientSizeChanged is only called via WndProcGdi which already has the mutex.
* Fix #1264, Fix #2037, Fix #2038, Fix #2110: Rewrite the autoreplace kernel.
* `Fix: [YAPF] Infinite loop in pathfinder`
* `Fix #5926: [YAPF] Infinite loop in pathfinder`
* `Codefix 80dffae: Warning about unsigned unary minus`
* `Fix #6673, 99bb3a9: Store the map variety setting in the savegame`
* `Codefix #5922: ClientSizeChanged is only called via WndProcGdi which already has the mutex`
* `Codechange #1264, #2037, #2038, #2110: Rewrite the autoreplace kernel`
## Other tips

@ -29,7 +29,7 @@ open most older savegames or use the content downloading system.
## Windows
You need Microsoft Visual Studio 2017 or more recent.
You need Microsoft Visual Studio 2022 or more recent.
You can download the free Visual Studio Community Edition from Microsoft at
https://visualstudio.microsoft.com/vs/community/.
@ -65,7 +65,7 @@ To install both the x64 (64bit) and x86 (32bit) variants (though only one is nec
You can open the folder (as a CMake project). CMake will be detected, and you can compile from there.
If libraries are installed but not found, you need to set VCPKG_TARGET_TRIPLET in CMake parameters.
For Visual Studio 2017 you also need to set CMAKE_TOOLCHAIN_FILE.
For Visual Studio 2022 you also need to set CMAKE_TOOLCHAIN_FILE.
(Typical values are shown in the MSVC project file command line example)
Alternatively, you can create a MSVC project file via CMake. For this
@ -75,7 +75,7 @@ that comes with vcpkg. After that, you can run something similar to this:
```powershell
mkdir build
cd build
cmake.exe .. -G"Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="<location of vcpkg>\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows-static"
cmake.exe .. -G"Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="<location of vcpkg>\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET="x64-windows-static"
```
Change `<location of vcpkg>` to where you have installed vcpkg. After this
@ -83,7 +83,7 @@ in the build folder are MSVC project files. MSVC can rebuild the project
files himself via the `ZERO_CHECK` project.
## All other platforms
Minimum required version of CMake is 3.9.
Minimum required version of CMake is 3.16.
By default this produces a Debug build with assertations enabled.
This is a far slower build than release builds.
@ -110,17 +110,14 @@ builds.
- `-DOPTION_USE_ASSERTS=OFF`: disable asserts. Use with care, as assert
statements capture early signs of trouble. Release builds have them
disabled by default.
- `-DOPTION_USE_THREADS=OFF`: disable the use of threads. This will block
the interface in many places, and in general gives a worse experience of
the game. Use with care.
- `-DOPTION_TOOLS_ONLY=ON`: only build tools like `strgen`. Does not build
the game itself. Useful for cross-compiling.
## Supported compilers
Every compiler that is supported by CMake and supports C++17, should be
Every compiler that is supported by CMake and supports C++20, should be
able to compile OpenTTD. As the exact list of compilers changes constantly,
we refer to the compiler manual to see if it supports C++17, and to CMake
we refer to the compiler manual to see if it supports C++20, and to CMake
to see if it supports your compiler.
## Compilation of base sets

@ -3,14 +3,15 @@
- Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)
- Christoph Elsenhans (frosch) - General coding (since 0.6)
- Loïc Guilloux (glx) - General / Windows Expert (since 0.4.5)
- Koen Bussemaker (Kuhnovic) - General / Ship pathfinder (since 14)
- Charles Pigott (LordAro) - General / Correctness police (since 1.9)
- Michael Lutz (michi_cc) - General / Path based signals (since 0.7)
- Niels Martin Hansen (nielsm) - Music system, general coding (since 1.9)
- Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)
- Peter Nelson (peter1138) - Spiritual descendant from newGRF gods (since 0.4.5)
- Peter Nelson (peter1138) - Spiritual descendant from NewGRF gods (since 0.4.5)
- Remko Bijker (Rubidium) - Coder and way more (since 0.4.5)
- Patric Stout (TrueBrain) - NoProgrammer (since 0.3), sys op
- Tyler Trahan (2TallTyler) - General coding (since 13)
- Tyler Trahan (2TallTyler) - General / Time Lord (since 13)
### Inactive Developers:

@ -1,6 +1,10 @@
## JGR's Patchpack version 0.57.0
## JGR's Patchpack version 0.59.1
This is a collection of patches applied to [OpenTTD](http://www.openttd.org/)
This is a collection of features and other modifications applied to [OpenTTD](http://www.openttd.org/).
It's a separate version of the game which can be installed and played alongside the standard game, not a loadable mod (NewGRF, script, or so on).
This is mainly intended to be used by players who are already familiar with the standard game and how to play it.
It is not aimed at beginner/novice players. Some features and settings are there for very experienced players and so may have a steep learning curve.
* * *
@ -16,14 +20,14 @@ section "Licensing" below for details,
See [below](#openttd) for the original OpenTTD readme.
The thread for this patchpack can be found [here](http://www.tt-forums.net/viewtopic.php?f=33&t=73469).
See [jgrpp-changelog.md](jgrpp-changelog.md) for the changelog.
See the [wiki](https://github.com/JGRennison/OpenTTD-patches/wiki) for guides on how to use some of the included features.
See [installation.md](/installation.md) for instructions on how to install.
The TT-Forums thread for this patchpack can be found [here](http://www.tt-forums.net/viewtopic.php?f=33&t=73469).
(Nearly all of the patches which are listed below have been modified, fixed or extended in some way, and so are not the same as the originals which are linked).
#### Railways and Trains
@ -116,7 +120,6 @@ See [installation.md](/installation.md) for instructions on how to install.
* Open train vehicle details window on total cargo tab if shift pressed.
* Add news/advice setting to warn if no depot order in vehicle schedule.
* [Add buttons to collapse/expand all groups](http://www.tt-forums.net/viewtopic.php?f=33&t=74365).
* Add a menu item to the vehicle list to assign all listed vehicles to a new group.
* Add a setting to include the train length and group name in the vehicle details window.
* Add a setting for whether to open the new vehicle GUI when share-cloning.
* Add setting to disable mass action buttons for top-level vehicle lists.
@ -132,7 +135,6 @@ See [installation.md](/installation.md) for instructions on how to install.
* [Automated timetables and separation](http://www.tt-forums.net/viewtopic.php?f=33&t=46391).
* Allow clearing of timetable time fields which are at 0. Allow explicitly setting timetable time fields to 0 without clearing them.
* Allow changing/clearing the timetabled waiting time and max speed of all of a vehicle's orders at once.
* Add client setting to show the remainder ticks in timetable, after dividing to days or minutes.
* Add a company setting to control the number of ticks used in auto-fill timetable rounding.
* [Cargo type orders](https://www.tt-forums.net/viewtopic.php?p=1047749).
@ -167,7 +169,6 @@ See [installation.md](/installation.md) for instructions on how to install.
* [Departure boards](https://www.tt-forums.net/viewtopic.php?f=33&t=49956).
* Add road waypoints.
* Add NewGRF road stops.
* Add a setting to increase the station catchment radius.
* Station rating: track "last visited vehicle type" separately per cargo.
* Add setting to scale station cargo capacity and rating tolerance by size.
@ -188,7 +189,6 @@ See [installation.md](/installation.md) for instructions on how to install.
#### Towns
* [Town cargo generation factor](http://www.tt-forums.net/viewtopic.php?t=46399).
* [Rating in town label](http://www.tt-forums.net/viewtopic.php?f=33&t=42598).
* [Random town road reconstruction](https://www.tt-forums.net/viewtopic.php?f=33&t=36438). This defaults to off.
* Add very and extremely slow options to town growth rate setting.
@ -205,7 +205,6 @@ See [installation.md](/installation.md) for instructions on how to install.
#### Industries
* Industry cargo generation factor.
* Allow linking only inputs or outputs to the smallmap and map mode viewports in the industry chain window.
#### Map and Landscaping
@ -215,14 +214,13 @@ See [installation.md](/installation.md) for instructions on how to install.
* Add a new tree placement mode (perfect).
* [Minimum town distance](https://www.tt-forums.net/viewtopic.php?f=33&t=33625).
* Add map generation settings to control river/lake, rocky patch, and tropic zone generation.
* Add generation of wide rivers.
* Add settings to customise the size of town zones, and city zones.
* Add setting to show purchased land using clear tile ground sprites (dirt, grass, snow, desert, etc).
#### Construction
* Enable building rivers in game. Off by default.
* Add a setting to disable removing sea/rivers.
* Allow building objects by area (1x1 objects only).
* Allow purchasing a region of tiles at once, by dragging.
* Add setting to control if and how land purchasing is permitted.
* Add a company rate limit for land purchasing.
@ -304,7 +302,6 @@ See [installation.md](/installation.md) for instructions on how to install.
* Add setting to allow non server admins to use the money cheat in multiplayer.
* Allow clicking the money text in the cheats window to enter a quantity.
* Add cheats to set inflation income and cost factors.
* Add cheat to set all station ratings to 100%.
* Add cheat to set all town local authority ratings to Outstanding.
#### Cargo Distribution and Link Graph
@ -323,7 +320,6 @@ See [installation.md](/installation.md) for instructions on how to install.
#### Console and Scripts
* Add basic tab-completion to the console window.
* Add console commands for conditional execution from game date.
* [Daily/monthly/yearly scripts](http://www.tt-forums.net/viewtopic.php?f=33&t=49595)
@ -508,6 +504,15 @@ Most types of add-on content can be downloaded within OpenTTD via the 'Check Onl
Add-on content can also be installed manually, but that's more complicated; the [OpenTTD wiki](https://wiki.openttd.org/) may offer help with that, or the [OpenTTD directory structure guide](./docs/directory_structure.md).
### 1.5.1) Social Integration
OpenTTD has the ability to load plugins to integrate with Social Platforms like Steam, Discord, etc.
To enable such integration, the plugin for the specific platform has to be downloaded and stored in the `social_integration` folder.
See [OpenTTD's website](https://www.openttd.org), under Downloads, for what plugins are available.
### 1.6) OpenTTD directories
OpenTTD uses its own directory structure to store game data, add-on content etc.
@ -587,6 +592,12 @@ See `src/3rdparty/catch2/LICENSE.txt` for the complete license text.
The icu scriptrun implementation in `src/3rdparty/icu` is licensed under the Unicode license.
See `src/3rdparty/icu/LICENSE` for the complete license text.
The monocypher implementation in `src/3rdparty/monocypher` is licensed under the 2-clause BSD and CC-0 license.
See `src/3rdparty/monocypher/LICENSE.md` for the complete license text.
The OpenTTD Social Integration API in `src/3rdparty/openttd_social_integration_api` is licensed under the MIT license.
See `src/3rdparty/openttd_social_integration_api/LICENSE` for the complete license text.
## 4.0 Credits
See [CREDITS.md](./CREDITS.md)

@ -4,3 +4,5 @@
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
AILog.Info("14 API compatibility in effect.");

@ -0,0 +1,6 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/

@ -4,3 +4,5 @@
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
GSLog.Info("14 API compatibility in effect.");

@ -0,0 +1,6 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/

@ -1,3 +1,467 @@
14.0-beta3 (2024-02-06)
------------------------------------------------------------------------
Add: [Script] ScriptTileList_StationCoverage to get station coverage area (#12015)
Change: Update OpenTTD TTF fonts to v0.5 (#11994)
Fix #12012: Crash when opening orders of another company (#12013)
Fix #12001: Use correct valid cargo check for old-style NewGRF town house 3rd cargo set up (#12006)
Fix #11997: Adjust economy date by 1920 when loading TTD/TTO savegames (#12007)
Fix: Focus hotkey in road/tram stop building window (#12008)
Fix: Signals were incorrectly shifted by 1 pixel when selected (#12005)
Fix: Missing default vehicles and industry acceptance/production (#12000)
Fix: [Script] Avoid overflow in scripts when infinite money is enabled (#12016)
Fix: [Script] Don't kill GS misusing GSText (#12009)
14.0-beta2 (2024-02-04)
------------------------------------------------------------------------
Change: [NewGRF] Improved support for redefining default cargo types (#11719)
Fix #11982: Crash when trying to place signals on things other than plain rails (#11977)
Fix #11975: Inconsistent behaviour when changing first AI company settings (#11976)
Fix #11972: Year cut off in graph windows (#11974)
Fix #11968: Crash when opening orders window of new vehicles (#11973)
Fix #11966: Monospace text in windows may not have been fully scrollable (#11981)
Fix #11802: Made determining water region edge traversability more robust (#11986)
Fix: Second colour vehicle-type default liveries were not being updated (#11971)
14.0-beta1 (2024-02-03)
------------------------------------------------------------------------
Feature: Order option to unbunch vehicles at depot (#11945)
Feature: Infinite money mode (#11902)
Feature: Setting to disable the loading speed penalty for trains longer than the station (#11682)
Feature: Plugin framework for Social Integration with Steam, Discord, GOG, etc (#11628)
Feature: Scalable OpenTTD TrueType font made by Zephyris (#11593)
Feature: Toyland-specific river graphics (#11523)
Feature: Add zoom level buttons to sprite aligner (#11518)
Feature: Add shading to river slopes (#11491)
Feature: Place cargo icon on cargo filter dropdowns (#11487)
Feature: Mode to display timetable in seconds (#11435)
Feature: Setting to influence how many minutes a calendar year takes (#11428)
Feature: Base graphics can offer parameters for additional settings (#11347)
Feature: Sandbox option to lock station ratings at 100% (#11346)
Feature: Setting to use real-time "wallclock" as timekeeping units (#11341)
Feature: Setting to automatically restart server based on hours played (#11142)
Feature: Add config option to set default company secondary colour for new games (#11068)
Feature: Transparency option for cost and income indicators (#11001)
Feature: Create group of vehicles from manage vehicle list button (#10890)
Feature: Show coverage highlight the same as stations when adding waypoints (#10875)
Feature: Show the number of industries already built in the Fund New Industry window (#10806)
Feature: Add search filter and name text to build waypoint window (#10786)
Feature: Setting to disallow level crossings with competitors (#10755)
Feature: Opt-in survey when leaving a game (#10719)
Feature: Replace buying/selling company shares with hostile takeovers of AI companies (#10709, #10914)
Feature: Settings to scale cargo production of towns and industries (#10606)
Feature: Separate rail/road and sea/air velocity units, and add knots (#10594)
Feature: Region-based pathfinder for ships (#10543)
Feature: Filter engine build menu by name and NewGRF extra text (#10519)
Feature: Industry directory text filter (#10518)
Feature: Ctrl+Click to reset late counter for the entire vehicle group (#10464)
Feature: Orientation of rail and road depots can be changed (#9642)
Feature: Display help and manuals in-game (#7786)
Feature: [NewGRF] Town production effect and multiplier (#11947)
Feature: [NewGRF] Randomize direction of rail vehicle on build based on probability callback (#11489)
Feature: [NewGRF] Related Act2 objects for airports and airport tiles (#11282)
Feature: [NewGRF] Allow higher max speeds for ships (#10734)
Feature: [NewGRF] Increase limit of objects/stations/roadstops per NewGRF (#10672)
Feature: [NewGRF] Road stops (#10144)
Feature: [Script] Goal destination can be updated (#10817)
Add: Argument for console command "restart" to use either current or newgame settings (#11962, #11963)
Add: {CURRENCY_SHORT} only did k / m suffix. Add bn / tn and make translatable (#11921)
Add: Show in multiplayer the amount of hours a game has been unpaused (#11886)
Add: Allow loading heightmaps from command-line (#11870)
Add: List_[scenario|heightmap] and load_[scenario|height] console commands (#11867)
Add: Latvian Lats currency (#11691)
Add: Horizontal scroll for script debug log (#11597)
Add: GUI options to select sprite font and AA mode for all fonts (#11593)
Add: Website button for basesets in Game Options window, the Game Script settings window and AI settings window (#11512)
Add: [Emscripten] Support for bootstrapping (#11109)
Add: Hotkey to focus town / industry directory filter box (#11030)
Add: Maximum number of companies allowed to the client list (#10523)
Add: Use specific error message when vehicle cannot go to station/waypoint (#10494)
Add: Show NewGRF name in NewGRF-created errors (#10457)
Add: Alternative setting for right-click close window option to exclude pinned windows (#10204)
Add: Allow autoreplace with same model vehicle (#7729)
Add: [NewGRF] Allow inspection of road tiles and airports (#11282, #11323)
Add: [NewGRF] Station variable 6B to get extended station id of nearby tiles (#10953)
Add: [NewGRF] String code "9A 21" to display force from textstack (#10782)
Add: [NewGRF] Station property 1C/1D to set name/classname (#10672)
Add: [Script] Optional filter parameter to ScriptXXXList constructors (#11698,#11663)
Add: [Script] AI/GS Time Mode to choose between economy (default) and calendar time (#11603)
Add: [Script] Allow to set max loan for each company separately (#11224)
Add: [Script] GSIndustry.GetConstructionDate() method (#11145)
Add: [Script] Game script control of industry production level and news messages (#11141)
Add: [Script] GSAsyncMode to set async mode of gamescript commands (#10913)
Add: [Script] GSCompanyMode::IsValid and IsDeity, and enforce valid company/deity mode where applicable (#10536, #10529)
Add: [Script] Allow GS to found town with random road layout (#10442)
Add: [Script] Create own Randomizer per instance (#10349)
Change: Better handle different GUI sizes for most windows, and squash inconsistencies between windows
Change: Allow configuring AI slots above the current maximum number of competitors (#11961)
Change: Forcefully enable prefixing logs with date (#11930)
Change: Position error window closer to cursor on large screens (#11923)
Change: Only open story-book in center when a GS does it (#11916)
Change: Rebrand Cheats as Sandbox Options (#11874)
Change: Make smooth-scrolling based on actual time (#11865)
Change: Set smooth-scrolling on by default (#11860)
Change: Disable building rail infrastructure if train build limit is zero (#11847)
Change: Invalidate music volume when restarting music playback on Windows (#11836)
Change: Make street lights transparent with houses (#11828)
Change: Redesign script debug window (#11782)
Change: Reorganize Settings menu items (#11683)
Change: Set amount of smoke/sparks to "realistic" by default (#11624)
Change: Show a message in livery window if vehicle type has no groups (#11617)
Change: Add distinct tooltips for vehicle group colour schemes (#11617)
Change: Move colour selection dropdowns to bottom of window (#11617)
Change: Support custom transparency remaps with 32bpp blitters (#11616)
Change: Make "middle" the default stopping location for trains in platforms (#11605)
Change: Scale sprites to requested highest resolution level (#11600)
Change: Allow opening multiple script debug windows by holding Ctrl (#11592)
Change: Don't show scoring year in high score table (#11546)
Change: Revert pressed-button content shifting introduced in r2161 (#11542)
Change: Show rating in station list even with no cargo waiting (#11540)
Change: Hide unused cargos from vehicle cargo filter (#11533)
Change: Don't restart playback when toggling playlist shuffle (#11504)
Change: Increase finance window lines (and underlines) with interface scale (#11459)
Change: Move baseset missing/corrupted files label to list item (#11455)
Change: Add horizontal scrollbar to Industry Directory window (#11434)
Change: Improve layout of airport, dock, object, road/tram stop, train station pickers (#11430)
Change: Display cargo lists in sorted cargo order (#11383)
Change: Link houses production on industry chain graph by TPE_PASSENGERS or TPE_MAIL cargo (#11378)
Change: Passenger subsidies are generated for any TPE_PASSENGER cargo type (#11378)
Change: Towns generate cargo based on town production effect (#11378)
Change: Always allow expanding towns in Scenario Editor to build new roads (#11377)
Change: Don't set vehicle on time if timetable not started (#11359)
Change: Store station blocked/wires/pylons flags in map (#11337)
Change: Recover when possible from crashes during a crash (#11238)
Change: Store crash logs in JSON format (#11232)
Change: Remove autosave from settings window; it is already in the Game Options (#11218)
Change: Enable "Forbid 90 degree turns" setting by default (#11160)
Change: Do not allow mixing road/tram types in powered road type list (#11148)
Change: Only show platform stopping location in orders when other than default (#11102)
Change: Autorail / autoroad tools can start dragging from invalid tiles (#11089)
Change: Only allow buying Exclusive Transport Rights when no one has them (#11076)
Change: Remove currency code/symbol suffix from language files (#11061)
Change: Add separate setting for server sent commands per frame limit (#11023)
Change: Cargo flow legend only shows defined cargo (#10872)
Change: Use "Via-Destination-Source" as default station cargodist display (#10851)
Change: Preserve orders and related settings where possible when moving engines around in a train (#10799)
Change: Standardise unit conversions and allow decimal places (#10795)
Change: Use separate names for default stations/roadstops (#10786)
Change: [MacOS] Require at least 10.15 to run the game (#10745)
Change: Hide all variants from UI when (display) parent is hidden (#10708)
Change: Split Game options into General, Graphics and Sound tabs (#10674)
Change: Extend entity override manager and station spec lists to support 16 bit IDs (#10672)
Change: Base autosaves intervals on real time (instead of game time) (#10655)
Change: Allow overbuilding station and waypoint tiles (#10618)
Change: Use realtime for Linkgraph update settings (#10610)
Change: Make tick length 27 milliseconds (#10607)
Change: Increase max cargo age and let min cargo payment approach zero (#10596)
Change: Show buy company dialog window even when playing in the AI company (#10459)
Change: Use HTTPS for content-service connections (#10448)
Change: Big UFO disaster targets current location of a random train (#10290)
Change: Remove land generator setting from World Generation GUI (#10093)
Change: Build signals to the next junction when dragging regardless of the Ctrl state (#9637)
Change: Allow dedicated server to use threaded saves (#10787)
Change: [NewGRF] Increase vehicle random data from 8 to 16 bits (#10701)
Change: [NewGRF] Read Action 3 IDs as extended-bytes for all features (#10672)
Change: [NewGRF] Make Action 3 debug messages more consistent (#10672)
Change: [NewGRF] Extend callback 161 (engine name) with bit 0x22 for context 'Autoreplace - Vehicles in use' (#10666)
Change: [Script] Replace easy/medium/hard values with default value (#11959)
Change: [Script] Limit total script ops that can be consumed by a list valuate (#11670)
Change: [Script] Allow GS access to ScriptGroup, ScriptGameSettings.IsDisabledVehicleType, more ScriptCompany and more ScriptOrder functions (#10642)
Change: [Script] Improve ScriptText validation error messages (#10545)
Change: [Script] Restore support of {RAW_STRING} in ScriptText (#10492)
Change: [Script] Validate ScriptText parameters type and amount (#10492)
Change: [Script] Automate the ScriptObject reference counting (#10492)
Change: [Script] Extract params info from GS strings (#10492)
Change: [Script] A ScriptText with too many parameters is now a fatal error (#10483)
Change: [Script] Log AI/GS Squirrel crashes in white text for readability (#10375)
Fix #11918: Houses should only build next to road stops, not any station type (#11919)
Fix #11827: Make text layouter aware of ligatures (#11831)
Fix #11752: Characters could be repeated when wrapping multi-line text (#11761)
Fix #11748: Decreasing service interval value sufficiently would result in it wrapping around (#11749)
Fix #11629: Crash when getting the nearest town for rotated airports (#11631)
Fix #11516: Adjust window size by interface scale during ReInit (#11517)
Fix #11515: Changing interface scale could have unintended effects on zoom level (#11615)
Fix #11442: "Default" colour in group colour window is not updated when changing master colour (#11614)
Fix #11437: Flipped shorter rail vehicles disappear in windows (#11446)
Fix #11413: Incorrect sorting by industry production (#11414)
Fix #11407: Don't steal focus from dropdown menus (#11484)
Fix #11402: Make string filter locale-aware (#11426)
Fix #11329: Don't assert vehicle list length is non-zero when only asked to set string parameter (#11330)
Fix #11315: Sort industries and cargoes by name in industry chain window (#11317)
Fix #11307: Incorrect GroupStatistics after selling leading wagon (#11311)
Fix #11261: Airport menu selectability after closing window on a class with no available airports (#11344)
Fix #11230: Sort by button in group list window could be misaligned (#11231)
Fix #11215: Assert in NewGRF parameters window (manual parameter mode) (#11217)
Fix #11203: [Linux] Crash when editing CJK characters in edit box (#11204)
Fix #11180: Aircraft crashes could point to the wrong tile (#11184)
Fix #11164: Don't create duplicate town names when using 'Many random towns' in the scenario editor (#11165)
Fix #11162: Second company colour was not consistently applied to articulated vehicles (#11163)
Fix #11115: Focus the abandon game/exit game windows (#11125)
Fix #11096: Increase priority of error and confirmation windows (#11104)
Fix #11087: Disable base graphics/sound dropdown outside main menu (#11091)
Fix #11054: Prevent translation of currency codes (#11061)
Fix #11026: Use real engine name instead of default name for filtering (#11033)
Fix #10982: No help text for gamelog command (#10984)
Fix #10880: Crash in object window due to incorrect parameter order (#10881)
Fix #10868: Crash when Script tries to load large savegame data (#11029)
Fix #10811: Allow dragging vehicle in depot to any free row (#11508)
Fix #10660: Sprite Font scale affected by viewport zoom level limits (#10668)
Fix #10619: Crash loading linkgraph for older savegames (#10620)
Fix #10600: 'Replace Vehicles' didn't show numbers >999 (#10680)
Fix #10578: Allow to select any version of AI/GS from GUI (#10604)
Fix #10522: Link graph tooltip vertical lines were not handled correctly (#10524)
Fix #10511: Don't search for depot every tick if one cannot be found (#11548)
Fix #10478: Clarify airport noise control setting texts (#11169)
Fix #10452: Prevent long stalls during river generation (#11544)
Fix #10430: Display chain window causing assert (#10431)
Fix #10343: Don't extend town-disallowed roadtypes (#10347)
Fix #10251: [MacOS] Screen looks blue-ish when using newer SDKs (#11207)
Fix #10222: Adjust line drawing algorithm (#10491)
Fix #10131: Actually cancel downloads when pressing cancel (#10485)
Fix #10118: Cycle through current signal group, not just path signals (#11798)
Fix #10439: [Script] Validate story page button colour, flags, cursor and vehicle type (#11892)
Fix #10438: [Script] Validate story page element type for ScriptStoryPage::NewElement (#11888)
Fix #9865: Removing files with the console always failed
Fix #9810: Rebuilding a through road stop costs money (#9852)
Fix #9722: Crash when pressing hotkeys early in world generation (#11858)
Fix #9697: Limit the default width of the Online Players window (#11936)
Fix #9642: Keep infrastructure totals when overbuilding road depots (#11229)
Fix #9545: Crash when all cargo types are disabled (#11432)
Fix #8846: When upgrading NewGRF presets, copy NewGRF parameters only if the NewGRF are compatible (#11348)
Fix #8253: Improve profit graph when having lots of money (#11915)
Fix #6377: Two tarballs with the same folder in them were considered as one (#11855)
Fix #5713: Ships could be sent to unreachable depots (#11768)
Fix #4575: Use Latin 'l' in English translation of zloty (#11090)
Fix #4415: Land info build date is also renovation date (#11759)
Fix: Display rank correctly with more than 15 companies in a league table (#11940)
Fix: Extra refit button when train/RV is in a depot (#11904)
Fix: Update server listing as offline when unexpected disconnect during refresh (#11891)
Fix: Horizontal scale of framerate window switched excessively (#11813)
Fix: [Linux] Various issues with resolutions and fullscreen in multi-display setups (#11778, #11779)
Fix: Build button text when train purchase window using "Engines" filter (#11755)
Fix: One-way state remained after removing road from road and tram tile (#11745)
Fix: Draw video driver info at the correct size and text wrap (#10716)
Fix: Language genders could not be applied to SCC_INDUSTRY_NAME (#11697)
Fix: Spurious cancellations of HTTP content downloads (#11668)
Fix: Calculation of initial engine age was inaccurate (#11660)
Fix: Prevent underflow if engine base life is less than 8 years (#11635)
Fix: Changing default livery did not propagate to group liveries (#11633)
Fix: Window width/height was doubly-scaled with automatic DPI switch (#11598)
Fix: Don't crash when saving a crashlog save with no main window open (#11586)
Fix: Prevent overflow when calculating max town noise (#11564)
Fix: Deleting towns did not check for waypoints referencing the town (#11513)
Fix: Invalidate playlist window when (un)shuffling playlist (#11504)
Fix: Restore original cargo legend 'blob' dimensions (#11480)
Fix: Extmidi did not move on to next song after playing ends (#11469)
Fix: Server password length in the UI was unnecessarily limited (#11408)
Fix: OpenTTD can fail to exit on an error due to mutex locks in threads (#11398)
Fix: Scale minimum width for server name by interface scale (#11381)
Fix: Server connection was not closed when relay window was closed (#11366)
Fix: Upgrading NewGRF presets could result in incomplete display of NewGRF parameters until restart (#11348)
Fix: Check for engine variant loops during NewGRF initialization (#11343)
Fix: Don't allow industries to produce invalid cargo (#11314)
Fix: Also apply cargo filters on shared groups in vehicle listing (#11294)
Fix: Only count distance traveled in vehicles for cargo payment (#11283)
Fix: Base cargo payment on load/unload tile, instead of station sign location (#11281)
Fix: Crash when opening a damaged base-graphics (#11275)
Fix: Trivial autoreplace of mixed cargo articulated engines (#11253)
Fix: [Emscripten] Config not saved on exit (#11248)
Fix: Inaccurate waiting cargo total in station window when using cargodist (#11213)
Fix: No fast forward in network was ensured only from GUI side (#11206)
Fix: Crash when not passing command-line parameter for -n (#11153)
Fix: [Bootstrap] Don't crash when failing to connect to content server (#11122)
Fix: Crash when failing to load a game into a dedicated server at startup (#11021)
Fix: Don't allow changing settings over the network that are marked as local settings (#11009)
Fix: Move no_http_content_downloads and use_relay_service to private settings (#10762)
Fix: Extra viewport could not be scrolled with right-click-close (#10644)
Fix: Specify units for value of share trading age setting (#10612)
Fix: Road type is not available before its introduction date (#10585)
Fix: Do not update a RV's Z-position when stationary while turning (#10570)
Fix: Don't (briefly) switch from title-only playlist on menu screen (#10553)
Fix: Reset content download progress to zero if falling back to TCP (#10485)
Fix: Make script goals work with the whole range of ClientIDs (#10435)
Fix: [NewGRF] Tile slope missing from road stops varact2 variable 0x42 (#11373)
Fix: [NewGRF] House class mappings were not reset between games (#11279)
Fix: [NewGRF] Profile didn't stop if there were no events yet (#10816)
Fix: [NewGRF] Support more than 256 stations/waypoints/roadstops per class (#10793)
Fix: [NewGRF] Var68 for station and roadstop was broken (#10784)
Fix: [NewGRF] Object and road stop ignore property handlers (#10525)
Fix: [Script] Apply random deviation to settings only at script start (#11944)
Fix: [Script] Improve ScriptText validation (#11721)
Fix: [Script] GSAdmin.Send() could generate invalid JSON (#11250)
Fix: [Script] Crash if squirrel compatibility scripts cannot be parsed (#11589)
Fix: [Script] Don't list unavailable road types for game scripts (#10585)
Fix: [Script] Game scripts were able to build with non-existing road types (#10539)
Fix: [Script] Inconsistent precondition failure return values (#10533)
Fix: [Script] Crash when companies disappear (#10529)
Fix: [Script] ScriptBase::Rand() return value could return negative values (#10443)
Fix: [Script] Incorrect value for GOAL_INVALID (#10436)
Fix: [Script] Extend Script::IsValidVehicle to check for primary vehicles (#10386)
Remove: "generation_seed" from config, as it was a write-only value (#11927)
Remove: Debug redirect over network (#11776)
Remove: Officially mark Vista as no longer supported (#11531)
Remove: OS/2 and SunOS ports (#11018, #11210)
Remove: Obsolete NewGRF text unprinting (#10884)
Remove: [Script] CONFIG_RANDOM from AddSetting flags (#11942)
13.4 (2023-07-29)
------------------------------------------------------------------------
Fix: Setting tree lines drawn incorrectly for RTL languages (#11070)
Fix #11043: Don't choose toolbar dropdown option if focus is lost (#11044)
Fix #10917: Pay loan interest before generating statistics (#11040)
Fix #11016: Use after free in network invalid packet error path (#11022)
Fix #10987: Double-close of dropdown stopped land-info tool working as default (#11000)
13.3 (2023-06-11)
------------------------------------------------------------------------
Fix: [Win32] use full monitor resolution for fullscreen (#10985)
13.2 (2023-06-10)
------------------------------------------------------------------------
Change: [Win32] position window in center of workspace of primary display (#10942)
Change: Automatically disable hardware acceleration when GPU driver crashed the game last attempt (#10928)
Change: [Linux] Default scroll mode to non-mouse-lock (#10920)
Change: Include font style in font name for Freetype (#10879)
Fix: Don't restore backed up vehicle name if it's no longer unique (#10979)
Fix #10975: Train name wrongly marked as unique when joining trains (#10976)
Fix: Crash when not even a single row fits for dropdowns on low resolution screens (#10934)
Fix: Crash with tooltip on low resolution screens (#10933)
Fix: Crash when window can't be placed on low resolution screens (#10932)
Fix #10502: Apply engine refit before attaching free wagons (#10926)
Fix: Wayland crash on startup due to Pango also using FontConfig (#10916)
Fix: When syncing width of GUI items, take padding into account (#10915)
Fix: Make dropdowns self-close when losing focus (#10912)
Fix: Land info window maximum width was not scaled (#10894)
Fix: Check max member count in squirrel classes (#10883)
Fix: Ask FontConfig for the face index when opening fonts (#10878)
Fix #10831: Level crossing parts left barred after crossing tile removal (#10874)
Fix: Rail waypoint selection window not closed when parent windows closed (#10873)
Fix #10846: [Script] Crash on trying to allocate an excessively large array (#10848)
Fix: [Win32] Text line breaking did not properly handle punctuation characters (#10775)
Fix: [Emscripten] Crash when saving games (#10758)
Fix: [Win32] Wrong multi-line text layout due to incorrect whitespace handling (#10752)
Fix #10741: Rail platforms left partially reserved after train crash (#10751)
Fix: Shaded engines in purchase list incorrectly shaded (#10736)
Fix #10735: [NewGRF] {POP_COLOUR} fails if string is drawn with extra flags (#10736)
Fix #8177: Ships with max speed overflow to near-zero speed (#10695)
Fix #10289: Don't silently fail when setting timetable start dates (#10690)
Fix #8302: Improve "Maintenance intervals are in percents" helptext (#10686)
Fix #10665: "No vehicles are available yet" message did not appear correctly on non-temperate climates (#10673)
Fix #10630: Don't allow shifting service date earlier than year 0 (#10643)
Fix #10637, #10638: Incorrect water infrastructure totals when building certain object types (#10639, #10640)
Fix: Abort loading savegame if road vehicle is on invalid road type (#10622)
13.1 (2023-04-10)
------------------------------------------------------------------------
Add: [NewGRF] Engine name callback for nested variants. (#10399)
Fix: Improve main toolbar tooltips (#10616)
Fix: [NewGRF] Additional validation for Action3 (+others) (#10601)
Fix: Clear button for editbox didn't take account of padding (#10583)
Fix: [Script] Access to enum/consts defined outside of main.nut (#10573)
Fix #10568: Bogus warning when loading a save with a NewGRFs on dedicated servers (#10572)
Fix #10554: Crash when scrolling in the autoreplace window with collapsed variants (#10555)
Fix: Network server highlight invisible with RTL languages. (#10551)
Fix: Client name was not being used as company manager name (#10535)
Fix: Prevent road vehicles on crossing from crashing into the side of a train (#10496)
Fix #10477: [macOS] Calculation for window sizes when using custom fonts was being rounded incorrectly (#10489)
Fix #10486: Crash in debug window when GS started before AIs (#10487)
Fix #10469: [Script] Negative numbers in League Table window were sorted incorrectly (#10471)
Fix #10465: Crash on timeout if user never enters a password for server (#10466)
Fix #10280, #10461: Crash on opening town windows as a spectator (#10462)
Fix #10059: Script config values stored in the config file could cause crashes (#10444)
13.0 (2023-02-05)
------------------------------------------------------------------------
Change #10077: Make maximum loan a positive multiple of the loan interval (#10355)
Fix #10361: [Script] Don't try to give saved data to a dead script (#10433)
Fix #10419: Water infrastructure accounting when building ship depots and docks (#10432)
13.0-RC2 (2023-01-28)
------------------------------------------------------------------------
Feature: Press Ctrl to build a diagonal area of trees (#10342)
Feature: Set a custom number of industries in map generation window (#10340)
Change: Display font status as aa/noaa instead of true/false (#10352)
Fix: [Script] Improved API documentation for scripts (#10413, #10412)
Fix #10255: Reduce basic thickness of linkgraph GUI lines (#10410)
Fix #10220: Don't select unselectable engine as default (#10404)
Fix #10395: When loading old saves, don't forcibly bar level crossings (#10400)
Fix #10377: Bad sorting of rail vehicles when primary variant is missing (#10378)
Fix #10368: Server restarting game caused clients to hit assertion (#10369)
Fix #10362: NewGRF bridges without speed limits (#10365)
Fix #10363: CargoDist setting helptext shouldn't suggest symmetric distribution for diamonds in subtropic (#10364)
Fix: [Script] Switch to OWNER_TOWN prevented OWNER_DEITY test during industry prospecting (#10360)
Fix #10009: Bad overflow protection when taking out loans (#10359)
Fix #9865: Removing files with the console always failed (#10357)
Fix #10057: FallbackParagraphLayout fails to properly wrap (#10356)
Fix #10177: Company list password padlock showed after switching to single player (#10354)
Fix: Various Wide River issues (#10348)
Fix: Link variants to parents when finalising engines (#10346)
Fix #10333: Only show industry prospecting errors to local company (#10338)
Fix #10335: Set initial scrollbar count for object GUI (#10336)
Fix #10331: Starting new company during load must happen after AI start (#10332)
Fix #10309: [SDL] Uninitialized width and height when turning off full screen (#10328)
Fix #10032: Capacities of articulated vehicles in build window (#10326)
Fix: Improve handling of corrupt NewGRF or image files (#10321, #10316)
Fix: [NewGRF] Don't assume engclass 2 should be elrail (#10315)
Fix: [Script] AIGroup.GetProfitLastYear could get values different than those displayed in GUI (#10227)
Fix #10304: [Scripts] Don't start GS in intro game (#10305)
Fix: [Script] Copy compat files for version 13 (#10303)
13.0-RC1 (2023-01-01)
------------------------------------------------------------------------
Feature: 'font' console command to configure fonts within game (#10278)
Feature: Ctrl-click to bulk edit timetable speeds/waiting times (#10265)
Feature: [NewGRF] Vehicle variants in expandable purchase list (#10220)
Feature: Expand all towns in the scenario editor (#10215)
Add: [NewGRF] Slope-aware and roadtype-specific one-way sprites (#10282)
Change: Display text files in black (#10291)
Change: Make vehicle list dropdown buttons resize to fit strings (#10286)
Change: [NewGRF] Support flipping shorter engines without explicit support (#10262)
Change: Separate ground sprite from foundation sprite offsets (#10256)
Change: Vertically centre sprite font relative to TrueType font (#10254)
Change: [macOS] Set minimum macOS version to 10.13 (#10253)
Change: Use lowered not disabled widget for current vehicle details tab (#10252)
Change: Various improvements to NewGRF sprite aligner (#10249)
Change: reset_engines console command now rerandomises introduction dates and reliability (#10220)
Change: Show error message on failed industry prospecting (#10202)
Fix: Local authority window rating list height ignored icon sizes (#10285)
Fix #10150: Town signs could be truncated when using custom fonts (#10283)
Fix #8971: Resize QueryStrings with interface scale change (#10281)
Fix #10274: Crash when rescanning scripts with GS selected (#10276)
Fix #10151: Use smaller padding for signs (#10272)
Fix #10263: [Script] Restore tile validation for commands (#10269)
Fix: Missing scrollbar for rail/roadtype dropdowns (#10264)
Fix #10260: Incorrect rect height drawing image in vehicle details (#10261)
Fix #10257: Incorrect catenary position on sloped bridge heads (#10258)
Fix: Vertically centre chat prompt (#10250)
Fix #10214: League and graph buttons in toolbar did not have a default action (#10246)
Fix #10242: Allow a space for text shadow when clipping text (#10243)
Fix #10206: Fully disable scripts in intro game (#10241)
Fix #10218: Don't try to create river tiles along incorrect slopes (#10235)
Fix #10208: [NewGRF] Allow using a specific underlay for road/tram tunnels (#10233)
Fix #10224: Don't change fast-forward mode while saving (#10230)
Fix #10147: Sound effect volume slider no longer set volume (#10228)
Fix #10223: Crash when vehicle cloning fails on order cloning (#10225)
Fix: Maximum space for engine preview image was never scaled (#10219)
Fix #10216: Crash when upgrading savegame with crashed vehicles (#10217)
Fix #10212: [Script] Nested ScriptAccounting scopes not restored properly (#10213)
Fix #10114: Incorrect drag-highlight position with non-power-of-2 scaling (#10211)
Fix #10198: Rearrange Intro GUI to make button rows narrower (#10203)
Fix: Missing extra padding when drawing tooltip text (#10201)
Fix: Bad alignment of button icons when using the original baseset (#10200)
Fix: Signal icons incorrectly positioned in UI (#10199)
Fix #10021: Object GUI resized when switching between different objects (#10196)
Fix #9720: Delay start of GS/AI to after loading of savegame (#9745)
13.0-beta2 (2022-11-27)
------------------------------------------------------------------------
Feature: Allow AI/GS to be fully modified in scenario editor (#10152)

@ -41,6 +41,12 @@ macro(compile_flags)
"$<$<CONFIG:Debug>:-Wa,-mbig-obj>" # Switch to pe-bigobj-x86-64 as x64 Debug builds push pe-x86-64 to the limits (linking errors with ASLR, ...)
)
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
# Fix MinGW's incorrect assumption that the incoming stack at function calls is 16-byte aligned
# The Win32 API/calling convention only requires and guarantees 4-byte alignment, leading to alignment problems with SSE/AVX/etc
add_compile_options(-mincoming-stack-boundary=2 -mpreferred-stack-boundary=2)
endif()
add_compile_options(-Wno-stringop-overflow) # This warning false-positives on some MinGW versions so just turn it off
endif()
# Prepare a generator that checks if we are not a debug, and don't have asserts
@ -85,8 +91,6 @@ macro(compile_flags)
# break anything. So disable strict-aliasing to make the
# compiler all happy.
-fno-strict-aliasing
)
if(OPTION_TRIM_PATH_PREFIX)
@ -137,6 +141,13 @@ macro(compile_flags)
# and of course they both warn when the other compiler is happy
"$<$<COMPILE_LANGUAGE:CXX>:-Wno-redundant-move>"
)
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
add_compile_options(
# GCC >= 11 has false positives if operator new is inlined but operator delete isn't, or vice versa
"-Wno-mismatched-new-delete"
)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")

@ -23,16 +23,28 @@ install(TARGETS openttd
COMPONENT Runtime
)
install(DIRECTORY
${CMAKE_BINARY_DIR}/lang
${CMAKE_BINARY_DIR}/baseset
${CMAKE_BINARY_DIR}/ai
${CMAKE_BINARY_DIR}/game
${CMAKE_SOURCE_DIR}/bin/scripts
DESTINATION ${DATA_DESTINATION_DIR}
COMPONENT language_files
REGEX "ai/[^\.]+$" EXCLUDE # Ignore subdirs in ai dir
)
if (NOT EMSCRIPTEN)
# Emscripten embeds these files in openttd.data.
# See CMakeLists.txt in the root.
install(DIRECTORY
${CMAKE_BINARY_DIR}/lang
${CMAKE_BINARY_DIR}/baseset
${CMAKE_BINARY_DIR}/ai
${CMAKE_BINARY_DIR}/game
${CMAKE_SOURCE_DIR}/bin/scripts
DESTINATION ${DATA_DESTINATION_DIR}
COMPONENT language_files
REGEX "ai/[^\.]+$" EXCLUDE # Ignore subdirs in ai dir
)
else()
install(FILES
${CMAKE_BINARY_DIR}/openttd.js
${CMAKE_BINARY_DIR}/openttd.wasm
${CMAKE_BINARY_DIR}/openttd.data
DESTINATION ${BINARY_DESTINATION_DIR}
COMPONENT Runtime
)
endif()
install(FILES
${CMAKE_SOURCE_DIR}/COPYING.md
@ -80,7 +92,7 @@ if(OPTION_INSTALL_FHS)
COMPONENT manual)
endif()
if(UNIX AND NOT APPLE)
if(UNIX AND NOT APPLE AND NOT EMSCRIPTEN)
install(DIRECTORY
${CMAKE_BINARY_DIR}/media/icons
${CMAKE_BINARY_DIR}/media/pixmaps
@ -159,10 +171,10 @@ elseif(WIN32)
set(CPACK_PACKAGE_FILE_NAME "openttd-#CPACK_PACKAGE_VERSION#-windows-${CPACK_SYSTEM_NAME}")
if(WINDOWS_CERTIFICATE_COMMON_NAME)
if(DEFINED ENV{AZURE_CODESIGN_PROFILE_NAME})
add_custom_command(TARGET openttd
POST_BUILD
COMMAND "${CMAKE_SOURCE_DIR}/os/windows/sign.bat" "$<TARGET_FILE:openttd>" "${WINDOWS_CERTIFICATE_COMMON_NAME}"
COMMAND "${CMAKE_SOURCE_DIR}/os/windows/sign.bat" "${BINARY_DESTINATION_DIR}"
)
endif()
elseif(UNIX)

@ -57,16 +57,10 @@ function(set_options)
option(OPTION_DEDICATED "Build dedicated server only (no GUI)" OFF)
option(OPTION_INSTALL_FHS "Install with Filesystem Hierarchy Standard folders" ${DEFAULT_OPTION_INSTALL_FHS})
option(OPTION_USE_ASSERTS "Use assertions; leave enabled for nightlies, betas, and RCs" ON)
if(EMSCRIPTEN)
# Although pthreads is supported, it is not in a way yet that is
# useful for us.
option(OPTION_USE_THREADS "Use threads" OFF)
else()
option(OPTION_USE_THREADS "Use threads" ON)
endif()
option(OPTION_USE_NSIS "Use NSIS to create windows installer; enable only for stable releases" OFF)
option(OPTION_TOOLS_ONLY "Build only tools target" OFF)
option(OPTION_DOCS_ONLY "Build only docs target" OFF)
option(OPTION_ALLOW_INVALID_SIGNATURE "Allow loading of content with invalid signatures" OFF)
if (OPTION_DOCS_ONLY)
set(OPTION_TOOLS_ONLY ON PARENT_SCOPE)
@ -84,7 +78,6 @@ function(show_options)
message(STATUS "Option Dedicated - ${OPTION_DEDICATED}")
message(STATUS "Option Install FHS - ${OPTION_INSTALL_FHS}")
message(STATUS "Option Use assert - ${OPTION_USE_ASSERTS}")
message(STATUS "Option Use threads - ${OPTION_USE_THREADS}")
message(STATUS "Option Use NSIS - ${OPTION_USE_NSIS}")
if(OPTION_SURVEY_KEY)
@ -92,6 +85,11 @@ function(show_options)
else()
message(STATUS "Option Survey Key - NOT USED")
endif()
if(OPTION_ALLOW_INVALID_SIGNATURE)
message(STATUS "Option Allow Invalid Signature - USED")
message(WARNING "Ignoring invalid signatures is a security risk! Use with care!")
endif()
endfunction()
# Add the definitions for the options that are selected.
@ -103,10 +101,6 @@ function(add_definitions_based_on_options)
add_definitions(-DDEDICATED)
endif()
if(NOT OPTION_USE_THREADS)
add_definitions(-DNO_THREADS)
endif()
if(OPTION_USE_ASSERTS)
add_definitions(-DWITH_ASSERT)
else()
@ -116,4 +110,8 @@ function(add_definitions_based_on_options)
if(OPTION_SURVEY_KEY)
add_definitions(-DSURVEY_KEY="${OPTION_SURVEY_KEY}")
endif()
if(OPTION_ALLOW_INVALID_SIGNATURE)
add_definitions(-DALLOW_INVALID_SIGNATURE)
endif()
endfunction()

@ -49,7 +49,8 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
string(SUBSTRING "${FULLHASH}" 0 10 SHORTHASH)
# Get the last commit date
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" show -s --pretty=format:%ci HEAD
set(ENV{TZ} "UTC0")
execute_process(COMMAND ${GIT_EXECUTABLE} -C "${CMAKE_SOURCE_DIR}" show -s --date=iso-local --pretty=format:%cd HEAD
OUTPUT_VARIABLE COMMITDATE
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}

@ -56,11 +56,14 @@ foreach(ENUM IN LISTS ENUM_LINES)
endif()
# Check for enum match
if("${LINE}" MATCHES "^ *enum *${ENUM_PATTERN} *\{")
if("${LINE}" MATCHES "^ *enum *${ENUM_PATTERN}( *: *[^ ]*)? *\{")
# REGEX REPLACE does a REGEX MATCHALL and fails if an empty string is matched
string(REGEX MATCH "[^ ]*" RESULT "${LINE}")
string(REPLACE "${RESULT}" "" RM_INDENT "${LINE}")
string(REGEX MATCH " *: *[^ ]*" RESULT "${LINE}")
string(REPLACE "${RESULT}" "" LINE "${LINE}")
set(ACTIVE 1)
if(ACTIVE_COMMENT GREATER 0)
string(APPEND ${PLACE_HOLDER} "\n${COMMENT}")

@ -34,7 +34,6 @@ execute_process(COMMAND ${OPENTTD_EXECUTABLE}
-mnull
-vnull:ticks=30000
-d script=2
-d misc=9
-Q
OUTPUT_VARIABLE REGRESSION_OUTPUT
ERROR_VARIABLE REGRESSION_RESULT
@ -58,16 +57,23 @@ string(REPLACE "0x0x0" "0x00000000" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\\" "/" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Remove timestamps if any
string(REGEX REPLACE "\[[0-9-]+ [0-9:]+\] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REGEX REPLACE "\\\[[0-9-]+ [0-9:]+\\\] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Remove log level
string(REGEX REPLACE "\\\[script:[0-9]\\\]" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Convert the output to a format that is expected (and more readable) by result.txt
string(REPLACE "\ndbg: [script]" "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\n " "\nERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\nERROR: [1] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\n[P] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\n[S] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "dbg: " "ERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "ERROR: [1] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "[P] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "[S] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REGEX REPLACE "dbg: ([^\n]*)\n?" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Remove duplicate script info
string(REGEX REPLACE "ERROR: Registering([^\n]*)\n?" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REGEX REPLACE "ERROR: [12]([^\n]*)\n?" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REGEX REPLACE "ERROR: The first([^\n]*)\n?" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Read the expected result
file(READ ai/${REGRESSION_TEST}/result.txt REGRESSION_EXPECTED)
@ -91,7 +97,7 @@ foreach(RESULT IN LISTS REGRESSION_RESULT)
if(NOT RESULT STREQUAL EXPECTED)
message("${ARGC}: - ${EXPECTED}")
message("${ARGC}: + ${RESULT}'")
message("${ARGC}: + ${RESULT}")
set(ERROR YES)
endif()
endforeach()

@ -1062,7 +1062,7 @@
<li style="color: blue">m8 bits 14..12: <a href="#RoadCachedOneWayState">Road cached one way state</a></li>
<li>m8 bits 11..6: <a href="#TramType">Tramtype</a></li>
<li>m8 bits 5..0: <a href="#TrackType">track type</a> for railway stations/waypoints</li>
<li style="color: blue">m8 bits 5..0: custom road stop id; 0 means standard graphics</li>
<li>m8 bits 5..0: custom road stop id; 0 means standard graphics</li>
</ul>
</td>
</tr>

@ -209,12 +209,12 @@ the array so you can quickly see what is used and what is not.
<td class="bits" rowspan=2><span class="usable" title="Graphics index">OOOO O</span><span class="used" title="Graphics index: 00 (exit towards NE), 01 (exit towards SE), 02 (exit towards SW), 03 (exit towards NW), 04 (drive through X), 05 (drive through Y)">XXX</span></td>
<td class="bits" rowspan=6><span class="free">O<span class="patch" title="Station type (extra bit)">P</span></span><span class="used" title="Station type">XXX</span> <span class="free">OOO</span></td>
<td class="bits" rowspan=2><span class="free">OOO</span><span class="used" title="Owner of road">X XXXX</span></td>
<td class="bits"><span class="free">O</span><span class="patch" title="Road cached one way state">PPP</span> <span class="used" title="Tram type">XXXX XX</span><span class="patch" title="Custom road stops specifications ID">PP PPPP</span></td>
<td class="bits"><span class="free">O</span><span class="patch" title="Road cached one way state">PPP</span> <span class="used" title="Tram type">XXXX XX</span> <span class="used" title="Custom road stops specifications ID">XXXXXX</span></td>
</tr>
<tr>
<td class="caption">road waypoint</td>
<td class="bits"><span class="used" title="Owner of tram">XXXX</span> <span class="patch" title="Pavement type">PP</span> <span class="patch" title="Disallow vehicles to go a specific direction (drive-through road stop)">PP</span></td>
<td class="bits"><span class="patch" title="Snow/desert present">P</span> <span class="patch" title="Road cached one way state">PPP</span> <span class="used" title="Tram type">XXXX XX</span><span class="patch" title="Custom road stops specifications ID">PP PPPP</span></td>
<td class="bits"><span class="patch" title="Snow/desert present">P</span> <span class="patch" title="Road cached one way state">PPP</span> <span class="used" title="Tram type">XXXX XX</span> <span class="used" title="Custom road stops specifications ID">XXXXXX</span></td>
</tr>
<tr>
<td class="caption">airport</td>

@ -83,6 +83,8 @@
The default graphics chain for the primary vehicle may check the cargo states of the other ship parts if required.<br />
Additional ship parts may be refitted individually.
<p>This requires the <span class="code">multi_part_ships</span> feature.</p>
<p>From version 3 of the <span class="code">multi_part_ships</span> feature, spritegroup loading/loaded cargo thresholds refer to the entire ship, not just the first vehicle.</p>
</p>
<p>
Added callback: <span class="code">refit_part_name</span><br />
@ -302,7 +304,7 @@
<tr><td>use_land_ground</td><td>0 or 1</td><td>
Sets whether to use the underlying ground as the object ground sprite, ignoring the ground sprite provided in the sprite layout.<br />
When enabled, the ground sprite will be bare ground, grass, snow, desert, etc. as if it were a clear ground tile.<br />
In edge foundation mode, the ground may be coast/shore when flooded.
In edge foundation mode, or when foundations are disabled, the ground may be coast/shore when flooded.
</td></tr>
<tr><td>edge_foundation_mode</td><td>[mode0, mode1, mode2, mode3]</td><td>
Enables edge foundation mode for the object.<br />
@ -673,6 +675,13 @@ item (FEAT_GLOBALVARS) {
Set whether signals should be drawn on the opposite side of the track for the most recently defined style (defined using the <span class="code">define_style</span> property).
</td>
</tr>
<tr><td>style_both_sides</td><td>0 or 1</td>
<td>
Set whether signals should be drawn on both sides of the track for the most recently defined style (defined using the <span class="code">define_style</span> property).<br />
If set, the <span class="code">signal_context_is_second</span> variable is true when drawing the second signal.<br />
If this and <span class="code">style_opposite_side</span> are both set, the first signal is drawn on the opposite side and the second signal is drawn on the usual side.
</td>
</tr>
<tr><td>style_realistic_braking_only</td><td>0 or 1</td>
<td>
Set whether signals using this style may only be built when realistic braking is enabled, for the most recently defined style (defined using the <span class="code">define_style</span> property).
@ -722,6 +731,11 @@ item (FEAT_GLOBALVARS) {
The signal is being drawn on a tunnel entrance/exit (not a bridge)
</td>
</tr>
<tr><td>signal_context_is_second</td><td>0 or 1</td>
<td>
The second signal is being drawn (on the opposite side to the first signal), see the style_both_sides property
</td>
</tr>
<tr><td>signal_context_info</td><td></td>
<td>
Above signal context variables in one variable (all of the signals_signal_context variable)

@ -554,6 +554,16 @@
The Action 0 Id field is not used, the value is ignored.
</p>
<p>This is indicated by the feature name: <font face="monospace">action0_signals_style</font>, version 1</p>
<h4 id="signals_style_both_sides">Set custom signal style signal drawn on both sides (mappable property: signals_style_both_sides)</h4>
<p>This applies to the most recent custom signal style defined using the <a href="#signals_define_style">signals_define_style</a> property.<br />
When enabled, signals using this style are drawn on both sides of the track.<br />
Bit 9 of <a href="#signals_signal_context">signals_signal_context</a> is set when drawing the second signal on the opposite side.</p>
<p>If this and <a href="#signals_style_opposite_side">signals_style_opposite_side</a> are both set, the first signal is drawn on the opposite side
and the second signal is drawn on the usual side.</p>
<p>The property length is 1 byte. 0 is disabled (default). 1 is enabled.<br />
The Action 0 Id field is not used, the value is ignored.
</p>
<p>This is indicated by the feature name: <font face="monospace">action0_signals_style</font>, version 3</p>
<h4 id="signals_style_realistic_braking_only">Set custom signal style signal requires realistic braking (mappable property: signals_style_realistic_braking_only)</h4>
<p>This applies to the most recent custom signal style defined using the <a href="#signals_define_style">signals_define_style</a> property.<br />
When enabled, signals using this style may only be built when realistic braking is enabled.</p>
@ -573,7 +583,7 @@
<h4 id="object_use_land_ground">Object uses land ground sprite (mappable property: object_use_land_ground)</h4>
<p>This property sets whether to use the underlying ground as the object ground sprite, ignoring the ground sprite provided in the sprite layout.<br />
When enabled, the ground sprite will be bare ground, grass, snow, desert, etc. as if it were a clear ground tile.<br />
In edge foundation mode, the ground may be coast/shore when flooded.<br />
In edge foundation mode, or when foundations are disabled, the ground may be coast/shore when flooded.<br />
The property length is 1 byte. 0 is disabled (default). 1 is enabled.</p>
<p>This is indicated by the feature name: <font face="monospace">action0_object_use_land_ground</font>, version 1</p>
<h4 id="object_edge_foundation_mode">Enable object edge foundation mode (mappable property: object_edge_foundation_mode)</h4>
@ -929,6 +939,7 @@
</table>
</td></tr>
<tr><td>8</td><td>Tunnel tile</td></tr>
<tr><td>9</td><td>Second signal (being drawn on opposite side), see: <a href="#signals_style_both_sides">signals_style_both_sides</a></td></tr>
</table>
</p>
<p>This is indicated by the feature name: <font face="monospace">varaction2_signals_signal_context</font>, version 1</p>
@ -975,6 +986,7 @@
Additional ship parts may be refitted individually.
</p>
<p>This is indicated by the feature name: <font face="monospace">multi_part_ships</font>, version 1</p>
<p>From version 3 of the <font face="monospace">multi_part_ships</font> feature, Action 2 loadtypes/loadingtypes cargo thresholds refer to the entire ship, not just the first vehicle.</p>
<p><b>Callback EC008002 - Ship part name for refit window</b><br />
This callback is called on the primary vehicle to get the name of each part of the ship (e.g. the name of each cargo hold) in the refit window.<br />
This is not called for ships of only one part.<br />

@ -129,8 +129,8 @@
<tr><td>stop_type</td><td>RST_TYPE_XXX</td><td>XXX = BUS | TRUCK | WAYPOINT (<b>Not in standard specification</b>)</td></tr>
<tr><td>terrain_type</td><td>TILETYPE_XXX</td><td>XXX = NORMAL | DESERT | RAIN_FOREST | SNOW</td></tr>
<tr><td>tile_slope</td><td>SLOPE_XXX</td><td>See <a href="https://newgrf-specs.tt-wiki.net/wiki/NML:List_of_tile_slopes">tile slopes</a> for an overview of possible values</td></tr>
<tr><td>has_road</td><td>0 | 1</td><td>1 is this road stop has road</td></tr>
<tr><td>has_tram</td><td>0 | 1</td><td>1 is this road stop has tram</td></tr>
<tr><td>has_road</td><td>0 | 1</td><td>1 if this road stop has road</td></tr>
<tr><td>has_tram</td><td>0 | 1</td><td>1 if this road stop has tram</td></tr>
<tr><td>road_type</td><td>road type | 0xFF</td><td>Road type. If there is no road the value will be 0xFF. If the roadtype has no entry in the roadtype translation table of the GRF, this value will be 0xFF. If no translation table is present, the raw value will be returned.</td></tr>
<tr><td>tram_type</td><td>tram type | 0xFF</td><td>Tram type. If there is no tram the value will be 0xFF. If the tramtype has no entry in the tramtype translation table of the GRF, this value will be 0xFF. If no translation table is present, the raw value will be returned.</td></tr>
<tr><td>town_manhattan_dist</td><td></td><td>Manhattan distance to the associated town</td></tr>
@ -142,7 +142,6 @@
<tr><td>company_colour2</td><td>COLOUR_XXX</td><td></td></tr>
<tr><td>animation_frame</td><td>0..255</td><td>Animation frame of the current tile</td></tr>
<tr><td>waiting_triggers</td><td>0..255</td><td>Waiting triggers</td></tr>
<tr><td>random_bits</td><td>0..16777215</td><td>All random bits</td></tr>
<tr><td>random_bits_tile</td><td>0..255</td><td>Random bits (per tile), see also <a href="https://newgrf-specs.tt-wiki.net/wiki/NML:Stations#Base_station_variables">random_bits_station</a></td></tr>
<tr><td>one_way_info<br /><b>Not in standard specification</b></td><td>RST_OWI_XXX</td><td>One-way road information of drive-through stop tile<br />XXX = TWO_WAY | WEST_BOUND | EAST_BOUND | NO_ENTRY</td></tr>
<tr><td>one_way_info_inferred<br /><b>Not in standard specification</b></td><td>RST_OWI_XXX</td><td>Inferred one-way road information of drive-through stop tile<br />XXX = TWO_WAY | WEST_BOUND | EAST_BOUND | NO_ENTRY</td></tr>

@ -248,7 +248,7 @@
<tr><td></td><td><a href="#roadstop_road_stop_info_nearby_tiles_v2">roadstop_road_stop_info_nearby_tiles_v2</a></td><td>Road stop info of nearby tiles (v2)</td><td>Not in spec</td></tr>
<tr><td><a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/BaseStation">69</a></td><td></td><td>Information about cargo accepted in the past (BaseStation)</td><td></td></tr>
<tr><td><a href="#roadstop_road_stop_grfid_nearby_tiles">6A</a></td><td><a href="#roadstop_road_stop_grfid_nearby_tiles">roadstop_road_stop_grfid_nearby_tiles</a></td><td>GRFID of nearby road stop tiles</td><td></td></tr>
<tr><td><a href="#roadstop_road_info_nearby_tiles">6B</a></td><td><a href="#roadstop_road_info_nearby_tiles">roadstop_road_info_nearby_tiles</a></td><td>Road info of nearby plain road tiles</td><td>Not in spec</td></tr>
<tr><td></td><td><a href="#roadstop_road_info_nearby_tiles">roadstop_road_info_nearby_tiles</a></td><td>Road info of nearby plain road tiles</td><td>Not in spec</td></tr>
</table>
<h4 id="roadstop_view">Road stop view/rotation (40, or mappable variable: roadstop_view)</h4>
@ -431,7 +431,7 @@
<h4 id="roadstop_road_stop_grfid_nearby_tiles">GRFID of nearby road stop tile (6A, or mappable variable: roadstop_road_stop_grfid_nearby_tiles)</h4>
<p>This has the same value as <a href="https://newgrf-specs.tt-wiki.net/wiki/VariationalAction2/Stations#GRFID_of_nearby_station_tile_.286A.29">station (feature 4) variable 6A</a>.</p>
<h4 id="roadstop_road_info_nearby_tiles">Road info of nearby plain road tiles (6B, or mappable variable: roadstop_road_info_nearby_tiles)</h4>
<h4 id="roadstop_road_info_nearby_tiles">Road info of nearby plain road tiles (mappable variable: roadstop_road_info_nearby_tiles)</h4>
The returned value is 0xFFFFFFFF if the selected tile isn't a plain road tile.<br /><br />

@ -74,7 +74,7 @@
<ul>
<li>The number of houses in the town changes</li>
<li>When the game is loaded</li>
<li>When settings, NewGRFs or other relavant game configuration is changed</li>
<li>When settings, NewGRFs or other relevant game configuration is changed</li>
</ul>
</p>

@ -105,7 +105,7 @@
<ul>
<li>The number of houses in the town changes</li>
<li>When the game is loaded</li>
<li>When settings, NewGRFs or other relavant game configuration is changed</li>
<li>When settings, NewGRFs or other relevant game configuration is changed</li>
</ul>
</p>

@ -13,7 +13,7 @@
.Op Fl c Ar config_file
.Op Fl d Op Ar level | Ar cat Ns = Ns Ar lvl Ns Op , Ns Ar ...
.Op Fl D Oo Ar host Oc Ns Op : Ns Ar port
.Op Fl g Op Ar savegame
.Op Fl g Op Ar file
.Op Fl G Ar seed
.Op Fl I Ar graphicsset
.Op Fl m Ar driver
@ -62,11 +62,11 @@ Start in world editor mode.
.It Fl f
Fork into background (dedicated server only, see
.Fl D ) .
.It Fl g Op Ar savegame
.It Fl g Op Ar file
Load
.Ar savegame
at start or start a new game if omitted.
.Ar savegame
.Ar file
(can be either a savegame, scenario, or heightmap) at start or start a new game if omitted.
.Ar file
must be either an absolute path or one relative to the current path or one of
the search paths.
.It Fl G Ar seed

@ -19,7 +19,7 @@ Now simply open up the `crash.dmp`, and start debugging.
The best tool to use is `minidump-stackwalk` as published in the Rust's cargo index:
```bash
cargo install minidump-stackwalk
cargo install --locked minidump-stackwalk
```
For how to install Rust, please see [here](https://doc.rust-lang.org/cargo/getting-started/installation.html).

@ -2,7 +2,141 @@
* * *
### v0.57.0 (2023-01-30)
### v0.59.1 (2024-05-20)
* Fix crash when sorting by capacity in autoreplace window.
* Fix non-percentage servicing interval when using wallclock mode.
* Fix road vehicles skipping orders when using implicit orders.
* Fix setting default value for industry cargo scaling mode when loading old savegames.
* Fix setting display for industry cargo scaling.
* Fix crash which could occur when using autorenew/autoreplace wagon removal with leading engines longer than the train length limit.
* Fix crash which could occur with loading certain GRFs.
* Fix multiplayer desync when joining a server after previously loading a scenario.
* Fix keyboard input issues on Linux/SDL.
* Realistic braking:
* Fix accuracy issues with realistic acceleration and braking when a train is underpowered for ascending or descending a steep slope.
* Reduce sensitivity of train brakes overheated breakdown.
* Add setting to shorten vehicle view status text.
* Bump trunk base from commit bd7120bae41b6e7ac86c664c8220b59cd57242bb to commit 88cf99017a26f887230d2c14d057a97bbf077f7c.
### v0.59.0 (2024-05-05)
* Fix loading recent vanilla savegame versions resulting in incorrect industry cargoes.
* Fix incorrect station catchment/acceptance which could occur when an oil rig/water industry completed construction, which could cause multiplayer desyncs.
* Fix AI construction of block signals when using realistic braking.
* Fix incorrect train weights being used for calculating infrastructure sharing track fees.
* Fix vehicles leaving dots behind in viewport map mode in some cases.
* Fix NewGRF train motion animations for some NewGRFs which use articulated engines.
* Fix template-based train replacement not triggering replacements for companies nominally in debt when using the infinite money setting.
* Fix text filters in dual-pane train purchase window when using NewGRFs with variable vehicle names.
* Road vehicles no longer remaining loading when the next order is for the same station if the next order has a different required direction.
* Enable the cargo capacity/running cost sort mode in the dual pane train purchase window.
* The vehicle capacity sort modes in the build vehicle windows now take into account the selected refit cargo.
* Timekeeping:
* The day length factor setting is now enabled in wallclock timekeeping mode. This scales the economy speed, but not the calendar speed.
* Fix timing of engine preview offers in wallclock timekeeping mode.
* Scheduled dispatch:
* When using scheduled dispatch and timetable automation at the same time, vehicle lateness values are no longer reset when congestion is detected.
* The number of vehicles required text is now clarified to be an estimate.
* Further increase effect size of cargo dist effect of distance on demand setting for values greater than 100%.
* Further reduce the possibility of stuttering when playing sound effects on Windows.
* Bump trunk base from commit 3e625b5b1a81b00f774ca87b48d3e4f4e9d014c3 to commit bd7120bae41b6e7ac86c664c8220b59cd57242bb.
### v0.58.3 (2024-04-10)
* Fix stuttering when playing sound effects on Windows.
* Fix incorrect cargo payment calculations for cargo in the mail compartment of aircraft and in non-first parts of multi-part ships.
* Fix path-only signal cycle mode being ignored when using realistic braking.
* Template-based train replacement:
* Fix replacement failing when using NewGRFs with complex wagon attachment and/or start/stop restrictions.
* Fix incorrect cost estimation when using NewGRFs with complex start/stop restrictions.
* Wallclock timekeeping mode:
* Fix game units (tiles/second) being shown as tiles/day.
* Fix time units shown for past production in the industry window.
* Fix cargo dist effect of distance on demand setting for values greater than 100%. (The scaling/demand allocation algorithm has been adjusted in general).
* Fix velocity units used in cargo payments graph x-axis label.
* Fix click/tooltip alignment of cargo lines in the industry chains window.
* Fix changing sprite alignments in the sprite aligner window not being applied as expected.
### v0.58.2 (2024-03-28)
* Fix crash with some GRFs when the maximum sprite resolution setting was set to 2x.
* Fix crash which could occur when clearing a crashed road vehicle from a drive-through road stop.
* Fix crash when the autosave uses real time setting and the autosave interval were both disabled.
* Fix crash which could occur after removing road from a one-way road/tram road stop.
* Fix drawing of black text in some drop-down menus.
* Fix incorrect handling of invalid or empty dispatch schedules in the departure board window.
* Fix handling of missing last or next scheduled dispatch times.
* Fix changes to the title game zoom level when changing the UI scale setting.
* Fix vehicles leaving dots behind in viewport map mode in some cases.
* Fix incorrect sprites being shown for some GRFs.
* Fix crash in the engine preview window with certain GRFs.
* Fix road vehicles not remaining loading as expected when the next order is for the same station.
* Fix train unit numbers being incorrectly marked as in use after an autoreplace operation.
* Allow manually removing/setting train speed restrictions from the vehicle details window.
* Allow removing a vehicle from slots owned by the current company from the vehicle details window.
* Show viewport route step markers for go via station orders using a different tag.
* Add setting to show purchased land using clear tile ground sprites (dirt, grass, snow, desert, etc).
* Add ctrl-click scroll-to for stations referenced by conditional orders.
* Allow industry monthly production and transported totals to be greater than 64k.
* Allow engine reliability increases but not decreases after the no vehicles expire after year setting is reached.
* Remove setting to disable script parameter randomisation, because the feature has been removed.
* Fix signature validation for social/presence plugins.
* Bump trunk base from commit a602845d0a35331f1e012cd13ca921c6bc42b58d to commit 3e625b5b1a81b00f774ca87b48d3e4f4e9d014c3.
### v0.58.1 (2024-03-02)
* Fix multiplayer desync after joining a server with the flood from edges setting enabled.
* Fix timetabled waiting in depots.
* Fix incorrect accounting of company quarterly statistics.
* Fix trains failing to load at stations in some cases after leaving a conditional order loading loop at the previous station.
* Fix the company infrastructure window not being drawn as a company window and not being removed on company deletion.
* Fix main viewport crash or only partial redraw when changing the UI scale using the slider.
* Fix display of ships entering viewports on an aqueduct.
* Allow adding plans in the scenario editor.
* Add setting for whether to show vehicle running costs per calendar year.
* Add setting for whether to show speed before destination in vehicle status bar.
* Add setting to disable script parameter randomisation.
* Add "path signals only" mode to the signal cycle setting.
* Adjust display of period numbers in wallclock time-keeping mode.
* Stop engine reliability decay once the no vehicles expire after year setting is reached, instead of when the no vehicles expire and introduced after year settings are both reached.
* Add NewGRF custom signal style flag to draw signal sprites on both sides.
* Bump trunk base from commit 8bccb5805a94eb2acb0e581185ca34090f2b1397 to commit a602845d0a35331f1e012cd13ca921c6bc42b58d.
### v0.58.0 (2024-02-24)
* Fix crash when road vehicles change length in drive-through road stops (e.g. due to refits).
* Fix crash when showing the savegame file overwrite warning for a save with no readable version.
* Fix crash when joining a network server which used GRF custom town zones.
* Fix road vehicles being deleted in a bay road stop leaving the stop marked as occupied.
* Fix handling of airport noise/count limits in local authority permissive mode.
* Fix rail toolbar layout when polyrail button is hidden.
* Fix multi-cargo ship capacity display in the autoreplace and available ships windows.
* Fix displayed speed units in station rating tooltip.
* Fix warning messages when loading very old savegames.
* Fix crash which could occur on Windows when closing the game by closing its attached debug console.
* Fix clicking vehicle window drop-down menus hiding vehicle overlay lines/markers.
* Time-keeping:
* Add support for vanilla wallclock mode.
* No longer scale displayed running costs by the day length factor, show per original year.
* Fix news message durations being scaled by the day length factor.
* Add support for vanilla unbunching.
* Add setting to only spawn primary industries.
* Reduce flickering/sprite sorting problems for vehicles and catenary diagonally underneath bridges.
* Add road vehicle stop direction to the order window manage order dropdown.
* Disable company-only zoning overlay modes in spectator mode.
* Increase pathfinding limit for river generation.
* Bump trunk base from commit 6b21368bc2fdef6877ef5930f94e85719b670a76 to commit 8bccb5805a94eb2acb0e581185ca34090f2b1397.
### v0.57.1 (2024-02-04)
* Fix crashes or rendering problems which could occur in some cases when multiple viewports were active.
* Fix not being able to change both the hour and minute in the non-text timetable time dialog.
* Fix the picker tool not selecting the specific station/waypoint in a class, in the rail station, road stop and waypoint windows.
* Fix secondary colour vehicle-type default liveries not being updated when changing the company default.
* Fix vehicles leaving pixels behind on the viewport when zoomed out and moving left in some cases.
* Prevent dragging plan lines across viewports, as this causes erratic plans.
* Routing restrictions:
* Fix slot acquire on PBS reservation end on tunnel/bridge entrance signals.
* Wait at PBS signal on signals in the middle of a reservation is now only applied when reserving through the signal in the forward direction (not backwards PBS).
* Multi-cargo ships:
* Fix build and refit with multi-cargo ships only refitting the first part.
* Fix sort by total cargo in build ship window only considering the first part.
### v0.57.0 (2024-01-30)
* Fix crashes which could occur with some NewGRFs.
* Fix crash which could occur when trying to extend an invalidated reservation when using realistic braking.
* Fix crash when updating the timetable of a late train when the total timetable duration is 0.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -3,4 +3,4 @@
The OpenTTD TrueType font was created by Zephyris and is maintained on [Github](https://github.com/zephyris/openttd-ttf).
It is licensed under GPL-2.0.
The currently included files correspond to release v0.4.
The currently included files correspond to release v0.6.

@ -1,18 +1,2 @@
@echo off
REM Signing script
REM Arguments: sign.bat exe_to_sign certificate_subject_name
REM This is a loose wrapper around the Microsoft signtool application (included in the Windows SDK).
REM See https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe for more details.
REM Path to signtool.exe
IF NOT DEFINED SIGNTOOL_PATH (SET SIGNTOOL_PATH=signtool)
REM URL of the timestamp server
IF NOT DEFINED SIGNTOOL_TIMESTAMP_URL (SET SIGNTOOL_TIMESTAMP_URL=http://timestamp.digicert.com)
REM Sign with SHA-1 for Windows 7 and below
"%SIGNTOOL_PATH%" sign -v -n %2 -t %SIGNTOOL_TIMESTAMP_URL% -fd sha1 %1
REM Sign with SHA-256 for Windows 8 and above
"%SIGNTOOL_PATH%" sign -v -n %2 -tr %SIGNTOOL_TIMESTAMP_URL% -fd sha256 -td sha256 -as %1
pwsh -File "%~dp0sign_azure.ps1" %1

@ -0,0 +1,40 @@
# Signing script for Azure Code Signing
# Arguments: sign_azure.ps1 path_to_sign
#
# Environment variables must be set up before use:
#
# AZURE_TENANT_ID
# AZURE_CLIENT_ID
# AZURE_CLIENT_SECRET
# AZURE_CODESIGN_ACCOUNT_NAME
# AZURE_CODESIGN_ENDPOINT
# AZURE_CODESIGN_PROFILE_NAME
Param
(
# Files folder
[Parameter(Mandatory=$true, Position=0)]
$FilesFolder
)
if (!$Env:AZURE_CODESIGN_ENDPOINT -or !$Env:AZURE_CODESIGN_ACCOUNT_NAME -or !$Env:AZURE_CODESIGN_PROFILE_NAME -or
!$Env:AZURE_TENANT_ID -or !$Env:AZURE_CLIENT_ID -or !$Env:AZURE_CLIENT_SECRET)
{
"Code signing variables not found; most likely running in a fork. Skipping signing."
exit
}
Install-Module -Name AzureCodeSigning -Scope CurrentUser -RequiredVersion 0.3.0 -Force -Repository PSGallery
$params = @{}
$params["Endpoint"] = $Env:AZURE_CODESIGN_ENDPOINT
$params["CodeSigningAccountName"] = $Env:AZURE_CODESIGN_ACCOUNT_NAME
$params["CertificateProfileName"] = $Env:AZURE_CODESIGN_PROFILE_NAME
$params["FilesFolder"] = $FilesFolder
$params["FilesFolderFilter"] = "exe"
$params["FileDigest"] = "SHA256"
$params["TimestampRfc3161"] = "http://timestamp.acs.microsoft.com"
$params["TimestampDigest"] = "SHA256"
Invoke-AzureCodeSigning @params

@ -4,6 +4,7 @@ language = english.lng
[gui]
autosave = off
show_date_in_logs = true
[game_creation]
town_name = english

@ -4,7 +4,7 @@ class Regression extends AIInfo {
function GetShortName() { return "REGR"; }
function GetDescription() { return "This runs regression-tests on some commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
function GetAPIVersion() { return "14"; }
function GetAPIVersion() { return "15"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "Regression"; }
function UseAsRandomAI() { return false; }

@ -220,6 +220,7 @@ function Regression::Airport()
print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
print(" GetAirportNumHelipads(" + i + "): " + AIAirport.GetAirportNumHelipads(i));
}
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
@ -1107,6 +1108,7 @@ function Regression::Rail()
print(" IsRailTile(): " + AIRail.IsRailTile(33411));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(0, 1));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33411));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33414));
print(" BuildRailDepot(): " + AIRail.BuildRailDepot(33411, 33412));
print(" GetRailDepotFrontTile(): " + AIRail.GetRailDepotFrontTile(33411));
@ -1203,6 +1205,7 @@ function Regression::Road()
print(" IsRoadTile(): " + AIRoad.IsRoadTile(33411));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(0, 1));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33411));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33414));
print(" BuildRoadDepot(): " + AIRoad.BuildRoadDepot(33411, 33412));
print(" HasRoadType(Road): " + AIRoad.HasRoadType(33411, AIRoad.ROADTYPE_ROAD));
@ -1356,6 +1359,21 @@ function Regression::Station()
}
}
function Regression::StationList()
{
print("");
print("--StationList--");
local road_stations = AIStationList(AIStation.STATION_TRUCK_STOP);
for (local st = road_stations.Begin(); !road_stations.IsEnd(); st = road_stations.Next()) {
print(" GetName(): " + AIStation.GetName(st));
print(" TileList_StationCoverage:");
local coverage = AITileList_StationCoverage(st);
for (local i = coverage.Begin(); !coverage.IsEnd(); i = coverage.Next()) {
print(" " + i);
}
}
}
function Regression::Tile()
{
print("");
@ -1987,6 +2005,7 @@ function Regression::Start()
this.Road();
this.Sign();
this.Station();
this.StationList();
this.Tile();
this.TileList();
this.Town();

@ -805,56 +805,67 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetAirportWidth(-1): -1
GetAirportHeight(-1): -1
GetAirportCoverageRadius(-1): -1
GetAirportNumHelipads(-1): -1
IsAirportInformationAvailable(0): true
IsValidAirportType(0): true
GetAirportWidth(0): 4
GetAirportHeight(0): 3
GetAirportCoverageRadius(0): 4
GetAirportNumHelipads(0): 0
IsAirportInformationAvailable(1): true
IsValidAirportType(1): false
GetAirportWidth(1): 6
GetAirportHeight(1): 6
GetAirportCoverageRadius(1): 5
GetAirportNumHelipads(1): 0
IsAirportInformationAvailable(2): true
IsValidAirportType(2): false
GetAirportWidth(2): 1
GetAirportHeight(2): 1
GetAirportCoverageRadius(2): 4
GetAirportNumHelipads(2): 1
IsAirportInformationAvailable(3): true
IsValidAirportType(3): false
GetAirportWidth(3): 6
GetAirportHeight(3): 6
GetAirportCoverageRadius(3): 6
GetAirportNumHelipads(3): 0
IsAirportInformationAvailable(4): true
IsValidAirportType(4): false
GetAirportWidth(4): 7
GetAirportHeight(4): 7
GetAirportCoverageRadius(4): 8
GetAirportNumHelipads(4): 2
IsAirportInformationAvailable(5): true
IsValidAirportType(5): false
GetAirportWidth(5): 5
GetAirportHeight(5): 4
GetAirportCoverageRadius(5): 4
GetAirportNumHelipads(5): 2
IsAirportInformationAvailable(6): true
IsValidAirportType(6): false
GetAirportWidth(6): 2
GetAirportHeight(6): 2
GetAirportCoverageRadius(6): 4
GetAirportNumHelipads(6): 1
IsAirportInformationAvailable(7): true
IsValidAirportType(7): false
GetAirportWidth(7): 9
GetAirportHeight(7): 11
GetAirportCoverageRadius(7): 10
GetAirportNumHelipads(7): 2
IsAirportInformationAvailable(8): true
IsValidAirportType(8): false
GetAirportWidth(8): 4
GetAirportHeight(8): 2
GetAirportCoverageRadius(8): 4
GetAirportNumHelipads(8): 3
IsAirportInformationAvailable(9): false
IsValidAirportType(9): false
GetAirportWidth(9): -1
GetAirportHeight(9): -1
GetAirportCoverageRadius(9): -1
GetAirportNumHelipads(9): -1
GetBankBalance(): 1999999790
GetPrice(): 5400
BuildAirport(): true
@ -7760,6 +7771,153 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetCargoPlannedFromVia(1000, 1000, 0, 1000): -1
GetCargoPlannedFromVia(1000, 1000, 1000, 1000): -1
--StationList--
GetName(): Little Frutford Valley
TileList_StationCoverage:
34192
34191
34190
34189
34188
34187
34186
33936
33935
33934
33933
33932
33931
33930
33680
33679
33678
33677
33676
33675
33674
33424
33423
33422
33421
33420
33419
33418
33168
33167
33166
33165
33164
33163
33162
32912
32911
32910
32909
32908
32907
32906
32656
32655
32654
32653
32652
32651
32650
GetName(): Little Frutford Woods
TileList_StationCoverage:
34439
34438
34437
34436
34435
34434
34433
34432
34187
34186
34185
34184
34183
34182
34181
34180
34179
34178
34177
34176
33931
33930
33929
33928
33927
33926
33925
33924
33923
33922
33921
33920
33675
33674
33673
33672
33671
33670
33669
33668
33667
33666
33665
33664
33419
33418
33417
33416
33415
33414
33413
33412
33411
33410
33409
33408
33163
33162
33161
33160
33159
33158
33157
33156
33155
33154
33153
33152
32907
32906
32905
32904
32903
32902
32901
32900
32899
32898
32897
32896
32651
32650
32649
32648
32647
32646
32645
32644
32643
32642
32641
32640
--Tile--
HasTreeOnTile(): false
IsFarmTile(): true
@ -9588,9 +9746,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
--Valuate() with excessive CPU usage--
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [unknown()] regression/main.nut line [2032]
*FUNCTION [unknown()] regression/main.nut line [2051]
*FUNCTION [Valuate()] NATIVE line [-1]
*FUNCTION [Start()] regression/main.nut line [2033]
*FUNCTION [Start()] regression/main.nut line [2052]
[id] 0
[this] TABLE
@ -9599,7 +9757,7 @@ Your script made an error: excessive CPU usage in valuator function
[this] INSTANCE
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [Start()] regression/main.nut line [2033]
*FUNCTION [Start()] regression/main.nut line [2052]
[Infinite] CLOSURE
[list] INSTANCE

@ -4,7 +4,7 @@ class StationList extends AIInfo {
function GetShortName() { return "REGS"; }
function GetDescription() { return "This runs stationlist-tests on some commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
function GetAPIVersion() { return "14"; }
function GetAPIVersion() { return "15"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "StationList"; }
function UseAsRandomAI() { return false; }

@ -2,12 +2,12 @@ add_subdirectory(catch2)
add_subdirectory(fmt)
add_subdirectory(icu)
add_subdirectory(md5)
add_subdirectory(monocypher)
add_subdirectory(squirrel)
add_subdirectory(nlohmann)
add_subdirectory(opengl)
add_subdirectory(openttd_social_integration_api)
add_subdirectory(cpp-btree)
add_subdirectory(monocypher)
add_subdirectory(randombytes)
add_subdirectory(robin_hood)
if (MINGW AND OPTION_MINGW_STDTHREADS)

@ -18,7 +18,7 @@
#include <ostream>
#include <type_traits>
#include "format.h"
#include "ostream.h" // formatbuf
FMT_BEGIN_NAMESPACE
@ -72,7 +72,8 @@ template <typename To, typename From,
FMT_ENABLE_IF(!std::is_same<From, To>::value &&
std::numeric_limits<From>::is_signed ==
std::numeric_limits<To>::is_signed)>
FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec)
-> To {
ec = 0;
using F = std::numeric_limits<From>;
using T = std::numeric_limits<To>;
@ -101,7 +102,8 @@ template <typename To, typename From,
FMT_ENABLE_IF(!std::is_same<From, To>::value &&
std::numeric_limits<From>::is_signed !=
std::numeric_limits<To>::is_signed)>
FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec)
-> To {
ec = 0;
using F = std::numeric_limits<From>;
using T = std::numeric_limits<To>;
@ -133,7 +135,8 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
template <typename To, typename From,
FMT_ENABLE_IF(std::is_same<From, To>::value)>
FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
FMT_CONSTEXPR auto lossless_integral_conversion(const From from, int& ec)
-> To {
ec = 0;
return from;
} // function
@ -154,7 +157,7 @@ FMT_CONSTEXPR To lossless_integral_conversion(const From from, int& ec) {
// clang-format on
template <typename To, typename From,
FMT_ENABLE_IF(!std::is_same<From, To>::value)>
FMT_CONSTEXPR To safe_float_conversion(const From from, int& ec) {
FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To {
ec = 0;
using T = std::numeric_limits<To>;
static_assert(std::is_floating_point<From>::value, "From must be floating");
@ -176,7 +179,7 @@ FMT_CONSTEXPR To safe_float_conversion(const From from, int& ec) {
template <typename To, typename From,
FMT_ENABLE_IF(std::is_same<From, To>::value)>
FMT_CONSTEXPR To safe_float_conversion(const From from, int& ec) {
FMT_CONSTEXPR auto safe_float_conversion(const From from, int& ec) -> To {
ec = 0;
static_assert(std::is_floating_point<From>::value, "From must be floating");
return from;
@ -188,8 +191,8 @@ FMT_CONSTEXPR To safe_float_conversion(const From from, int& ec) {
template <typename To, typename FromRep, typename FromPeriod,
FMT_ENABLE_IF(std::is_integral<FromRep>::value),
FMT_ENABLE_IF(std::is_integral<typename To::rep>::value)>
To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
int& ec) {
auto safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
int& ec) -> To {
using From = std::chrono::duration<FromRep, FromPeriod>;
ec = 0;
// the basic idea is that we need to convert from count() in the from type
@ -240,8 +243,8 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
template <typename To, typename FromRep, typename FromPeriod,
FMT_ENABLE_IF(std::is_floating_point<FromRep>::value),
FMT_ENABLE_IF(std::is_floating_point<typename To::rep>::value)>
To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
int& ec) {
auto safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
int& ec) -> To {
using From = std::chrono::duration<FromRep, FromPeriod>;
ec = 0;
if (std::isnan(from.count())) {
@ -321,12 +324,12 @@ To safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from,
namespace detail {
template <typename T = void> struct null {};
inline null<> localtime_r FMT_NOMACRO(...) { return null<>(); }
inline null<> localtime_s(...) { return null<>(); }
inline null<> gmtime_r(...) { return null<>(); }
inline null<> gmtime_s(...) { return null<>(); }
inline auto localtime_r FMT_NOMACRO(...) -> null<> { return null<>(); }
inline auto localtime_s(...) -> null<> { return null<>(); }
inline auto gmtime_r(...) -> null<> { return null<>(); }
inline auto gmtime_s(...) -> null<> { return null<>(); }
inline const std::locale& get_classic_locale() {
inline auto get_classic_locale() -> const std::locale& {
static const auto& locale = std::locale::classic();
return locale;
}
@ -336,8 +339,6 @@ template <typename CodeUnit> struct codecvt_result {
CodeUnit buf[max_size];
CodeUnit* end;
};
template <typename CodeUnit>
constexpr const size_t codecvt_result<CodeUnit>::max_size;
template <typename CodeUnit>
void write_codecvt(codecvt_result<CodeUnit>& out, string_view in_buf,
@ -377,8 +378,8 @@ auto write_encoded_tm_str(OutputIt out, string_view in, const std::locale& loc)
unit_t unit;
write_codecvt(unit, in, loc);
// In UTF-8 is used one to four one-byte code units.
unicode_to_utf8<code_unit, basic_memory_buffer<char, unit_t::max_size * 4>>
u;
auto u =
to_utf8<code_unit, basic_memory_buffer<char, unit_t::max_size * 4>>();
if (!u.convert({unit.buf, to_unsigned(unit.end - unit.buf)}))
FMT_THROW(format_error("failed to format time"));
return copy_str<char>(u.c_str(), u.c_str() + u.size(), out);
@ -408,8 +409,7 @@ inline void do_write(buffer<Char>& buf, const std::tm& time,
auto&& format_buf = formatbuf<std::basic_streambuf<Char>>(buf);
auto&& os = std::basic_ostream<Char>(&format_buf);
os.imbue(loc);
using iterator = std::ostreambuf_iterator<Char>;
const auto& facet = std::use_facet<std::time_put<Char, iterator>>(loc);
const auto& facet = std::use_facet<std::time_put<Char>>(loc);
auto end = facet.put(os, os, Char(' '), &time, format, modifier);
if (end.failed()) FMT_THROW(format_error("failed to format time"));
}
@ -432,6 +432,51 @@ auto write(OutputIt out, const std::tm& time, const std::locale& loc,
return write_encoded_tm_str(out, string_view(buf.data(), buf.size()), loc);
}
template <typename Rep1, typename Rep2>
struct is_same_arithmetic_type
: public std::integral_constant<bool,
(std::is_integral<Rep1>::value &&
std::is_integral<Rep2>::value) ||
(std::is_floating_point<Rep1>::value &&
std::is_floating_point<Rep2>::value)> {
};
template <
typename To, typename FromRep, typename FromPeriod,
FMT_ENABLE_IF(is_same_arithmetic_type<FromRep, typename To::rep>::value)>
auto fmt_duration_cast(std::chrono::duration<FromRep, FromPeriod> from) -> To {
#if FMT_SAFE_DURATION_CAST
// Throwing version of safe_duration_cast is only available for
// integer to integer or float to float casts.
int ec;
To to = safe_duration_cast::safe_duration_cast<To>(from, ec);
if (ec) FMT_THROW(format_error("cannot format duration"));
return to;
#else
// Standard duration cast, may overflow.
return std::chrono::duration_cast<To>(from);
#endif
}
template <
typename To, typename FromRep, typename FromPeriod,
FMT_ENABLE_IF(!is_same_arithmetic_type<FromRep, typename To::rep>::value)>
auto fmt_duration_cast(std::chrono::duration<FromRep, FromPeriod> from) -> To {
// Mixed integer <-> float cast is not supported by safe_duration_cast.
return std::chrono::duration_cast<To>(from);
}
template <typename Duration>
auto to_time_t(
std::chrono::time_point<std::chrono::system_clock, Duration> time_point)
-> std::time_t {
// Cannot use std::chrono::system_clock::to_time_t since this would first
// require a cast to std::chrono::system_clock::time_point, which could
// overflow.
return fmt_duration_cast<std::chrono::duration<std::time_t>>(
time_point.time_since_epoch())
.count();
}
} // namespace detail
FMT_BEGIN_EXPORT
@ -441,29 +486,29 @@ FMT_BEGIN_EXPORT
expressed in local time. Unlike ``std::localtime``, this function is
thread-safe on most platforms.
*/
inline std::tm localtime(std::time_t time) {
inline auto localtime(std::time_t time) -> std::tm {
struct dispatcher {
std::time_t time_;
std::tm tm_;
dispatcher(std::time_t t) : time_(t) {}
bool run() {
auto run() -> bool {
using namespace fmt::detail;
return handle(localtime_r(&time_, &tm_));
}
bool handle(std::tm* tm) { return tm != nullptr; }
auto handle(std::tm* tm) -> bool { return tm != nullptr; }
bool handle(detail::null<>) {
auto handle(detail::null<>) -> bool {
using namespace fmt::detail;
return fallback(localtime_s(&tm_, &time_));
}
bool fallback(int res) { return res == 0; }
auto fallback(int res) -> bool { return res == 0; }
#if !FMT_MSC_VERSION
bool fallback(detail::null<>) {
auto fallback(detail::null<>) -> bool {
using namespace fmt::detail;
std::tm* tm = std::localtime(&time_);
if (tm) tm_ = *tm;
@ -480,8 +525,8 @@ inline std::tm localtime(std::time_t time) {
#if FMT_USE_LOCAL_TIME
template <typename Duration>
inline auto localtime(std::chrono::local_time<Duration> time) -> std::tm {
return localtime(std::chrono::system_clock::to_time_t(
std::chrono::current_zone()->to_sys(time)));
return localtime(
detail::to_time_t(std::chrono::current_zone()->to_sys(time)));
}
#endif
@ -490,90 +535,49 @@ inline auto localtime(std::chrono::local_time<Duration> time) -> std::tm {
expressed in Coordinated Universal Time (UTC). Unlike ``std::gmtime``, this
function is thread-safe on most platforms.
*/
inline std::tm gmtime(std::time_t time) {
inline auto gmtime(std::time_t time) -> std::tm {
struct dispatcher {
std::time_t time_;
std::tm tm_;
dispatcher(std::time_t t) : time_(t) {}
bool run() {
auto run() -> bool {
using namespace fmt::detail;
return handle(gmtime_r(&time_, &tm_));
}
bool handle(std::tm* tm) { return tm != nullptr; }
auto handle(std::tm* tm) -> bool { return tm != nullptr; }
bool handle(detail::null<>) {
auto handle(detail::null<>) -> bool {
using namespace fmt::detail;
return fallback(gmtime_s(&tm_, &time_));
}
bool fallback(int res) { return res == 0; }
auto fallback(int res) -> bool { return res == 0; }
#if !FMT_MSC_VERSION
bool fallback(detail::null<>) {
auto fallback(detail::null<>) -> bool {
std::tm* tm = std::gmtime(&time_);
if (tm) tm_ = *tm;
return tm != nullptr;
}
#endif
};
dispatcher gt(time);
auto gt = dispatcher(time);
// Too big time values may be unsupported.
if (!gt.run()) FMT_THROW(format_error("time_t value out of range"));
return gt.tm_;
}
inline std::tm gmtime(
std::chrono::time_point<std::chrono::system_clock> time_point) {
return gmtime(std::chrono::system_clock::to_time_t(time_point));
template <typename Duration>
inline auto gmtime(
std::chrono::time_point<std::chrono::system_clock, Duration> time_point)
-> std::tm {
return gmtime(detail::to_time_t(time_point));
}
FMT_BEGIN_DETAIL_NAMESPACE
// DEPRECATED!
template <typename Char>
FMT_CONSTEXPR auto parse_align(const Char* begin, const Char* end,
format_specs<Char>& specs) -> const Char* {
FMT_ASSERT(begin != end, "");
auto align = align::none;
auto p = begin + code_point_length(begin);
if (end - p <= 0) p = begin;
for (;;) {
switch (to_ascii(*p)) {
case '<':
align = align::left;
break;
case '>':
align = align::right;
break;
case '^':
align = align::center;
break;
}
if (align != align::none) {
if (p != begin) {
auto c = *begin;
if (c == '}') return begin;
if (c == '{') {
throw_format_error("invalid fill character '{'");
return begin;
}
specs.fill = {begin, to_unsigned(p - begin)};
begin = p + 1;
} else {
++begin;
}
break;
} else if (p == begin) {
break;
}
p = begin;
}
specs.align = align;
return begin;
}
namespace detail {
// Writes two-digit numbers a, b and c separated by sep to buf.
// The method by Pavel Novikov based on
@ -609,7 +613,8 @@ inline void write_digit2_separated(char* buf, unsigned a, unsigned b,
}
}
template <typename Period> FMT_CONSTEXPR inline const char* get_units() {
template <typename Period>
FMT_CONSTEXPR inline auto get_units() -> const char* {
if (std::is_same<Period, std::atto>::value) return "as";
if (std::is_same<Period, std::femto>::value) return "fs";
if (std::is_same<Period, std::pico>::value) return "ps";
@ -627,8 +632,9 @@ template <typename Period> FMT_CONSTEXPR inline const char* get_units() {
if (std::is_same<Period, std::tera>::value) return "Ts";
if (std::is_same<Period, std::peta>::value) return "Ps";
if (std::is_same<Period, std::exa>::value) return "Es";
if (std::is_same<Period, std::ratio<60>>::value) return "m";
if (std::is_same<Period, std::ratio<60>>::value) return "min";
if (std::is_same<Period, std::ratio<3600>>::value) return "h";
if (std::is_same<Period, std::ratio<86400>>::value) return "d";
return nullptr;
}
@ -664,9 +670,8 @@ auto write_padding(OutputIt out, pad_type pad) -> OutputIt {
// Parses a put_time-like format string and invokes handler actions.
template <typename Char, typename Handler>
FMT_CONSTEXPR const Char* parse_chrono_format(const Char* begin,
const Char* end,
Handler&& handler) {
FMT_CONSTEXPR auto parse_chrono_format(const Char* begin, const Char* end,
Handler&& handler) -> const Char* {
if (begin == end || *begin == '}') return begin;
if (*begin != '%') FMT_THROW(format_error("invalid format"));
auto ptr = begin;
@ -997,25 +1002,25 @@ struct tm_format_checker : null_chrono_spec_handler<tm_format_checker> {
FMT_CONSTEXPR void on_tz_name() {}
};
inline const char* tm_wday_full_name(int wday) {
inline auto tm_wday_full_name(int wday) -> const char* {
static constexpr const char* full_name_list[] = {
"Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"};
return wday >= 0 && wday <= 6 ? full_name_list[wday] : "?";
}
inline const char* tm_wday_short_name(int wday) {
inline auto tm_wday_short_name(int wday) -> const char* {
static constexpr const char* short_name_list[] = {"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"};
return wday >= 0 && wday <= 6 ? short_name_list[wday] : "???";
}
inline const char* tm_mon_full_name(int mon) {
inline auto tm_mon_full_name(int mon) -> const char* {
static constexpr const char* full_name_list[] = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"};
return mon >= 0 && mon <= 11 ? full_name_list[mon] : "?";
}
inline const char* tm_mon_short_name(int mon) {
inline auto tm_mon_short_name(int mon) -> const char* {
static constexpr const char* short_name_list[] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
@ -1047,21 +1052,21 @@ inline void tzset_once() {
// Converts value to Int and checks that it's in the range [0, upper).
template <typename T, typename Int, FMT_ENABLE_IF(std::is_integral<T>::value)>
inline Int to_nonnegative_int(T value, Int upper) {
FMT_ASSERT(std::is_unsigned<Int>::value ||
(value >= 0 && to_unsigned(value) <= to_unsigned(upper)),
"invalid value");
(void)upper;
inline auto to_nonnegative_int(T value, Int upper) -> Int {
if (!std::is_unsigned<Int>::value &&
(value < 0 || to_unsigned(value) > to_unsigned(upper))) {
FMT_THROW(fmt::format_error("chrono value is out of range"));
}
return static_cast<Int>(value);
}
template <typename T, typename Int, FMT_ENABLE_IF(!std::is_integral<T>::value)>
inline Int to_nonnegative_int(T value, Int upper) {
inline auto to_nonnegative_int(T value, Int upper) -> Int {
if (value < 0 || value > static_cast<T>(upper))
FMT_THROW(format_error("invalid value"));
return static_cast<Int>(value);
}
constexpr long long pow10(std::uint32_t n) {
constexpr auto pow10(std::uint32_t n) -> long long {
return n == 0 ? 1 : 10 * pow10(n - 1);
}
@ -1095,13 +1100,12 @@ void write_fractional_seconds(OutputIt& out, Duration d, int precision = -1) {
std::chrono::seconds::rep>::type,
std::ratio<1, detail::pow10(num_fractional_digits)>>;
const auto fractional =
d - std::chrono::duration_cast<std::chrono::seconds>(d);
const auto fractional = d - fmt_duration_cast<std::chrono::seconds>(d);
const auto subseconds =
std::chrono::treat_as_floating_point<
typename subsecond_precision::rep>::value
? fractional.count()
: std::chrono::duration_cast<subsecond_precision>(fractional).count();
: fmt_duration_cast<subsecond_precision>(fractional).count();
auto n = static_cast<uint32_or_64_or_128_t<long long>>(subseconds);
const int num_digits = detail::count_digits(n);
@ -1152,11 +1156,11 @@ void write_floating_seconds(memory_buffer& buf, Duration duration,
num_fractional_digits = 6;
}
format_to(std::back_inserter(buf), FMT_STRING("{:.{}f}"),
std::fmod(val * static_cast<rep>(Duration::period::num) /
static_cast<rep>(Duration::period::den),
static_cast<rep>(60)),
num_fractional_digits);
fmt::format_to(std::back_inserter(buf), FMT_STRING("{:.{}f}"),
std::fmod(val * static_cast<rep>(Duration::period::num) /
static_cast<rep>(Duration::period::den),
static_cast<rep>(60)),
num_fractional_digits);
}
template <typename OutputIt, typename Char,
@ -1217,8 +1221,7 @@ class tm_writer {
return static_cast<int>(l);
}
// Algorithm:
// https://en.wikipedia.org/wiki/ISO_week_date#Calculating_the_week_number_from_a_month_and_day_of_the_month_or_ordinal_date
// Algorithm: https://en.wikipedia.org/wiki/ISO_week_date.
auto iso_year_weeks(long long curr_year) const noexcept -> int {
const auto prev_year = curr_year - 1;
const auto curr_p =
@ -1358,7 +1361,7 @@ class tm_writer {
subsecs_(subsecs),
tm_(tm) {}
OutputIt out() const { return out_; }
auto out() const -> OutputIt { return out_; }
FMT_CONSTEXPR void on_text(const Char* begin, const Char* end) {
out_ = copy_str<Char>(begin, end, out_);
@ -1622,6 +1625,7 @@ struct chrono_format_checker : null_chrono_spec_handler<chrono_format_checker> {
template <typename Char>
FMT_CONSTEXPR void on_text(const Char*, const Char*) {}
FMT_CONSTEXPR void on_day_of_year() {}
FMT_CONSTEXPR void on_24_hour(numeric_system, pad_type) {}
FMT_CONSTEXPR void on_12_hour(numeric_system, pad_type) {}
FMT_CONSTEXPR void on_minute(numeric_system, pad_type) {}
@ -1640,16 +1644,16 @@ struct chrono_format_checker : null_chrono_spec_handler<chrono_format_checker> {
template <typename T,
FMT_ENABLE_IF(std::is_integral<T>::value&& has_isfinite<T>::value)>
inline bool isfinite(T) {
inline auto isfinite(T) -> bool {
return true;
}
template <typename T, FMT_ENABLE_IF(std::is_integral<T>::value)>
inline T mod(T x, int y) {
inline auto mod(T x, int y) -> T {
return x % static_cast<T>(y);
}
template <typename T, FMT_ENABLE_IF(std::is_floating_point<T>::value)>
inline T mod(T x, int y) {
inline auto mod(T x, int y) -> T {
return std::fmod(x, static_cast<T>(y));
}
@ -1664,49 +1668,38 @@ template <typename T> struct make_unsigned_or_unchanged<T, true> {
using type = typename std::make_unsigned<T>::type;
};
#if FMT_SAFE_DURATION_CAST
// throwing version of safe_duration_cast
template <typename To, typename FromRep, typename FromPeriod>
To fmt_safe_duration_cast(std::chrono::duration<FromRep, FromPeriod> from) {
int ec;
To to = safe_duration_cast::safe_duration_cast<To>(from, ec);
if (ec) FMT_THROW(format_error("cannot format duration"));
return to;
}
#endif
template <typename Rep, typename Period,
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
inline std::chrono::duration<Rep, std::milli> get_milliseconds(
std::chrono::duration<Rep, Period> d) {
inline auto get_milliseconds(std::chrono::duration<Rep, Period> d)
-> std::chrono::duration<Rep, std::milli> {
// this may overflow and/or the result may not fit in the
// target type.
#if FMT_SAFE_DURATION_CAST
using CommonSecondsType =
typename std::common_type<decltype(d), std::chrono::seconds>::type;
const auto d_as_common = fmt_safe_duration_cast<CommonSecondsType>(d);
const auto d_as_common = fmt_duration_cast<CommonSecondsType>(d);
const auto d_as_whole_seconds =
fmt_safe_duration_cast<std::chrono::seconds>(d_as_common);
fmt_duration_cast<std::chrono::seconds>(d_as_common);
// this conversion should be nonproblematic
const auto diff = d_as_common - d_as_whole_seconds;
const auto ms =
fmt_safe_duration_cast<std::chrono::duration<Rep, std::milli>>(diff);
fmt_duration_cast<std::chrono::duration<Rep, std::milli>>(diff);
return ms;
#else
auto s = std::chrono::duration_cast<std::chrono::seconds>(d);
return std::chrono::duration_cast<std::chrono::milliseconds>(d - s);
auto s = fmt_duration_cast<std::chrono::seconds>(d);
return fmt_duration_cast<std::chrono::milliseconds>(d - s);
#endif
}
template <typename Char, typename Rep, typename OutputIt,
FMT_ENABLE_IF(std::is_integral<Rep>::value)>
OutputIt format_duration_value(OutputIt out, Rep val, int) {
auto format_duration_value(OutputIt out, Rep val, int) -> OutputIt {
return write<Char>(out, val);
}
template <typename Char, typename Rep, typename OutputIt,
FMT_ENABLE_IF(std::is_floating_point<Rep>::value)>
OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
auto format_duration_value(OutputIt out, Rep val, int precision) -> OutputIt {
auto specs = format_specs<Char>();
specs.precision = precision;
specs.type = precision >= 0 ? presentation_type::fixed_lower
@ -1715,12 +1708,12 @@ OutputIt format_duration_value(OutputIt out, Rep val, int precision) {
}
template <typename Char, typename OutputIt>
OutputIt copy_unit(string_view unit, OutputIt out, Char) {
auto copy_unit(string_view unit, OutputIt out, Char) -> OutputIt {
return std::copy(unit.begin(), unit.end(), out);
}
template <typename OutputIt>
OutputIt copy_unit(string_view unit, OutputIt out, wchar_t) {
auto copy_unit(string_view unit, OutputIt out, wchar_t) -> OutputIt {
// This works when wchar_t is UTF-32 because units only contain characters
// that have the same representation in UTF-16 and UTF-32.
utf8_to_utf16 u(unit);
@ -1728,7 +1721,7 @@ OutputIt copy_unit(string_view unit, OutputIt out, wchar_t) {
}
template <typename Char, typename Period, typename OutputIt>
OutputIt format_duration_unit(OutputIt out) {
auto format_duration_unit(OutputIt out) -> OutputIt {
if (const char* unit = get_units<Period>())
return copy_unit(string_view(unit), out, Char());
*out++ = '[';
@ -1795,18 +1788,12 @@ struct chrono_formatter {
// this may overflow and/or the result may not fit in the
// target type.
#if FMT_SAFE_DURATION_CAST
// might need checked conversion (rep!=Rep)
auto tmpval = std::chrono::duration<rep, Period>(val);
s = fmt_safe_duration_cast<seconds>(tmpval);
#else
s = std::chrono::duration_cast<seconds>(
std::chrono::duration<rep, Period>(val));
#endif
s = fmt_duration_cast<seconds>(std::chrono::duration<rep, Period>(val));
}
// returns true if nan or inf, writes to out.
bool handle_nan_inf() {
auto handle_nan_inf() -> bool {
if (isfinite(val)) {
return false;
}
@ -1823,17 +1810,22 @@ struct chrono_formatter {
return true;
}
Rep hour() const { return static_cast<Rep>(mod((s.count() / 3600), 24)); }
auto days() const -> Rep { return static_cast<Rep>(s.count() / 86400); }
auto hour() const -> Rep {
return static_cast<Rep>(mod((s.count() / 3600), 24));
}
Rep hour12() const {
auto hour12() const -> Rep {
Rep hour = static_cast<Rep>(mod((s.count() / 3600), 12));
return hour <= 0 ? 12 : hour;
}
Rep minute() const { return static_cast<Rep>(mod((s.count() / 60), 60)); }
Rep second() const { return static_cast<Rep>(mod(s.count(), 60)); }
auto minute() const -> Rep {
return static_cast<Rep>(mod((s.count() / 60), 60));
}
auto second() const -> Rep { return static_cast<Rep>(mod(s.count(), 60)); }
std::tm time() const {
auto time() const -> std::tm {
auto time = std::tm();
time.tm_hour = to_nonnegative_int(hour(), 24);
time.tm_min = to_nonnegative_int(minute(), 60);
@ -1901,10 +1893,14 @@ struct chrono_formatter {
void on_dec0_week_of_year(numeric_system) {}
void on_dec1_week_of_year(numeric_system) {}
void on_iso_week_of_year(numeric_system) {}
void on_day_of_year() {}
void on_day_of_month(numeric_system) {}
void on_day_of_month_space(numeric_system) {}
void on_day_of_year() {
if (handle_nan_inf()) return;
write(days(), 0);
}
void on_24_hour(numeric_system ns, pad_type pad) {
if (handle_nan_inf()) return;
@ -1997,7 +1993,7 @@ struct chrono_formatter {
}
};
FMT_END_DETAIL_NAMESPACE
} // namespace detail
#if defined(__cpp_lib_chrono) && __cpp_lib_chrono >= 201907
using weekday = std::chrono::weekday;
@ -2011,7 +2007,7 @@ class weekday {
weekday() = default;
explicit constexpr weekday(unsigned wd) noexcept
: value(static_cast<unsigned char>(wd != 7 ? wd : 0)) {}
constexpr unsigned c_encoding() const noexcept { return value; }
constexpr auto c_encoding() const noexcept -> unsigned { return value; }
};
class year_month_day {};
@ -2047,80 +2043,67 @@ template <typename Char> struct formatter<weekday, Char> {
template <typename Rep, typename Period, typename Char>
struct formatter<std::chrono::duration<Rep, Period>, Char> {
private:
format_specs<Char> specs;
int precision = -1;
using arg_ref_type = detail::arg_ref<Char>;
arg_ref_type width_ref;
arg_ref_type precision_ref;
bool localized = false;
basic_string_view<Char> format_str;
using duration = std::chrono::duration<Rep, Period>;
using iterator = typename basic_format_parse_context<Char>::iterator;
struct parse_range {
iterator begin;
iterator end;
};
format_specs<Char> specs_;
detail::arg_ref<Char> width_ref_;
detail::arg_ref<Char> precision_ref_;
bool localized_ = false;
basic_string_view<Char> format_str_;
FMT_CONSTEXPR parse_range do_parse(basic_format_parse_context<Char>& ctx) {
auto begin = ctx.begin(), end = ctx.end();
if (begin == end || *begin == '}') return {begin, begin};
public:
FMT_CONSTEXPR auto parse(basic_format_parse_context<Char>& ctx)
-> decltype(ctx.begin()) {
auto it = ctx.begin(), end = ctx.end();
if (it == end || *it == '}') return it;
begin = detail::parse_align(begin, end, specs);
if (begin == end) return {begin, begin};
it = detail::parse_align(it, end, specs_);
if (it == end) return it;
begin = detail::parse_dynamic_spec(begin, end, specs.width, width_ref, ctx);
if (begin == end) return {begin, begin};
it = detail::parse_dynamic_spec(it, end, specs_.width, width_ref_, ctx);
if (it == end) return it;
auto checker = detail::chrono_format_checker();
if (*begin == '.') {
if (*it == '.') {
checker.has_precision_integral = !std::is_floating_point<Rep>::value;
begin =
detail::parse_precision(begin, end, precision, precision_ref, ctx);
it = detail::parse_precision(it, end, specs_.precision, precision_ref_,
ctx);
}
if (begin != end && *begin == 'L') {
++begin;
localized = true;
if (it != end && *it == 'L') {
localized_ = true;
++it;
}
end = detail::parse_chrono_format(begin, end, checker);
return {begin, end};
}
public:
FMT_CONSTEXPR auto parse(basic_format_parse_context<Char>& ctx)
-> decltype(ctx.begin()) {
auto range = do_parse(ctx);
format_str = basic_string_view<Char>(
&*range.begin, detail::to_unsigned(range.end - range.begin));
return range.end;
end = detail::parse_chrono_format(it, end, checker);
format_str_ = {it, detail::to_unsigned(end - it)};
return end;
}
template <typename FormatContext>
auto format(const duration& d, FormatContext& ctx) const
auto format(std::chrono::duration<Rep, Period> d, FormatContext& ctx) const
-> decltype(ctx.out()) {
auto specs_copy = specs;
auto precision_copy = precision;
auto begin = format_str.begin(), end = format_str.end();
auto specs = specs_;
auto precision = specs.precision;
specs.precision = -1;
auto begin = format_str_.begin(), end = format_str_.end();
// As a possible future optimization, we could avoid extra copying if width
// is not specified.
basic_memory_buffer<Char> buf;
auto buf = basic_memory_buffer<Char>();
auto out = std::back_inserter(buf);
detail::handle_dynamic_spec<detail::width_checker>(specs_copy.width,
width_ref, ctx);
detail::handle_dynamic_spec<detail::precision_checker>(precision_copy,
precision_ref, ctx);
detail::handle_dynamic_spec<detail::width_checker>(specs.width, width_ref_,
ctx);
detail::handle_dynamic_spec<detail::precision_checker>(precision,
precision_ref_, ctx);
if (begin == end || *begin == '}') {
out = detail::format_duration_value<Char>(out, d.count(), precision_copy);
out = detail::format_duration_value<Char>(out, d.count(), precision);
detail::format_duration_unit<Char, Period>(out);
} else {
detail::chrono_formatter<FormatContext, decltype(out), Rep, Period> f(
ctx, out, d);
f.precision = precision_copy;
f.localized = localized;
using chrono_formatter =
detail::chrono_formatter<FormatContext, decltype(out), Rep, Period>;
auto f = chrono_formatter(ctx, out, d);
f.precision = precision;
f.localized = localized_;
detail::parse_chrono_format(begin, end, f);
}
return detail::write(
ctx.out(), basic_string_view<Char>(buf.data(), buf.size()), specs_copy);
ctx.out(), basic_string_view<Char>(buf.data(), buf.size()), specs);
}
};
@ -2128,34 +2111,33 @@ template <typename Char, typename Duration>
struct formatter<std::chrono::time_point<std::chrono::system_clock, Duration>,
Char> : formatter<std::tm, Char> {
FMT_CONSTEXPR formatter() {
this->format_str = detail::string_literal<Char, '%', 'F', ' ', '%', 'T'>{};
this->format_str_ = detail::string_literal<Char, '%', 'F', ' ', '%', 'T'>{};
}
template <typename FormatContext>
auto format(std::chrono::time_point<std::chrono::system_clock, Duration> val,
FormatContext& ctx) const -> decltype(ctx.out()) {
using period = typename Duration::period;
if (period::num != 1 || period::den != 1 ||
std::is_floating_point<typename Duration::rep>::value) {
if (detail::const_check(
period::num != 1 || period::den != 1 ||
std::is_floating_point<typename Duration::rep>::value)) {
const auto epoch = val.time_since_epoch();
auto subsecs = std::chrono::duration_cast<Duration>(
epoch - std::chrono::duration_cast<std::chrono::seconds>(epoch));
auto subsecs = detail::fmt_duration_cast<Duration>(
epoch - detail::fmt_duration_cast<std::chrono::seconds>(epoch));
if (subsecs.count() < 0) {
auto second = std::chrono::seconds(1);
auto second =
detail::fmt_duration_cast<Duration>(std::chrono::seconds(1));
if (epoch.count() < ((Duration::min)() + second).count())
FMT_THROW(format_error("duration is too small"));
subsecs += second;
val -= second;
}
return formatter<std::tm, Char>::do_format(
gmtime(std::chrono::time_point_cast<std::chrono::seconds>(val)), ctx,
&subsecs);
return formatter<std::tm, Char>::do_format(gmtime(val), ctx, &subsecs);
}
return formatter<std::tm, Char>::format(
gmtime(std::chrono::time_point_cast<std::chrono::seconds>(val)), ctx);
return formatter<std::tm, Char>::format(gmtime(val), ctx);
}
};
@ -2164,7 +2146,7 @@ template <typename Char, typename Duration>
struct formatter<std::chrono::local_time<Duration>, Char>
: formatter<std::tm, Char> {
FMT_CONSTEXPR formatter() {
this->format_str = detail::string_literal<Char, '%', 'F', ' ', '%', 'T'>{};
this->format_str_ = detail::string_literal<Char, '%', 'F', ' ', '%', 'T'>{};
}
template <typename FormatContext>
@ -2174,17 +2156,13 @@ struct formatter<std::chrono::local_time<Duration>, Char>
if (period::num != 1 || period::den != 1 ||
std::is_floating_point<typename Duration::rep>::value) {
const auto epoch = val.time_since_epoch();
const auto subsecs = std::chrono::duration_cast<Duration>(
epoch - std::chrono::duration_cast<std::chrono::seconds>(epoch));
const auto subsecs = detail::fmt_duration_cast<Duration>(
epoch - detail::fmt_duration_cast<std::chrono::seconds>(epoch));
return formatter<std::tm, Char>::do_format(
localtime(std::chrono::time_point_cast<std::chrono::seconds>(val)),
ctx, &subsecs);
return formatter<std::tm, Char>::do_format(localtime(val), ctx, &subsecs);
}
return formatter<std::tm, Char>::format(
localtime(std::chrono::time_point_cast<std::chrono::seconds>(val)),
ctx);
return formatter<std::tm, Char>::format(localtime(val), ctx);
}
};
#endif
@ -2207,51 +2185,46 @@ struct formatter<std::chrono::time_point<std::chrono::utc_clock, Duration>,
template <typename Char> struct formatter<std::tm, Char> {
private:
format_specs<Char> specs;
detail::arg_ref<Char> width_ref;
format_specs<Char> specs_;
detail::arg_ref<Char> width_ref_;
protected:
basic_string_view<Char> format_str;
FMT_CONSTEXPR auto do_parse(basic_format_parse_context<Char>& ctx)
-> decltype(ctx.begin()) {
auto begin = ctx.begin(), end = ctx.end();
if (begin == end || *begin == '}') return begin;
begin = detail::parse_align(begin, end, specs);
if (begin == end) return end;
begin = detail::parse_dynamic_spec(begin, end, specs.width, width_ref, ctx);
if (begin == end) return end;
end = detail::parse_chrono_format(begin, end, detail::tm_format_checker());
// Replace default format_str only if the new spec is not empty.
if (end != begin) format_str = {begin, detail::to_unsigned(end - begin)};
return end;
}
basic_string_view<Char> format_str_;
template <typename FormatContext, typename Duration>
auto do_format(const std::tm& tm, FormatContext& ctx,
const Duration* subsecs) const -> decltype(ctx.out()) {
auto specs_copy = specs;
basic_memory_buffer<Char> buf;
auto specs = specs_;
auto buf = basic_memory_buffer<Char>();
auto out = std::back_inserter(buf);
detail::handle_dynamic_spec<detail::width_checker>(specs_copy.width,
width_ref, ctx);
detail::handle_dynamic_spec<detail::width_checker>(specs.width, width_ref_,
ctx);
const auto loc_ref = ctx.locale();
auto loc_ref = ctx.locale();
detail::get_locale loc(static_cast<bool>(loc_ref), loc_ref);
auto w =
detail::tm_writer<decltype(out), Char, Duration>(loc, out, tm, subsecs);
detail::parse_chrono_format(format_str.begin(), format_str.end(), w);
detail::parse_chrono_format(format_str_.begin(), format_str_.end(), w);
return detail::write(
ctx.out(), basic_string_view<Char>(buf.data(), buf.size()), specs_copy);
ctx.out(), basic_string_view<Char>(buf.data(), buf.size()), specs);
}
public:
FMT_CONSTEXPR auto parse(basic_format_parse_context<Char>& ctx)
-> decltype(ctx.begin()) {
return this->do_parse(ctx);
auto it = ctx.begin(), end = ctx.end();
if (it == end || *it == '}') return it;
it = detail::parse_align(it, end, specs_);
if (it == end) return it;
it = detail::parse_dynamic_spec(it, end, specs_.width, width_ref_, ctx);
if (it == end) return it;
end = detail::parse_chrono_format(it, end, detail::tm_format_checker());
// Replace the default format_str only if the new spec is not empty.
if (end != it) format_str_ = {it, detail::to_unsigned(end - it)};
return end;
}
template <typename FormatContext>

File diff suppressed because it is too large Load Diff

@ -18,7 +18,7 @@
# include <locale>
#endif
#ifdef _WIN32
#if defined(_WIN32) && !defined(FMT_WINDOWS_NO_WCHAR)
# include <io.h> // _isatty
#endif
@ -58,8 +58,8 @@ FMT_FUNC void format_error_code(detail::buffer<char>& out, int error_code,
error_code_size += detail::to_unsigned(detail::count_digits(abs_value));
auto it = buffer_appender<char>(out);
if (message.size() <= inline_buffer_size - error_code_size)
format_to(it, FMT_STRING("{}{}"), message, SEP);
format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code);
fmt::format_to(it, FMT_STRING("{}{}"), message, SEP);
fmt::format_to(it, FMT_STRING("{}{}"), ERROR_STR, error_code);
FMT_ASSERT(out.size() <= inline_buffer_size, "");
}
@ -73,9 +73,8 @@ FMT_FUNC void report_error(format_func func, int error_code,
}
// A wrapper around fwrite that throws on error.
inline void fwrite_fully(const void* ptr, size_t size, size_t count,
FILE* stream) {
size_t written = std::fwrite(ptr, size, count, stream);
inline void fwrite_fully(const void* ptr, size_t count, FILE* stream) {
size_t written = std::fwrite(ptr, 1, count, stream);
if (written < count)
FMT_THROW(system_error(errno, FMT_STRING("cannot write to file")));
}
@ -86,7 +85,7 @@ locale_ref::locale_ref(const Locale& loc) : locale_(&loc) {
static_assert(std::is_same<Locale, std::locale>::value, "");
}
template <typename Locale> Locale locale_ref::get() const {
template <typename Locale> auto locale_ref::get() const -> Locale {
static_assert(std::is_same<Locale, std::locale>::value, "");
return locale_ ? *static_cast<const std::locale*>(locale_) : std::locale();
}
@ -98,7 +97,8 @@ FMT_FUNC auto thousands_sep_impl(locale_ref loc) -> thousands_sep_result<Char> {
auto thousands_sep = grouping.empty() ? Char() : facet.thousands_sep();
return {std::move(grouping), thousands_sep};
}
template <typename Char> FMT_FUNC Char decimal_point_impl(locale_ref loc) {
template <typename Char>
FMT_FUNC auto decimal_point_impl(locale_ref loc) -> Char {
return std::use_facet<std::numpunct<Char>>(loc.get<std::locale>())
.decimal_point();
}
@ -144,24 +144,25 @@ FMT_API FMT_FUNC auto format_facet<std::locale>::do_put(
}
#endif
FMT_FUNC std::system_error vsystem_error(int error_code, string_view fmt,
format_args args) {
FMT_FUNC auto vsystem_error(int error_code, string_view fmt, format_args args)
-> std::system_error {
auto ec = std::error_code(error_code, std::generic_category());
return std::system_error(ec, vformat(fmt, args));
}
namespace detail {
template <typename F> inline bool operator==(basic_fp<F> x, basic_fp<F> y) {
template <typename F>
inline auto operator==(basic_fp<F> x, basic_fp<F> y) -> bool {
return x.f == y.f && x.e == y.e;
}
// Compilers should be able to optimize this into the ror instruction.
FMT_CONSTEXPR inline uint32_t rotr(uint32_t n, uint32_t r) noexcept {
FMT_CONSTEXPR inline auto rotr(uint32_t n, uint32_t r) noexcept -> uint32_t {
r &= 31;
return (n >> r) | (n << (32 - r));
}
FMT_CONSTEXPR inline uint64_t rotr(uint64_t n, uint32_t r) noexcept {
FMT_CONSTEXPR inline auto rotr(uint64_t n, uint32_t r) noexcept -> uint64_t {
r &= 63;
return (n >> r) | (n << (64 - r));
}
@ -170,14 +171,14 @@ FMT_CONSTEXPR inline uint64_t rotr(uint64_t n, uint32_t r) noexcept {
namespace dragonbox {
// Computes upper 64 bits of multiplication of a 32-bit unsigned integer and a
// 64-bit unsigned integer.
inline uint64_t umul96_upper64(uint32_t x, uint64_t y) noexcept {
inline auto umul96_upper64(uint32_t x, uint64_t y) noexcept -> uint64_t {
return umul128_upper64(static_cast<uint64_t>(x) << 32, y);
}
// Computes lower 128 bits of multiplication of a 64-bit unsigned integer and a
// 128-bit unsigned integer.
inline uint128_fallback umul192_lower128(uint64_t x,
uint128_fallback y) noexcept {
inline auto umul192_lower128(uint64_t x, uint128_fallback y) noexcept
-> uint128_fallback {
uint64_t high = x * y.high();
uint128_fallback high_low = umul128(x, y.low());
return {high + high_low.high(), high_low.low()};
@ -185,12 +186,12 @@ inline uint128_fallback umul192_lower128(uint64_t x,
// Computes lower 64 bits of multiplication of a 32-bit unsigned integer and a
// 64-bit unsigned integer.
inline uint64_t umul96_lower64(uint32_t x, uint64_t y) noexcept {
inline auto umul96_lower64(uint32_t x, uint64_t y) noexcept -> uint64_t {
return x * y;
}
// Various fast log computations.
inline int floor_log10_pow2_minus_log10_4_over_3(int e) noexcept {
inline auto floor_log10_pow2_minus_log10_4_over_3(int e) noexcept -> int {
FMT_ASSERT(e <= 2936 && e >= -2985, "too large exponent");
return (e * 631305 - 261663) >> 21;
}
@ -204,7 +205,7 @@ FMT_INLINE_VARIABLE constexpr struct {
// divisible by pow(10, N).
// Precondition: n <= pow(10, N + 1).
template <int N>
bool check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept {
auto check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept -> bool {
// The numbers below are chosen such that:
// 1. floor(n/d) = floor(nm / 2^k) where d=10 or d=100,
// 2. nm mod 2^k < m if and only if n is divisible by d,
@ -229,7 +230,7 @@ bool check_divisibility_and_divide_by_pow10(uint32_t& n) noexcept {
// Computes floor(n / pow(10, N)) for small n and N.
// Precondition: n <= pow(10, N + 1).
template <int N> uint32_t small_division_by_pow10(uint32_t n) noexcept {
template <int N> auto small_division_by_pow10(uint32_t n) noexcept -> uint32_t {
constexpr auto info = div_small_pow10_infos[N - 1];
FMT_ASSERT(n <= info.divisor * 10, "n is too large");
constexpr uint32_t magic_number =
@ -238,12 +239,12 @@ template <int N> uint32_t small_division_by_pow10(uint32_t n) noexcept {
}
// Computes floor(n / 10^(kappa + 1)) (float)
inline uint32_t divide_by_10_to_kappa_plus_1(uint32_t n) noexcept {
inline auto divide_by_10_to_kappa_plus_1(uint32_t n) noexcept -> uint32_t {
// 1374389535 = ceil(2^37/100)
return static_cast<uint32_t>((static_cast<uint64_t>(n) * 1374389535) >> 37);
}
// Computes floor(n / 10^(kappa + 1)) (double)
inline uint64_t divide_by_10_to_kappa_plus_1(uint64_t n) noexcept {
inline auto divide_by_10_to_kappa_plus_1(uint64_t n) noexcept -> uint64_t {
// 2361183241434822607 = ceil(2^(64+7)/1000)
return umul128_upper64(n, 2361183241434822607ull) >> 7;
}
@ -255,7 +256,7 @@ template <> struct cache_accessor<float> {
using carrier_uint = float_info<float>::carrier_uint;
using cache_entry_type = uint64_t;
static uint64_t get_cached_power(int k) noexcept {
static auto get_cached_power(int k) noexcept -> uint64_t {
FMT_ASSERT(k >= float_info<float>::min_k && k <= float_info<float>::max_k,
"k is out of range");
static constexpr const uint64_t pow10_significands[] = {
@ -297,20 +298,23 @@ template <> struct cache_accessor<float> {
bool is_integer;
};
static compute_mul_result compute_mul(
carrier_uint u, const cache_entry_type& cache) noexcept {
static auto compute_mul(carrier_uint u,
const cache_entry_type& cache) noexcept
-> compute_mul_result {
auto r = umul96_upper64(u, cache);
return {static_cast<carrier_uint>(r >> 32),
static_cast<carrier_uint>(r) == 0};
}
static uint32_t compute_delta(const cache_entry_type& cache,
int beta) noexcept {
static auto compute_delta(const cache_entry_type& cache, int beta) noexcept
-> uint32_t {
return static_cast<uint32_t>(cache >> (64 - 1 - beta));
}
static compute_mul_parity_result compute_mul_parity(
carrier_uint two_f, const cache_entry_type& cache, int beta) noexcept {
static auto compute_mul_parity(carrier_uint two_f,
const cache_entry_type& cache,
int beta) noexcept
-> compute_mul_parity_result {
FMT_ASSERT(beta >= 1, "");
FMT_ASSERT(beta < 64, "");
@ -319,22 +323,22 @@ template <> struct cache_accessor<float> {
static_cast<uint32_t>(r >> (32 - beta)) == 0};
}
static carrier_uint compute_left_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept {
static auto compute_left_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept -> carrier_uint {
return static_cast<carrier_uint>(
(cache - (cache >> (num_significand_bits<float>() + 2))) >>
(64 - num_significand_bits<float>() - 1 - beta));
}
static carrier_uint compute_right_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept {
static auto compute_right_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept -> carrier_uint {
return static_cast<carrier_uint>(
(cache + (cache >> (num_significand_bits<float>() + 1))) >>
(64 - num_significand_bits<float>() - 1 - beta));
}
static carrier_uint compute_round_up_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept {
static auto compute_round_up_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept -> carrier_uint {
return (static_cast<carrier_uint>(
cache >> (64 - num_significand_bits<float>() - 2 - beta)) +
1) /
@ -346,7 +350,7 @@ template <> struct cache_accessor<double> {
using carrier_uint = float_info<double>::carrier_uint;
using cache_entry_type = uint128_fallback;
static uint128_fallback get_cached_power(int k) noexcept {
static auto get_cached_power(int k) noexcept -> uint128_fallback {
FMT_ASSERT(k >= float_info<double>::min_k && k <= float_info<double>::max_k,
"k is out of range");
@ -985,8 +989,7 @@ template <> struct cache_accessor<double> {
{0xe0accfa875af45a7, 0x93eb1b80a33b8606},
{0x8c6c01c9498d8b88, 0xbc72f130660533c4},
{0xaf87023b9bf0ee6a, 0xeb8fad7c7f8680b5},
{ 0xdb68c2ca82ed2a05,
0xa67398db9f6820e2 }
{0xdb68c2ca82ed2a05, 0xa67398db9f6820e2},
#else
{0xff77b1fcbebcdc4f, 0x25e8e89c13bb0f7b},
{0xce5d73ff402d98e3, 0xfb0a3d212dc81290},
@ -1071,19 +1074,22 @@ template <> struct cache_accessor<double> {
bool is_integer;
};
static compute_mul_result compute_mul(
carrier_uint u, const cache_entry_type& cache) noexcept {
static auto compute_mul(carrier_uint u,
const cache_entry_type& cache) noexcept
-> compute_mul_result {
auto r = umul192_upper128(u, cache);
return {r.high(), r.low() == 0};
}
static uint32_t compute_delta(cache_entry_type const& cache,
int beta) noexcept {
static auto compute_delta(cache_entry_type const& cache, int beta) noexcept
-> uint32_t {
return static_cast<uint32_t>(cache.high() >> (64 - 1 - beta));
}
static compute_mul_parity_result compute_mul_parity(
carrier_uint two_f, const cache_entry_type& cache, int beta) noexcept {
static auto compute_mul_parity(carrier_uint two_f,
const cache_entry_type& cache,
int beta) noexcept
-> compute_mul_parity_result {
FMT_ASSERT(beta >= 1, "");
FMT_ASSERT(beta < 64, "");
@ -1092,35 +1098,35 @@ template <> struct cache_accessor<double> {
((r.high() << beta) | (r.low() >> (64 - beta))) == 0};
}
static carrier_uint compute_left_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept {
static auto compute_left_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept -> carrier_uint {
return (cache.high() -
(cache.high() >> (num_significand_bits<double>() + 2))) >>
(64 - num_significand_bits<double>() - 1 - beta);
}
static carrier_uint compute_right_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept {
static auto compute_right_endpoint_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept -> carrier_uint {
return (cache.high() +
(cache.high() >> (num_significand_bits<double>() + 1))) >>
(64 - num_significand_bits<double>() - 1 - beta);
}
static carrier_uint compute_round_up_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept {
static auto compute_round_up_for_shorter_interval_case(
const cache_entry_type& cache, int beta) noexcept -> carrier_uint {
return ((cache.high() >> (64 - num_significand_bits<double>() - 2 - beta)) +
1) /
2;
}
};
FMT_FUNC uint128_fallback get_cached_power(int k) noexcept {
FMT_FUNC auto get_cached_power(int k) noexcept -> uint128_fallback {
return cache_accessor<double>::get_cached_power(k);
}
// Various integer checks
template <typename T>
bool is_left_endpoint_integer_shorter_interval(int exponent) noexcept {
auto is_left_endpoint_integer_shorter_interval(int exponent) noexcept -> bool {
const int case_shorter_interval_left_endpoint_lower_threshold = 2;
const int case_shorter_interval_left_endpoint_upper_threshold = 3;
return exponent >= case_shorter_interval_left_endpoint_lower_threshold &&
@ -1128,16 +1134,12 @@ bool is_left_endpoint_integer_shorter_interval(int exponent) noexcept {
}
// Remove trailing zeros from n and return the number of zeros removed (float)
FMT_INLINE int remove_trailing_zeros(uint32_t& n) noexcept {
FMT_INLINE int remove_trailing_zeros(uint32_t& n, int s = 0) noexcept {
FMT_ASSERT(n != 0, "");
// Modular inverse of 5 (mod 2^32): (mod_inv_5 * 5) mod 2^32 = 1.
// See https://github.com/fmtlib/fmt/issues/3163 for more details.
const uint32_t mod_inv_5 = 0xcccccccd;
// Casts are needed to workaround a bug in MSVC 19.22 and older.
const uint32_t mod_inv_25 =
static_cast<uint32_t>(uint64_t(mod_inv_5) * mod_inv_5);
constexpr uint32_t mod_inv_5 = 0xcccccccd;
constexpr uint32_t mod_inv_25 = 0xc28f5c29; // = mod_inv_5 * mod_inv_5
int s = 0;
while (true) {
auto q = rotr(n * mod_inv_25, 2);
if (q > max_value<uint32_t>() / 100) break;
@ -1162,32 +1164,17 @@ FMT_INLINE int remove_trailing_zeros(uint64_t& n) noexcept {
// Is n is divisible by 10^8?
if ((nm.high() & ((1ull << (90 - 64)) - 1)) == 0 && nm.low() < magic_number) {
// If yes, work with the quotient.
// If yes, work with the quotient...
auto n32 = static_cast<uint32_t>(nm.high() >> (90 - 64));
const uint32_t mod_inv_5 = 0xcccccccd;
const uint32_t mod_inv_25 = mod_inv_5 * mod_inv_5;
int s = 8;
while (true) {
auto q = rotr(n32 * mod_inv_25, 2);
if (q > max_value<uint32_t>() / 100) break;
n32 = q;
s += 2;
}
auto q = rotr(n32 * mod_inv_5, 1);
if (q <= max_value<uint32_t>() / 10) {
n32 = q;
s |= 1;
}
// ... and use the 32 bit variant of the function
int s = remove_trailing_zeros(n32, 8);
n = n32;
return s;
}
// If n is not divisible by 10^8, work with n itself.
const uint64_t mod_inv_5 = 0xcccccccccccccccd;
const uint64_t mod_inv_25 = mod_inv_5 * mod_inv_5;
constexpr uint64_t mod_inv_5 = 0xcccccccccccccccd;
constexpr uint64_t mod_inv_25 = 0x8f5c28f5c28f5c29; // mod_inv_5 * mod_inv_5
int s = 0;
while (true) {
@ -1253,7 +1240,7 @@ FMT_INLINE decimal_fp<T> shorter_interval_case(int exponent) noexcept {
return ret_value;
}
template <typename T> decimal_fp<T> to_decimal(T x) noexcept {
template <typename T> auto to_decimal(T x) noexcept -> decimal_fp<T> {
// Step 1: integer promotion & Schubfach multiplier calculation.
using carrier_uint = typename float_info<T>::carrier_uint;
@ -1392,15 +1379,15 @@ template <> struct formatter<detail::bigint> {
for (auto i = n.bigits_.size(); i > 0; --i) {
auto value = n.bigits_[i - 1u];
if (first) {
out = format_to(out, FMT_STRING("{:x}"), value);
out = fmt::format_to(out, FMT_STRING("{:x}"), value);
first = false;
continue;
}
out = format_to(out, FMT_STRING("{:08x}"), value);
out = fmt::format_to(out, FMT_STRING("{:08x}"), value);
}
if (n.exp_ > 0)
out = format_to(out, FMT_STRING("p{}"),
n.exp_ * detail::bigint::bigit_bits);
out = fmt::format_to(out, FMT_STRING("p{}"),
n.exp_ * detail::bigint::bigit_bits);
return out;
}
};
@ -1436,7 +1423,7 @@ FMT_FUNC void report_system_error(int error_code,
report_error(format_system_error, error_code, message);
}
FMT_FUNC std::string vformat(string_view fmt, format_args args) {
FMT_FUNC auto vformat(string_view fmt, format_args args) -> std::string {
// Don't optimize the "{}" case to keep the binary size small and because it
// can be better optimized in fmt::format anyway.
auto buffer = memory_buffer();
@ -1445,33 +1432,38 @@ FMT_FUNC std::string vformat(string_view fmt, format_args args) {
}
namespace detail {
#ifndef _WIN32
FMT_FUNC bool write_console(std::FILE*, string_view) { return false; }
#if !defined(_WIN32) || defined(FMT_WINDOWS_NO_WCHAR)
FMT_FUNC auto write_console(int, string_view) -> bool { return false; }
#else
using dword = conditional_t<sizeof(long) == 4, unsigned long, unsigned>;
extern "C" __declspec(dllimport) int __stdcall WriteConsoleW( //
void*, const void*, dword, dword*, void*);
FMT_FUNC bool write_console(std::FILE* f, string_view text) {
auto fd = _fileno(f);
if (!_isatty(fd)) return false;
FMT_FUNC bool write_console(int fd, string_view text) {
auto u16 = utf8_to_utf16(text);
auto written = dword();
return WriteConsoleW(reinterpret_cast<void*>(_get_osfhandle(fd)), u16.c_str(),
static_cast<uint32_t>(u16.size()), &written, nullptr);
static_cast<dword>(u16.size()), nullptr, nullptr) != 0;
}
#endif
#ifdef _WIN32
// Print assuming legacy (non-Unicode) encoding.
FMT_FUNC void vprint_mojibake(std::FILE* f, string_view fmt, format_args args) {
auto buffer = memory_buffer();
detail::vformat_to(buffer, fmt,
basic_format_args<buffer_context<char>>(args));
fwrite_fully(buffer.data(), 1, buffer.size(), f);
detail::vformat_to(buffer, fmt, args);
fwrite_fully(buffer.data(), buffer.size(), f);
}
#endif
FMT_FUNC void print(std::FILE* f, string_view text) {
if (!write_console(f, text)) fwrite_fully(text.data(), 1, text.size(), f);
#ifdef _WIN32
int fd = _fileno(f);
if (_isatty(fd)) {
std::fflush(f);
if (write_console(fd, text)) return;
}
#endif
fwrite_fully(text.data(), text.size(), f);
}
} // namespace detail

File diff suppressed because it is too large Load Diff

@ -10,19 +10,50 @@
#include <fstream> // std::filebuf
#if defined(_WIN32) && defined(__GLIBCXX__)
# include <ext/stdio_filebuf.h>
# include <ext/stdio_sync_filebuf.h>
#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
# include <__std_stream>
#ifdef _WIN32
# ifdef __GLIBCXX__
# include <ext/stdio_filebuf.h>
# include <ext/stdio_sync_filebuf.h>
# endif
# include <io.h>
#endif
#include "format.h"
FMT_BEGIN_NAMESPACE
namespace detail {
template <typename Streambuf> class formatbuf : public Streambuf {
private:
using char_type = typename Streambuf::char_type;
using streamsize = decltype(std::declval<Streambuf>().sputn(nullptr, 0));
using int_type = typename Streambuf::int_type;
using traits_type = typename Streambuf::traits_type;
buffer<char_type>& buffer_;
public:
explicit formatbuf(buffer<char_type>& buf) : buffer_(buf) {}
protected:
// The put area is always empty. This makes the implementation simpler and has
// the advantage that the streambuf and the buffer are always in sync and
// sputc never writes into uninitialized memory. A disadvantage is that each
// call to sputc always results in a (virtual) call to overflow. There is no
// disadvantage here for sputn since this always results in a call to xsputn.
auto overflow(int_type ch) -> int_type override {
if (!traits_type::eq_int_type(ch, traits_type::eof()))
buffer_.push_back(static_cast<char_type>(ch));
return ch;
}
auto xsputn(const char_type* s, streamsize count) -> streamsize override {
buffer_.append(s, s + count);
return count;
}
};
// Generate a unique explicit instantion in every translation unit using a tag
// type in an anonymous namespace.
namespace {
@ -37,36 +68,40 @@ class file_access {
template class file_access<file_access_tag, std::filebuf,
&std::filebuf::_Myfile>;
auto get_file(std::filebuf&) -> FILE*;
#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
template class file_access<file_access_tag, std::__stdoutbuf<char>,
&std::__stdoutbuf<char>::__file_>;
auto get_file(std::__stdoutbuf<char>&) -> FILE*;
#endif
inline bool write_ostream_unicode(std::ostream& os, fmt::string_view data) {
inline auto write_ostream_unicode(std::ostream& os, fmt::string_view data)
-> bool {
FILE* f = nullptr;
#if FMT_MSC_VERSION
if (auto* buf = dynamic_cast<std::filebuf*>(os.rdbuf()))
if (FILE* f = get_file(*buf)) return write_console(f, data);
f = get_file(*buf);
else
return false;
#elif defined(_WIN32) && defined(__GLIBCXX__)
auto* rdbuf = os.rdbuf();
FILE* c_file;
if (auto* sfbuf = dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char>*>(rdbuf))
c_file = sfbuf->file();
f = sfbuf->file();
else if (auto* fbuf = dynamic_cast<__gnu_cxx::stdio_filebuf<char>*>(rdbuf))
c_file = fbuf->file();
f = fbuf->file();
else
return false;
if (c_file) return write_console(c_file, data);
#elif defined(_WIN32) && defined(_LIBCPP_VERSION)
if (auto* buf = dynamic_cast<std::__stdoutbuf<char>*>(os.rdbuf()))
if (FILE* f = get_file(*buf)) return write_console(f, data);
#else
ignore_unused(os, data);
ignore_unused(os, data, f);
#endif
#ifdef _WIN32
if (f) {
int fd = _fileno(f);
if (_isatty(fd)) {
os.flush();
return write_console(fd, data);
}
}
#endif
return false;
}
inline bool write_ostream_unicode(std::wostream&,
fmt::basic_string_view<wchar_t>) {
inline auto write_ostream_unicode(std::wostream&,
fmt::basic_string_view<wchar_t>) -> bool {
return false;
}
@ -87,18 +122,19 @@ void write_buffer(std::basic_ostream<Char>& os, buffer<Char>& buf) {
}
template <typename Char, typename T>
void format_value(buffer<Char>& buf, const T& value,
locale_ref loc = locale_ref()) {
void format_value(buffer<Char>& buf, const T& value) {
auto&& format_buf = formatbuf<std::basic_streambuf<Char>>(buf);
auto&& output = std::basic_ostream<Char>(&format_buf);
#if !defined(FMT_STATIC_THOUSANDS_SEPARATOR)
if (loc) output.imbue(loc.get<std::locale>());
output.imbue(std::locale::classic()); // The default is always unlocalized.
#endif
output << value;
output.exceptions(std::ios_base::failbit | std::ios_base::badbit);
}
template <typename T> struct streamed_view { const T& value; };
template <typename T> struct streamed_view {
const T& value;
};
} // namespace detail
@ -111,7 +147,7 @@ struct basic_ostream_formatter : formatter<basic_string_view<Char>, Char> {
auto format(const T& value, basic_format_context<OutputIt, Char>& ctx) const
-> OutputIt {
auto buffer = basic_memory_buffer<Char>();
detail::format_value(buffer, value, ctx.locale());
detail::format_value(buffer, value);
return formatter<basic_string_view<Char>, Char>::format(
{buffer.data(), buffer.size()}, ctx);
}
@ -140,7 +176,7 @@ struct formatter<detail::streamed_view<T>, Char>
\endrst
*/
template <typename T>
auto streamed(const T& value) -> detail::streamed_view<T> {
constexpr auto streamed(const T& value) -> detail::streamed_view<T> {
return {value};
}
@ -155,7 +191,7 @@ inline void vprint_directly(std::ostream& os, string_view format_str,
} // namespace detail
FMT_MODULE_EXPORT template <typename Char>
FMT_EXPORT template <typename Char>
void vprint(std::basic_ostream<Char>& os,
basic_string_view<type_identity_t<Char>> format_str,
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
@ -174,7 +210,7 @@ void vprint(std::basic_ostream<Char>& os,
fmt::print(cerr, "Don't {}!", "panic");
\endrst
*/
FMT_MODULE_EXPORT template <typename... T>
FMT_EXPORT template <typename... T>
void print(std::ostream& os, format_string<T...> fmt, T&&... args) {
const auto& vargs = fmt::make_format_args(args...);
if (detail::is_utf8())
@ -183,7 +219,7 @@ void print(std::ostream& os, format_string<T...> fmt, T&&... args) {
detail::vprint_directly(os, fmt, vargs);
}
FMT_MODULE_EXPORT
FMT_EXPORT
template <typename... Args>
void print(std::wostream& os,
basic_format_string<wchar_t, type_identity_t<Args>...> fmt,
@ -191,12 +227,12 @@ void print(std::wostream& os,
vprint(os, fmt, fmt::make_format_args<buffer_context<wchar_t>>(args...));
}
FMT_MODULE_EXPORT template <typename... T>
FMT_EXPORT template <typename... T>
void println(std::ostream& os, format_string<T...> fmt, T&&... args) {
fmt::print(os, "{}\n", fmt::format(fmt, std::forward<T>(args)...));
}
FMT_MODULE_EXPORT
FMT_EXPORT
template <typename... Args>
void println(std::wostream& os,
basic_format_string<wchar_t, type_identity_t<Args>...> fmt,

@ -1,13 +1,9 @@
// Formatting library for C++ - experimental range support
// Formatting library for C++ - range and tuple support
//
// Copyright (c) 2012 - present, Victor Zverovich
// Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors
// All rights reserved.
//
// For the license information refer to format.h.
//
// Copyright (c) 2018 - present, Remotion (Igor Schulz)
// All Rights Reserved
// {fmt} support for ranges, containers and types tuple interface.
#ifndef FMT_RANGES_H_
#define FMT_RANGES_H_
@ -187,7 +183,7 @@ template <size_t N> using make_index_sequence = std::make_index_sequence<N>;
template <typename T, T... N> struct integer_sequence {
using value_type = T;
static FMT_CONSTEXPR size_t size() { return sizeof...(N); }
static FMT_CONSTEXPR auto size() -> size_t { return sizeof...(N); }
};
template <size_t... N> using index_sequence = integer_sequence<size_t, N...>;
@ -211,15 +207,15 @@ class is_tuple_formattable_ {
};
template <typename T, typename C> class is_tuple_formattable_<T, C, true> {
template <std::size_t... Is>
static std::true_type check2(index_sequence<Is...>,
integer_sequence<bool, (Is == Is)...>);
static std::false_type check2(...);
static auto check2(index_sequence<Is...>,
integer_sequence<bool, (Is == Is)...>) -> std::true_type;
static auto check2(...) -> std::false_type;
template <std::size_t... Is>
static decltype(check2(
static auto check(index_sequence<Is...>) -> decltype(check2(
index_sequence<Is...>{},
integer_sequence<
bool, (is_formattable<typename std::tuple_element<Is, T>::type,
C>::value)...>{})) check(index_sequence<Is...>);
integer_sequence<bool,
(is_formattable<typename std::tuple_element<Is, T>::type,
C>::value)...>{}));
public:
static constexpr const bool value =
@ -421,6 +417,12 @@ struct is_formattable_delayed
#endif
} // namespace detail
template <typename...> struct conjunction : std::true_type {};
template <typename P> struct conjunction<P> : P {};
template <typename P1, typename... Pn>
struct conjunction<P1, Pn...>
: conditional_t<bool(P1::value), conjunction<Pn...>, P1> {};
template <typename T, typename Char, typename Enable = void>
struct range_formatter;
@ -486,7 +488,8 @@ struct range_formatter<
for (; it != end; ++it) {
if (i > 0) out = detail::copy_str<Char>(separator_, out);
ctx.advance_to(out);
out = underlying_.format(mapper.map(*it), ctx);
auto&& item = *it;
out = underlying_.format(mapper.map(item), ctx);
++i;
}
out = detail::copy_str<Char>(closing_bracket_, out);
@ -668,8 +671,11 @@ template <typename Container> struct all {
} // namespace detail
template <typename T, typename Char>
struct formatter<T, Char,
enable_if_t<detail::is_container_adaptor_like<T>::value>>
struct formatter<
T, Char,
enable_if_t<conjunction<detail::is_container_adaptor_like<T>,
bool_constant<range_format_kind<T, Char>::value ==
range_format::disabled>>::value>>
: formatter<detail::all<typename T::container_type>, Char> {
using all = detail::all<typename T::container_type>;
template <typename FormatContext>

@ -8,6 +8,8 @@
#ifndef FMT_STD_H_
#define FMT_STD_H_
#include <atomic>
#include <bitset>
#include <cstdlib>
#include <exception>
#include <memory>
@ -15,7 +17,9 @@
#include <type_traits>
#include <typeinfo>
#include <utility>
#include <vector>
#include "format.h"
#include "ostream.h"
#if FMT_HAS_INCLUDE(<version>)
@ -34,6 +38,10 @@
# endif
#endif
#if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<source_location>)
# include <source_location>
#endif
// GCC 4 does not support FMT_HAS_INCLUDE.
#if FMT_HAS_INCLUDE(<cxxabi.h>) || defined(__GLIBCXX__)
# include <cxxabi.h>
@ -44,67 +52,155 @@
# endif
#endif
#ifdef __cpp_lib_filesystem
// Check if typeid is available.
#ifndef FMT_USE_TYPEID
// __RTTI is for EDG compilers. In MSVC typeid is available without RTTI.
# if defined(__GXX_RTTI) || FMT_HAS_FEATURE(cxx_rtti) || FMT_MSC_VERSION || \
defined(__INTEL_RTTI__) || defined(__RTTI)
# define FMT_USE_TYPEID 1
# else
# define FMT_USE_TYPEID 0
# endif
#endif
// For older Xcode versions, __cpp_lib_xxx flags are inaccurately defined.
#ifndef FMT_CPP_LIB_FILESYSTEM
# ifdef __cpp_lib_filesystem
# define FMT_CPP_LIB_FILESYSTEM __cpp_lib_filesystem
# else
# define FMT_CPP_LIB_FILESYSTEM 0
# endif
#endif
#ifndef FMT_CPP_LIB_VARIANT
# ifdef __cpp_lib_variant
# define FMT_CPP_LIB_VARIANT __cpp_lib_variant
# else
# define FMT_CPP_LIB_VARIANT 0
# endif
#endif
#if FMT_CPP_LIB_FILESYSTEM
FMT_BEGIN_NAMESPACE
namespace detail {
template <typename Char>
void write_escaped_path(basic_memory_buffer<Char>& quoted,
const std::filesystem::path& p) {
write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>());
}
# ifdef _WIN32
template <>
inline void write_escaped_path<char>(memory_buffer& quoted,
const std::filesystem::path& p) {
auto buf = basic_memory_buffer<wchar_t>();
write_escaped_string<wchar_t>(std::back_inserter(buf), p.native());
// Convert UTF-16 to UTF-8.
if (!unicode_to_utf8<wchar_t>::convert(quoted, {buf.data(), buf.size()}))
FMT_THROW(std::runtime_error("invalid utf16"));
template <typename Char, typename PathChar>
auto get_path_string(const std::filesystem::path& p,
const std::basic_string<PathChar>& native) {
if constexpr (std::is_same_v<Char, char> && std::is_same_v<PathChar, wchar_t>)
return to_utf8<wchar_t>(native, to_utf8_error_policy::replace);
else
return p.string<Char>();
}
# endif
template <>
inline void write_escaped_path<std::filesystem::path::value_type>(
basic_memory_buffer<std::filesystem::path::value_type>& quoted,
const std::filesystem::path& p) {
write_escaped_string<std::filesystem::path::value_type>(
std::back_inserter(quoted), p.native());
template <typename Char, typename PathChar>
void write_escaped_path(basic_memory_buffer<Char>& quoted,
const std::filesystem::path& p,
const std::basic_string<PathChar>& native) {
if constexpr (std::is_same_v<Char, char> &&
std::is_same_v<PathChar, wchar_t>) {
auto buf = basic_memory_buffer<wchar_t>();
write_escaped_string<wchar_t>(std::back_inserter(buf), native);
bool valid = to_utf8<wchar_t>::convert(quoted, {buf.data(), buf.size()});
FMT_ASSERT(valid, "invalid utf16");
} else if constexpr (std::is_same_v<Char, PathChar>) {
write_escaped_string<std::filesystem::path::value_type>(
std::back_inserter(quoted), native);
} else {
write_escaped_string<Char>(std::back_inserter(quoted), p.string<Char>());
}
}
} // namespace detail
FMT_MODULE_EXPORT
template <typename Char>
struct formatter<std::filesystem::path, Char>
: formatter<basic_string_view<Char>> {
FMT_EXPORT
template <typename Char> struct formatter<std::filesystem::path, Char> {
private:
format_specs<Char> specs_;
detail::arg_ref<Char> width_ref_;
bool debug_ = false;
char path_type_ = 0;
public:
FMT_CONSTEXPR void set_debug_format(bool set = true) { debug_ = set; }
template <typename ParseContext> FMT_CONSTEXPR auto parse(ParseContext& ctx) {
auto out = formatter<basic_string_view<Char>>::parse(ctx);
this->set_debug_format(false);
return out;
auto it = ctx.begin(), end = ctx.end();
if (it == end) return it;
it = detail::parse_align(it, end, specs_);
if (it == end) return it;
it = detail::parse_dynamic_spec(it, end, specs_.width, width_ref_, ctx);
if (it != end && *it == '?') {
debug_ = true;
++it;
}
if (it != end && (*it == 'g')) path_type_ = *it++;
return it;
}
template <typename FormatContext>
auto format(const std::filesystem::path& p, FormatContext& ctx) const ->
typename FormatContext::iterator {
auto format(const std::filesystem::path& p, FormatContext& ctx) const {
auto specs = specs_;
# ifdef _WIN32
auto path_string = !path_type_ ? p.native() : p.generic_wstring();
# else
auto path_string = !path_type_ ? p.native() : p.generic_string();
# endif
detail::handle_dynamic_spec<detail::width_checker>(specs.width, width_ref_,
ctx);
if (!debug_) {
auto s = detail::get_path_string<Char>(p, path_string);
return detail::write(ctx.out(), basic_string_view<Char>(s), specs);
}
auto quoted = basic_memory_buffer<Char>();
detail::write_escaped_path(quoted, p);
return formatter<basic_string_view<Char>>::format(
basic_string_view<Char>(quoted.data(), quoted.size()), ctx);
detail::write_escaped_path(quoted, p, path_string);
return detail::write(ctx.out(),
basic_string_view<Char>(quoted.data(), quoted.size()),
specs);
}
};
FMT_END_NAMESPACE
#endif
#endif // FMT_CPP_LIB_FILESYSTEM
FMT_BEGIN_NAMESPACE
FMT_MODULE_EXPORT
FMT_EXPORT
template <std::size_t N, typename Char>
struct formatter<std::bitset<N>, Char> : nested_formatter<string_view> {
private:
// Functor because C++11 doesn't support generic lambdas.
struct writer {
const std::bitset<N>& bs;
template <typename OutputIt>
FMT_CONSTEXPR auto operator()(OutputIt out) -> OutputIt {
for (auto pos = N; pos > 0; --pos) {
out = detail::write<Char>(out, bs[pos - 1] ? Char('1') : Char('0'));
}
return out;
}
};
public:
template <typename FormatContext>
auto format(const std::bitset<N>& bs, FormatContext& ctx) const
-> decltype(ctx.out()) {
return write_padded(ctx, writer{bs});
}
};
FMT_EXPORT
template <typename Char>
struct formatter<std::thread::id, Char> : basic_ostream_formatter<Char> {};
FMT_END_NAMESPACE
#ifdef __cpp_lib_optional
FMT_BEGIN_NAMESPACE
FMT_MODULE_EXPORT
FMT_EXPORT
template <typename T, typename Char>
struct formatter<std::optional<T>, Char,
std::enable_if_t<is_formattable<T, Char>::value>> {
@ -132,7 +228,7 @@ struct formatter<std::optional<T>, Char,
}
template <typename FormatContext>
auto format(std::optional<T> const& opt, FormatContext& ctx) const
auto format(const std::optional<T>& opt, FormatContext& ctx) const
-> decltype(ctx.out()) {
if (!opt) return detail::write<Char>(ctx.out(), none);
@ -146,24 +242,33 @@ struct formatter<std::optional<T>, Char,
FMT_END_NAMESPACE
#endif // __cpp_lib_optional
#ifdef __cpp_lib_variant
#ifdef __cpp_lib_source_location
FMT_BEGIN_NAMESPACE
FMT_MODULE_EXPORT
template <typename Char> struct formatter<std::monostate, Char> {
template <typename ParseContext>
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
FMT_EXPORT
template <> struct formatter<std::source_location> {
template <typename ParseContext> FMT_CONSTEXPR auto parse(ParseContext& ctx) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const std::monostate&, FormatContext& ctx) const
auto format(const std::source_location& loc, FormatContext& ctx) const
-> decltype(ctx.out()) {
auto out = ctx.out();
out = detail::write<Char>(out, "monostate");
out = detail::write(out, loc.file_name());
out = detail::write(out, ':');
out = detail::write<char>(out, loc.line());
out = detail::write(out, ':');
out = detail::write<char>(out, loc.column());
out = detail::write(out, ": ");
out = detail::write(out, loc.function_name());
return out;
}
};
FMT_END_NAMESPACE
#endif
#if FMT_CPP_LIB_VARIANT
FMT_BEGIN_NAMESPACE
namespace detail {
template <typename T>
@ -197,6 +302,7 @@ auto write_variant_alternative(OutputIt out, const T& v) -> OutputIt {
}
} // namespace detail
template <typename T> struct is_variant_like {
static constexpr const bool value = detail::is_variant_like_<T>::value;
};
@ -206,7 +312,21 @@ template <typename T, typename C> struct is_variant_formattable {
detail::is_variant_formattable_<T, C>::value;
};
FMT_MODULE_EXPORT
FMT_EXPORT
template <typename Char> struct formatter<std::monostate, Char> {
template <typename ParseContext>
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
return ctx.begin();
}
template <typename FormatContext>
auto format(const std::monostate&, FormatContext& ctx) const
-> decltype(ctx.out()) {
return detail::write<Char>(ctx.out(), "monostate");
}
};
FMT_EXPORT
template <typename Variant, typename Char>
struct formatter<
Variant, Char,
@ -223,13 +343,14 @@ struct formatter<
auto out = ctx.out();
out = detail::write<Char>(out, "variant(");
try {
FMT_TRY {
std::visit(
[&](const auto& v) {
out = detail::write_variant_alternative<Char>(out, v);
},
value);
} catch (const std::bad_variant_access&) {
}
FMT_CATCH(const std::bad_variant_access&) {
detail::write<Char>(out, "valueless by exception");
}
*out++ = ')';
@ -237,10 +358,10 @@ struct formatter<
}
};
FMT_END_NAMESPACE
#endif // __cpp_lib_variant
#endif // FMT_CPP_LIB_VARIANT
FMT_BEGIN_NAMESPACE
FMT_MODULE_EXPORT
FMT_EXPORT
template <typename Char> struct formatter<std::error_code, Char> {
template <typename ParseContext>
FMT_CONSTEXPR auto parse(ParseContext& ctx) -> decltype(ctx.begin()) {
@ -258,10 +379,10 @@ template <typename Char> struct formatter<std::error_code, Char> {
}
};
FMT_MODULE_EXPORT
FMT_EXPORT
template <typename T, typename Char>
struct formatter<
T, Char,
T, Char, // DEPRECATED! Mixing code unit types.
typename std::enable_if<std::is_base_of<std::exception, T>::value>::type> {
private:
bool with_typename_ = false;
@ -274,7 +395,7 @@ struct formatter<
if (it == end || *it == '}') return it;
if (*it == 't') {
++it;
with_typename_ = true;
with_typename_ = FMT_USE_TYPEID != 0;
}
return it;
}
@ -287,11 +408,12 @@ struct formatter<
if (!with_typename_)
return detail::write_bytes(out, string_view(ex.what()), spec);
#if FMT_USE_TYPEID
const std::type_info& ti = typeid(ex);
#ifdef FMT_HAS_ABI_CXA_DEMANGLE
# ifdef FMT_HAS_ABI_CXA_DEMANGLE
int status = 0;
std::size_t size = 0;
std::unique_ptr<char, decltype(&std::free)> demangled_name_ptr(
std::unique_ptr<char, void (*)(void*)> demangled_name_ptr(
abi::__cxa_demangle(ti.name(), nullptr, &size, &status), &std::free);
string_view demangled_name_view;
@ -327,23 +449,89 @@ struct formatter<
demangled_name_view = string_view(ti.name());
}
out = detail::write_bytes(out, demangled_name_view, spec);
#elif FMT_MSC_VERSION
# elif FMT_MSC_VERSION
string_view demangled_name_view(ti.name());
if (demangled_name_view.starts_with("class "))
demangled_name_view.remove_prefix(6);
else if (demangled_name_view.starts_with("struct "))
demangled_name_view.remove_prefix(7);
out = detail::write_bytes(out, demangled_name_view, spec);
#else
# else
out = detail::write_bytes(out, string_view(ti.name()), spec);
# endif
*out++ = ':';
*out++ = ' ';
return detail::write_bytes(out, string_view(ex.what()), spec);
#endif
out = detail::write<Char>(out, Char(':'));
out = detail::write<Char>(out, Char(' '));
out = detail::write_bytes(out, string_view(ex.what()), spec);
}
};
return out;
namespace detail {
template <typename T, typename Enable = void>
struct has_flip : std::false_type {};
template <typename T>
struct has_flip<T, void_t<decltype(std::declval<T>().flip())>>
: std::true_type {};
template <typename T> struct is_bit_reference_like {
static constexpr const bool value =
std::is_convertible<T, bool>::value &&
std::is_nothrow_assignable<T, bool>::value && has_flip<T>::value;
};
#ifdef _LIBCPP_VERSION
// Workaround for libc++ incompatibility with C++ standard.
// According to the Standard, `bitset::operator[] const` returns bool.
template <typename C>
struct is_bit_reference_like<std::__bit_const_reference<C>> {
static constexpr const bool value = true;
};
#endif
} // namespace detail
// We can't use std::vector<bool, Allocator>::reference and
// std::bitset<N>::reference because the compiler can't deduce Allocator and N
// in partial specialization.
FMT_EXPORT
template <typename BitRef, typename Char>
struct formatter<BitRef, Char,
enable_if_t<detail::is_bit_reference_like<BitRef>::value>>
: formatter<bool, Char> {
template <typename FormatContext>
FMT_CONSTEXPR auto format(const BitRef& v, FormatContext& ctx) const
-> decltype(ctx.out()) {
return formatter<bool, Char>::format(v, ctx);
}
};
FMT_END_NAMESPACE
FMT_EXPORT
template <typename T, typename Char>
struct formatter<std::atomic<T>, Char,
enable_if_t<is_formattable<T, Char>::value>>
: formatter<T, Char> {
template <typename FormatContext>
auto format(const std::atomic<T>& v, FormatContext& ctx) const
-> decltype(ctx.out()) {
return formatter<T, Char>::format(v.load(), ctx);
}
};
#ifdef __cpp_lib_atomic_flag_test
FMT_EXPORT
template <typename Char>
struct formatter<std::atomic_flag, Char> : formatter<bool, Char> {
template <typename FormatContext>
auto format(const std::atomic_flag& v, FormatContext& ctx) const
-> decltype(ctx.out()) {
return formatter<bool, Char>::format(v.test(), ctx);
}
};
#endif // __cpp_lib_atomic_flag_test
FMT_END_NAMESPACE
#endif // FMT_STD_H_

@ -59,8 +59,8 @@
static const size_t MD5_HASH_BYTES = 16;
/** Container for storing a MD5 hash/checksum/digest. */
struct MD5Hash : std::array<byte, MD5_HASH_BYTES> {
MD5Hash() : std::array<byte, MD5_HASH_BYTES>{} {}
struct MD5Hash : std::array<uint8_t, MD5_HASH_BYTES> {
MD5Hash() : std::array<uint8_t, MD5_HASH_BYTES>{} {}
/**
* Exclusively-or the given hash into this hash.

@ -1,3 +1,13 @@
4.0.2
-----
2023/08/24
- Fixed multiple-lanes Argon2.
- Improved Poly1305 performance.
- Improved Argon2 performance.
- Makefiles no longer override standard environment variables.
4.0.1
-----
2023/03/06

@ -1,4 +1,11 @@
if (MSVC)
# Disable warning 4244 for monocypher.cpp
set_compile_flags(monocypher.cpp COMPILE_FLAGS /wd4244)
endif()
add_files(
monocypher-ed25519.cpp
monocypher-ed25519.h
monocypher.cpp
monocypher.h
monocypher.c
)

@ -5,7 +5,7 @@ Monocypher is an easy to use, easy to deploy, auditable crypto library
written in portable C. It approaches the size of [TweetNaCl][] and the
speed of [libsodium][].
[Official site.](https://monocypher.org/)
[Official site.](https://monocypher.org/)
[Official releases.](https://monocypher.org/download/)
[libsodium]: https://libsodium.org

@ -0,0 +1,500 @@
// Monocypher version 4.0.2
//
// This file is dual-licensed. Choose whichever licence you want from
// the two licences listed below.
//
// The first licence is a regular 2-clause BSD licence. The second licence
// is the CC-0 from Creative Commons. It is intended to release Monocypher
// to the public domain. The BSD licence serves as a fallback option.
//
// SPDX-License-Identifier: BSD-2-Clause OR CC0-1.0
//
// ------------------------------------------------------------------------
//
// Copyright (c) 2017-2019, Loup Vaillant
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ------------------------------------------------------------------------
//
// Written in 2017-2019 by Loup Vaillant
//
// To the extent possible under law, the author(s) have dedicated all copyright
// and related neighboring rights to this software to the public domain
// worldwide. This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along
// with this software. If not, see
// <https://creativecommons.org/publicdomain/zero/1.0/>
#include "monocypher-ed25519.h"
#ifdef MONOCYPHER_CPP_NAMESPACE
namespace MONOCYPHER_CPP_NAMESPACE {
#endif
/////////////////
/// Utilities ///
/////////////////
#define FOR(i, min, max) for (size_t i = min; i < max; i++)
#define COPY(dst, src, size) FOR(_i_, 0, size) (dst)[_i_] = (src)[_i_]
#define ZERO(buf, size) FOR(_i_, 0, size) (buf)[_i_] = 0
#define WIPE_CTX(ctx) crypto_wipe(ctx , sizeof(*(ctx)))
#define WIPE_BUFFER(buffer) crypto_wipe(buffer, sizeof(buffer))
#define MC_MIN(a, b) ((a) <= (b) ? (a) : (b))
typedef uint8_t u8;
typedef uint64_t u64;
// Returns the smallest positive integer y such that
// (x + y) % pow_2 == 0
// Basically, it's how many bytes we need to add to "align" x.
// Only works when pow_2 is a power of 2.
// Note: we use ~x+1 instead of -x to avoid compiler warnings
static size_t align(size_t x, size_t pow_2)
{
return (~x + 1) & (pow_2 - 1);
}
static u64 load64_be(const u8 s[8])
{
return((u64)s[0] << 56)
| ((u64)s[1] << 48)
| ((u64)s[2] << 40)
| ((u64)s[3] << 32)
| ((u64)s[4] << 24)
| ((u64)s[5] << 16)
| ((u64)s[6] << 8)
| (u64)s[7];
}
static void store64_be(u8 out[8], u64 in)
{
out[0] = (in >> 56) & 0xff;
out[1] = (in >> 48) & 0xff;
out[2] = (in >> 40) & 0xff;
out[3] = (in >> 32) & 0xff;
out[4] = (in >> 24) & 0xff;
out[5] = (in >> 16) & 0xff;
out[6] = (in >> 8) & 0xff;
out[7] = in & 0xff;
}
static void load64_be_buf (u64 *dst, const u8 *src, size_t size) {
FOR(i, 0, size) { dst[i] = load64_be(src + i*8); }
}
///////////////
/// SHA 512 ///
///////////////
static u64 rot(u64 x, int c ) { return (x >> c) | (x << (64 - c)); }
static u64 ch (u64 x, u64 y, u64 z) { return (x & y) ^ (~x & z); }
static u64 maj(u64 x, u64 y, u64 z) { return (x & y) ^ ( x & z) ^ (y & z); }
static u64 big_sigma0(u64 x) { return rot(x, 28) ^ rot(x, 34) ^ rot(x, 39); }
static u64 big_sigma1(u64 x) { return rot(x, 14) ^ rot(x, 18) ^ rot(x, 41); }
static u64 lit_sigma0(u64 x) { return rot(x, 1) ^ rot(x, 8) ^ (x >> 7); }
static u64 lit_sigma1(u64 x) { return rot(x, 19) ^ rot(x, 61) ^ (x >> 6); }
static const u64 K[80] = {
0x428a2f98d728ae22,0x7137449123ef65cd,0xb5c0fbcfec4d3b2f,0xe9b5dba58189dbbc,
0x3956c25bf348b538,0x59f111f1b605d019,0x923f82a4af194f9b,0xab1c5ed5da6d8118,
0xd807aa98a3030242,0x12835b0145706fbe,0x243185be4ee4b28c,0x550c7dc3d5ffb4e2,
0x72be5d74f27b896f,0x80deb1fe3b1696b1,0x9bdc06a725c71235,0xc19bf174cf692694,
0xe49b69c19ef14ad2,0xefbe4786384f25e3,0x0fc19dc68b8cd5b5,0x240ca1cc77ac9c65,
0x2de92c6f592b0275,0x4a7484aa6ea6e483,0x5cb0a9dcbd41fbd4,0x76f988da831153b5,
0x983e5152ee66dfab,0xa831c66d2db43210,0xb00327c898fb213f,0xbf597fc7beef0ee4,
0xc6e00bf33da88fc2,0xd5a79147930aa725,0x06ca6351e003826f,0x142929670a0e6e70,
0x27b70a8546d22ffc,0x2e1b21385c26c926,0x4d2c6dfc5ac42aed,0x53380d139d95b3df,
0x650a73548baf63de,0x766a0abb3c77b2a8,0x81c2c92e47edaee6,0x92722c851482353b,
0xa2bfe8a14cf10364,0xa81a664bbc423001,0xc24b8b70d0f89791,0xc76c51a30654be30,
0xd192e819d6ef5218,0xd69906245565a910,0xf40e35855771202a,0x106aa07032bbd1b8,
0x19a4c116b8d2d0c8,0x1e376c085141ab53,0x2748774cdf8eeb99,0x34b0bcb5e19b48a8,
0x391c0cb3c5c95a63,0x4ed8aa4ae3418acb,0x5b9cca4f7763e373,0x682e6ff3d6b2b8a3,
0x748f82ee5defb2fc,0x78a5636f43172f60,0x84c87814a1f0ab72,0x8cc702081a6439ec,
0x90befffa23631e28,0xa4506cebde82bde9,0xbef9a3f7b2c67915,0xc67178f2e372532b,
0xca273eceea26619c,0xd186b8c721c0c207,0xeada7dd6cde0eb1e,0xf57d4f7fee6ed178,
0x06f067aa72176fba,0x0a637dc5a2c898a6,0x113f9804bef90dae,0x1b710b35131c471b,
0x28db77f523047d84,0x32caab7b40c72493,0x3c9ebe0a15c9bebc,0x431d67c49c100d4c,
0x4cc5d4becb3e42b6,0x597f299cfc657e2a,0x5fcb6fab3ad6faec,0x6c44198c4a475817
};
static void sha512_compress(crypto_sha512_ctx *ctx)
{
u64 a = ctx->hash[0]; u64 b = ctx->hash[1];
u64 c = ctx->hash[2]; u64 d = ctx->hash[3];
u64 e = ctx->hash[4]; u64 f = ctx->hash[5];
u64 g = ctx->hash[6]; u64 h = ctx->hash[7];
FOR (j, 0, 16) {
u64 in = K[j] + ctx->input[j];
u64 t1 = big_sigma1(e) + ch (e, f, g) + h + in;
u64 t2 = big_sigma0(a) + maj(a, b, c);
h = g; g = f; f = e; e = d + t1;
d = c; c = b; b = a; a = t1 + t2;
}
size_t i16 = 0;
FOR(i, 1, 5) {
i16 += 16;
FOR (j, 0, 16) {
ctx->input[j] += lit_sigma1(ctx->input[(j- 2) & 15]);
ctx->input[j] += lit_sigma0(ctx->input[(j-15) & 15]);
ctx->input[j] += ctx->input[(j- 7) & 15];
u64 in = K[i16 + j] + ctx->input[j];
u64 t1 = big_sigma1(e) + ch (e, f, g) + h + in;
u64 t2 = big_sigma0(a) + maj(a, b, c);
h = g; g = f; f = e; e = d + t1;
d = c; c = b; b = a; a = t1 + t2;
}
}
ctx->hash[0] += a; ctx->hash[1] += b;
ctx->hash[2] += c; ctx->hash[3] += d;
ctx->hash[4] += e; ctx->hash[5] += f;
ctx->hash[6] += g; ctx->hash[7] += h;
}
// Write 1 input byte
static void sha512_set_input(crypto_sha512_ctx *ctx, u8 input)
{
size_t word = ctx->input_idx >> 3;
size_t byte = ctx->input_idx & 7;
ctx->input[word] |= (u64)input << (8 * (7 - byte));
}
// Increment a 128-bit "word".
static void sha512_incr(u64 x[2], u64 y)
{
x[1] += y;
if (x[1] < y) {
x[0]++;
}
}
void crypto_sha512_init(crypto_sha512_ctx *ctx)
{
ctx->hash[0] = 0x6a09e667f3bcc908;
ctx->hash[1] = 0xbb67ae8584caa73b;
ctx->hash[2] = 0x3c6ef372fe94f82b;
ctx->hash[3] = 0xa54ff53a5f1d36f1;
ctx->hash[4] = 0x510e527fade682d1;
ctx->hash[5] = 0x9b05688c2b3e6c1f;
ctx->hash[6] = 0x1f83d9abfb41bd6b;
ctx->hash[7] = 0x5be0cd19137e2179;
ctx->input_size[0] = 0;
ctx->input_size[1] = 0;
ctx->input_idx = 0;
ZERO(ctx->input, 16);
}
void crypto_sha512_update(crypto_sha512_ctx *ctx,
const u8 *message, size_t message_size)
{
// Avoid undefined NULL pointer increments with empty messages
if (message_size == 0) {
return;
}
// Align ourselves with word boundaries
if ((ctx->input_idx & 7) != 0) {
size_t nb_bytes = MC_MIN(align(ctx->input_idx, 8), message_size);
FOR (i, 0, nb_bytes) {
sha512_set_input(ctx, message[i]);
ctx->input_idx++;
}
message += nb_bytes;
message_size -= nb_bytes;
}
// Align ourselves with block boundaries
if ((ctx->input_idx & 127) != 0) {
size_t nb_words = MC_MIN(align(ctx->input_idx, 128), message_size) >> 3;
load64_be_buf(ctx->input + (ctx->input_idx >> 3), message, nb_words);
ctx->input_idx += nb_words << 3;
message += nb_words << 3;
message_size -= nb_words << 3;
}
// Compress block if needed
if (ctx->input_idx == 128) {
sha512_incr(ctx->input_size, 1024); // size is in bits
sha512_compress(ctx);
ctx->input_idx = 0;
ZERO(ctx->input, 16);
}
// Process the message block by block
FOR (i, 0, message_size >> 7) { // number of blocks
load64_be_buf(ctx->input, message, 16);
sha512_incr(ctx->input_size, 1024); // size is in bits
sha512_compress(ctx);
ctx->input_idx = 0;
ZERO(ctx->input, 16);
message += 128;
}
message_size &= 127;
if (message_size != 0) {
// Remaining words
size_t nb_words = message_size >> 3;
load64_be_buf(ctx->input, message, nb_words);
ctx->input_idx += nb_words << 3;
message += nb_words << 3;
message_size -= nb_words << 3;
// Remaining bytes
FOR (i, 0, message_size) {
sha512_set_input(ctx, message[i]);
ctx->input_idx++;
}
}
}
void crypto_sha512_final(crypto_sha512_ctx *ctx, u8 hash[64])
{
// Add padding bit
if (ctx->input_idx == 0) {
ZERO(ctx->input, 16);
}
sha512_set_input(ctx, 128);
// Update size
sha512_incr(ctx->input_size, ctx->input_idx * 8);
// Compress penultimate block (if any)
if (ctx->input_idx > 111) {
sha512_compress(ctx);
ZERO(ctx->input, 14);
}
// Compress last block
ctx->input[14] = ctx->input_size[0];
ctx->input[15] = ctx->input_size[1];
sha512_compress(ctx);
// Copy hash to output (big endian)
FOR (i, 0, 8) {
store64_be(hash + i*8, ctx->hash[i]);
}
WIPE_CTX(ctx);
}
void crypto_sha512(u8 hash[64], const u8 *message, size_t message_size)
{
crypto_sha512_ctx ctx;
crypto_sha512_init (&ctx);
crypto_sha512_update(&ctx, message, message_size);
crypto_sha512_final (&ctx, hash);
}
////////////////////
/// HMAC SHA 512 ///
////////////////////
void crypto_sha512_hmac_init(crypto_sha512_hmac_ctx *ctx,
const u8 *key, size_t key_size)
{
// hash key if it is too long
if (key_size > 128) {
crypto_sha512(ctx->key, key, key_size);
key = ctx->key;
key_size = 64;
}
// Compute inner key: padded key XOR 0x36
FOR (i, 0, key_size) { ctx->key[i] = key[i] ^ 0x36; }
FOR (i, key_size, 128) { ctx->key[i] = 0x36; }
// Start computing inner hash
crypto_sha512_init (&ctx->ctx);
crypto_sha512_update(&ctx->ctx, ctx->key, 128);
}
void crypto_sha512_hmac_update(crypto_sha512_hmac_ctx *ctx,
const u8 *message, size_t message_size)
{
crypto_sha512_update(&ctx->ctx, message, message_size);
}
void crypto_sha512_hmac_final(crypto_sha512_hmac_ctx *ctx, u8 hmac[64])
{
// Finish computing inner hash
crypto_sha512_final(&ctx->ctx, hmac);
// Compute outer key: padded key XOR 0x5c
FOR (i, 0, 128) {
ctx->key[i] ^= 0x36 ^ 0x5c;
}
// Compute outer hash
crypto_sha512_init (&ctx->ctx);
crypto_sha512_update(&ctx->ctx, ctx->key , 128);
crypto_sha512_update(&ctx->ctx, hmac, 64);
crypto_sha512_final (&ctx->ctx, hmac); // outer hash
WIPE_CTX(ctx);
}
void crypto_sha512_hmac(u8 hmac[64], const u8 *key, size_t key_size,
const u8 *message, size_t message_size)
{
crypto_sha512_hmac_ctx ctx;
crypto_sha512_hmac_init (&ctx, key, key_size);
crypto_sha512_hmac_update(&ctx, message, message_size);
crypto_sha512_hmac_final (&ctx, hmac);
}
////////////////////
/// HKDF SHA 512 ///
////////////////////
void crypto_sha512_hkdf_expand(u8 *okm, size_t okm_size,
const u8 *prk, size_t prk_size,
const u8 *info, size_t info_size)
{
int not_first = 0;
u8 ctr = 1;
u8 blk[64];
while (okm_size > 0) {
size_t out_size = MC_MIN(okm_size, sizeof(blk));
crypto_sha512_hmac_ctx ctx;
crypto_sha512_hmac_init(&ctx, prk , prk_size);
if (not_first) {
// For some reason HKDF uses some kind of CBC mode.
// For some reason CTR mode alone wasn't enough.
// Like what, they didn't trust HMAC in 2010? Really??
crypto_sha512_hmac_update(&ctx, blk , sizeof(blk));
}
crypto_sha512_hmac_update(&ctx, info, info_size);
crypto_sha512_hmac_update(&ctx, &ctr, 1);
crypto_sha512_hmac_final(&ctx, blk);
COPY(okm, blk, out_size);
not_first = 1;
okm += out_size;
okm_size -= out_size;
ctr++;
}
}
void crypto_sha512_hkdf(u8 *okm , size_t okm_size,
const u8 *ikm , size_t ikm_size,
const u8 *salt, size_t salt_size,
const u8 *info, size_t info_size)
{
// Extract
u8 prk[64];
crypto_sha512_hmac(prk, salt, salt_size, ikm, ikm_size);
// Expand
crypto_sha512_hkdf_expand(okm, okm_size, prk, sizeof(prk), info, info_size);
}
///////////////
/// Ed25519 ///
///////////////
void crypto_ed25519_key_pair(u8 secret_key[64], u8 public_key[32], u8 seed[32])
{
u8 a[64];
COPY(a, seed, 32); // a[ 0..31] = seed
crypto_wipe(seed, 32);
COPY(secret_key, a, 32); // secret key = seed
crypto_sha512(a, a, 32); // a[ 0..31] = scalar
crypto_eddsa_trim_scalar(a, a); // a[ 0..31] = trimmed scalar
crypto_eddsa_scalarbase(public_key, a); // public key = [trimmed scalar]B
COPY(secret_key + 32, public_key, 32); // secret key includes public half
WIPE_BUFFER(a);
}
static void hash_reduce(u8 h[32],
const u8 *a, size_t a_size,
const u8 *b, size_t b_size,
const u8 *c, size_t c_size,
const u8 *d, size_t d_size)
{
u8 hash[64];
crypto_sha512_ctx ctx;
crypto_sha512_init (&ctx);
crypto_sha512_update(&ctx, a, a_size);
crypto_sha512_update(&ctx, b, b_size);
crypto_sha512_update(&ctx, c, c_size);
crypto_sha512_update(&ctx, d, d_size);
crypto_sha512_final (&ctx, hash);
crypto_eddsa_reduce(h, hash);
}
static void ed25519_dom_sign(u8 signature [64], const u8 secret_key[32],
const u8 *dom, size_t dom_size,
const u8 *message, size_t message_size)
{
u8 a[64]; // secret scalar and prefix
u8 r[32]; // secret deterministic "random" nonce
u8 h[32]; // publically verifiable hash of the message (not wiped)
u8 R[32]; // first half of the signature (allows overlapping inputs)
const u8 *pk = secret_key + 32;
crypto_sha512(a, secret_key, 32);
crypto_eddsa_trim_scalar(a, a);
hash_reduce(r, dom, dom_size, a + 32, 32, message, message_size, 0, 0);
crypto_eddsa_scalarbase(R, r);
hash_reduce(h, dom, dom_size, R, 32, pk, 32, message, message_size);
COPY(signature, R, 32);
crypto_eddsa_mul_add(signature + 32, h, a, r);
WIPE_BUFFER(a);
WIPE_BUFFER(r);
}
void crypto_ed25519_sign(u8 signature [64], const u8 secret_key[64],
const u8 *message, size_t message_size)
{
ed25519_dom_sign(signature, secret_key, 0, 0, message, message_size);
}
int crypto_ed25519_check(const u8 signature[64], const u8 public_key[32],
const u8 *msg, size_t msg_size)
{
u8 h_ram[32];
hash_reduce(h_ram, signature, 32, public_key, 32, msg, msg_size, 0, 0);
return crypto_eddsa_check_equation(signature, public_key, h_ram);
}
static const u8 domain[34] = "SigEd25519 no Ed25519 collisions\1";
void crypto_ed25519_ph_sign(uint8_t signature[64], const uint8_t secret_key[64],
const uint8_t message_hash[64])
{
ed25519_dom_sign(signature, secret_key, domain, sizeof(domain),
message_hash, 64);
}
int crypto_ed25519_ph_check(const uint8_t sig[64], const uint8_t pk[32],
const uint8_t msg_hash[64])
{
u8 h_ram[32];
hash_reduce(h_ram, domain, sizeof(domain), sig, 32, pk, 32, msg_hash, 64);
return crypto_eddsa_check_equation(sig, pk, h_ram);
}
#ifdef MONOCYPHER_CPP_NAMESPACE
}
#endif

@ -0,0 +1,140 @@
// Monocypher version 4.0.2
//
// This file is dual-licensed. Choose whichever licence you want from
// the two licences listed below.
//
// The first licence is a regular 2-clause BSD licence. The second licence
// is the CC-0 from Creative Commons. It is intended to release Monocypher
// to the public domain. The BSD licence serves as a fallback option.
//
// SPDX-License-Identifier: BSD-2-Clause OR CC0-1.0
//
// ------------------------------------------------------------------------
//
// Copyright (c) 2017-2019, Loup Vaillant
// All rights reserved.
//
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// ------------------------------------------------------------------------
//
// Written in 2017-2019 by Loup Vaillant
//
// To the extent possible under law, the author(s) have dedicated all copyright
// and related neighboring rights to this software to the public domain
// worldwide. This software is distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along
// with this software. If not, see
// <https://creativecommons.org/publicdomain/zero/1.0/>
#ifndef ED25519_H
#define ED25519_H
#include "monocypher.h"
#ifdef MONOCYPHER_CPP_NAMESPACE
namespace MONOCYPHER_CPP_NAMESPACE {
#elif defined(__cplusplus)
extern "C" {
#endif
////////////////////////
/// Type definitions ///
////////////////////////
// Do not rely on the size or content on any of those types,
// they may change without notice.
typedef struct {
uint64_t hash[8];
uint64_t input[16];
uint64_t input_size[2];
size_t input_idx;
} crypto_sha512_ctx;
typedef struct {
uint8_t key[128];
crypto_sha512_ctx ctx;
} crypto_sha512_hmac_ctx;
// SHA 512
// -------
void crypto_sha512_init (crypto_sha512_ctx *ctx);
void crypto_sha512_update(crypto_sha512_ctx *ctx,
const uint8_t *message, size_t message_size);
void crypto_sha512_final (crypto_sha512_ctx *ctx, uint8_t hash[64]);
void crypto_sha512(uint8_t hash[64],
const uint8_t *message, size_t message_size);
// SHA 512 HMAC
// ------------
void crypto_sha512_hmac_init(crypto_sha512_hmac_ctx *ctx,
const uint8_t *key, size_t key_size);
void crypto_sha512_hmac_update(crypto_sha512_hmac_ctx *ctx,
const uint8_t *message, size_t message_size);
void crypto_sha512_hmac_final(crypto_sha512_hmac_ctx *ctx, uint8_t hmac[64]);
void crypto_sha512_hmac(uint8_t hmac[64],
const uint8_t *key , size_t key_size,
const uint8_t *message, size_t message_size);
// SHA 512 HKDF
// ------------
void crypto_sha512_hkdf_expand(uint8_t *okm, size_t okm_size,
const uint8_t *prk, size_t prk_size,
const uint8_t *info, size_t info_size);
void crypto_sha512_hkdf(uint8_t *okm , size_t okm_size,
const uint8_t *ikm , size_t ikm_size,
const uint8_t *salt, size_t salt_size,
const uint8_t *info, size_t info_size);
// Ed25519
// -------
// Signatures (EdDSA with curve25519 + SHA-512)
// --------------------------------------------
void crypto_ed25519_key_pair(uint8_t secret_key[64],
uint8_t public_key[32],
uint8_t seed[32]);
void crypto_ed25519_sign(uint8_t signature [64],
const uint8_t secret_key[64],
const uint8_t *message, size_t message_size);
int crypto_ed25519_check(const uint8_t signature [64],
const uint8_t public_key[32],
const uint8_t *message, size_t message_size);
// Pre-hash variants
void crypto_ed25519_ph_sign(uint8_t signature [64],
const uint8_t secret_key [64],
const uint8_t message_hash[64]);
int crypto_ed25519_ph_check(const uint8_t signature [64],
const uint8_t public_key [32],
const uint8_t message_hash[64]);
#ifdef __cplusplus
}
#endif
#endif // ED25519_H

@ -1,4 +1,4 @@
// Monocypher version 4.0.1
// Monocypher version 4.0.2
//
// This file is dual-licensed. Choose whichever licence you want from
// the two licences listed below.
@ -66,8 +66,8 @@ namespace MONOCYPHER_CPP_NAMESPACE {
#define ZERO(buf, size) FOR(_i_, 0, size) (buf)[_i_] = 0
#define WIPE_CTX(ctx) crypto_wipe(ctx , sizeof(*(ctx)))
#define WIPE_BUFFER(buffer) crypto_wipe(buffer, sizeof(buffer))
#define MIN(a, b) ((a) <= (b) ? (a) : (b))
#define MAX(a, b) ((a) >= (b) ? (a) : (b))
#define MC_MIN(a, b) ((a) <= (b) ? (a) : (b))
#define MC_MAX(a, b) ((a) >= (b) ? (a) : (b))
typedef int8_t i8;
typedef uint8_t u8;
@ -81,10 +81,10 @@ static const u8 zero[128] = {0};
// returns the smallest positive integer y such that
// (x + y) % pow_2 == 0
// Basically, it's how many bytes we need to add to "align" x.
// Basically, y is the "gap" missing to align x.
// Only works when pow_2 is a power of 2.
// Note: we use ~x+1 instead of -x to avoid compiler warnings
static size_t align(size_t x, size_t pow_2)
static size_t gap(size_t x, size_t pow_2)
{
return (~x + 1) & (pow_2 - 1);
}
@ -307,74 +307,60 @@ u64 crypto_chacha20_x(u8 *cipher_text, const u8 *plain_text,
// end <= 1
// Postcondition:
// ctx->h <= 4_ffffffff_ffffffff_ffffffff_ffffffff
static void poly_block(crypto_poly1305_ctx *ctx, const u8 in[16], unsigned end)
{
u32 s[4];
load32_le_buf(s, in, 4);
//- PROOF Poly1305
//-
//- # Inputs & preconditions
//- ctx->h[0] = u32()
//- ctx->h[1] = u32()
//- ctx->h[2] = u32()
//- ctx->h[3] = u32()
//- ctx->h[4] = u32(limit = 4)
//-
//- ctx->r[0] = u32(limit = 0x0fffffff)
//- ctx->r[1] = u32(limit = 0x0ffffffc)
//- ctx->r[2] = u32(limit = 0x0ffffffc)
//- ctx->r[3] = u32(limit = 0x0ffffffc)
//-
//- s[0] = u32()
//- s[1] = u32()
//- s[2] = u32()
//- s[3] = u32()
//-
//- end = unsigned(limit = 1)
// s = h + c, without carry propagation
const u64 s0 = ctx->h[0] + (u64)s[0]; // s0 <= 1_fffffffe
const u64 s1 = ctx->h[1] + (u64)s[1]; // s1 <= 1_fffffffe
const u64 s2 = ctx->h[2] + (u64)s[2]; // s2 <= 1_fffffffe
const u64 s3 = ctx->h[3] + (u64)s[3]; // s3 <= 1_fffffffe
const u32 s4 = ctx->h[4] + end; // s4 <= 5
static void poly_blocks(crypto_poly1305_ctx *ctx, const u8 *in,
size_t nb_blocks, unsigned end)
{
// Local all the things!
const u32 r0 = ctx->r[0]; // r0 <= 0fffffff
const u32 r1 = ctx->r[1]; // r1 <= 0ffffffc
const u32 r2 = ctx->r[2]; // r2 <= 0ffffffc
const u32 r3 = ctx->r[3]; // r3 <= 0ffffffc
const u32 rr0 = (r0 >> 2) * 5; // rr0 <= 13fffffb // lose 2 bits...
const u32 rr1 = (r1 >> 2) + r1; // rr1 <= 13fffffb // rr1 == (r1 >> 2) * 5
const u32 rr2 = (r2 >> 2) + r2; // rr2 <= 13fffffb // rr1 == (r2 >> 2) * 5
const u32 rr3 = (r3 >> 2) + r3; // rr3 <= 13fffffb // rr1 == (r3 >> 2) * 5
// (h + c) * r, without carry propagation
const u64 x0 = s0*r0+ s1*rr3+ s2*rr2+ s3*rr1+ s4*rr0; // <= 97ffffe007fffff8
const u64 x1 = s0*r1+ s1*r0 + s2*rr3+ s3*rr2+ s4*rr1; // <= 8fffffe20ffffff6
const u64 x2 = s0*r2+ s1*r1 + s2*r0 + s3*rr3+ s4*rr2; // <= 87ffffe417fffff4
const u64 x3 = s0*r3+ s1*r2 + s2*r1 + s3*r0 + s4*rr3; // <= 7fffffe61ffffff2
const u32 x4 = s4 * (r0 & 3); // ...recover 2 bits // <= f
// partial reduction modulo 2^130 - 5
const u32 u5 = x4 + (x3 >> 32); // u5 <= 7ffffff5
const u64 u0 = (u5 >> 2) * 5 + (x0 & 0xffffffff);
const u64 u1 = (u0 >> 32) + (x1 & 0xffffffff) + (x0 >> 32);
const u64 u2 = (u1 >> 32) + (x2 & 0xffffffff) + (x1 >> 32);
const u64 u3 = (u2 >> 32) + (x3 & 0xffffffff) + (x2 >> 32);
const u64 u4 = (u3 >> 32) + (u5 & 3);
// Update the hash
ctx->h[0] = u0 & 0xffffffff; // u0 <= 1_9ffffff0
ctx->h[1] = u1 & 0xffffffff; // u1 <= 1_97ffffe0
ctx->h[2] = u2 & 0xffffffff; // u2 <= 1_8fffffe2
ctx->h[3] = u3 & 0xffffffff; // u3 <= 1_87ffffe4
ctx->h[4] = u4 & 0xffffffff; // u4 <= 4
//- # postconditions
//- ASSERT(ctx->h[4].limit() <= 4)
//- CQFD Poly1305
const u32 r0 = ctx->r[0];
const u32 r1 = ctx->r[1];
const u32 r2 = ctx->r[2];
const u32 r3 = ctx->r[3];
const u32 rr0 = (r0 >> 2) * 5; // lose 2 bits...
const u32 rr1 = (r1 >> 2) + r1; // rr1 == (r1 >> 2) * 5
const u32 rr2 = (r2 >> 2) + r2; // rr1 == (r2 >> 2) * 5
const u32 rr3 = (r3 >> 2) + r3; // rr1 == (r3 >> 2) * 5
const u32 rr4 = r0 & 3; // ...recover 2 bits
u32 h0 = ctx->h[0];
u32 h1 = ctx->h[1];
u32 h2 = ctx->h[2];
u32 h3 = ctx->h[3];
u32 h4 = ctx->h[4];
FOR (i, 0, nb_blocks) {
// h + c, without carry propagation
const u64 s0 = (u64)h0 + load32_le(in); in += 4;
const u64 s1 = (u64)h1 + load32_le(in); in += 4;
const u64 s2 = (u64)h2 + load32_le(in); in += 4;
const u64 s3 = (u64)h3 + load32_le(in); in += 4;
const u32 s4 = h4 + end;
// (h + c) * r, without carry propagation
const u64 x0 = s0*r0+ s1*rr3+ s2*rr2+ s3*rr1+ s4*rr0;
const u64 x1 = s0*r1+ s1*r0 + s2*rr3+ s3*rr2+ s4*rr1;
const u64 x2 = s0*r2+ s1*r1 + s2*r0 + s3*rr3+ s4*rr2;
const u64 x3 = s0*r3+ s1*r2 + s2*r1 + s3*r0 + s4*rr3;
const u32 x4 = s4*rr4;
// partial reduction modulo 2^130 - 5
const u32 u5 = x4 + (x3 >> 32); // u5 <= 7ffffff5
const u64 u0 = (u5 >> 2) * 5 + (x0 & 0xffffffff);
const u64 u1 = (u0 >> 32) + (x1 & 0xffffffff) + (x0 >> 32);
const u64 u2 = (u1 >> 32) + (x2 & 0xffffffff) + (x1 >> 32);
const u64 u3 = (u2 >> 32) + (x3 & 0xffffffff) + (x2 >> 32);
const u32 u4 = (u3 >> 32) + (u5 & 3); // u4 <= 4
// Update the hash
h0 = u0 & 0xffffffff;
h1 = u1 & 0xffffffff;
h2 = u2 & 0xffffffff;
h3 = u3 & 0xffffffff;
h4 = u4;
}
ctx->h[0] = h0;
ctx->h[1] = h1;
ctx->h[2] = h2;
ctx->h[3] = h3;
ctx->h[4] = h4;
}
void crypto_poly1305_init(crypto_poly1305_ctx *ctx, const u8 key[32])
@ -391,8 +377,13 @@ void crypto_poly1305_init(crypto_poly1305_ctx *ctx, const u8 key[32])
void crypto_poly1305_update(crypto_poly1305_ctx *ctx,
const u8 *message, size_t message_size)
{
// Avoid undefined NULL pointer increments with empty messages
if (message_size == 0) {
return;
}
// Align ourselves with block boundaries
size_t aligned = MIN(align(ctx->c_idx, 16), message_size);
size_t aligned = MC_MIN(gap(ctx->c_idx, 16), message_size);
FOR (i, 0, aligned) {
ctx->c[ctx->c_idx] = *message;
ctx->c_idx++;
@ -402,16 +393,14 @@ void crypto_poly1305_update(crypto_poly1305_ctx *ctx,
// If block is complete, process it
if (ctx->c_idx == 16) {
poly_block(ctx, ctx->c, 1);
poly_blocks(ctx, ctx->c, 1, 1);
ctx->c_idx = 0;
}
// Process the message block by block
size_t nb_blocks = message_size >> 4;
FOR (i, 0, nb_blocks) {
poly_block(ctx, message, 1);
message += 16;
}
poly_blocks(ctx, message, nb_blocks, 1);
message += nb_blocks << 4;
message_size &= 15;
// remaining bytes (we never complete a block here)
@ -429,7 +418,7 @@ void crypto_poly1305_final(crypto_poly1305_ctx *ctx, u8 mac[16])
if (ctx->c_idx != 0) {
ZERO(ctx->c + ctx->c_idx, 16 - ctx->c_idx);
ctx->c[ctx->c_idx] = 1;
poly_block(ctx, ctx->c, 0);
poly_blocks(ctx, ctx->c, 1, 0);
}
// check if we should subtract 2^130-5 by performing the
@ -576,7 +565,7 @@ void crypto_blake2b_update(crypto_blake2b_ctx *ctx,
// Align with word boundaries
if ((ctx->input_idx & 7) != 0) {
size_t nb_bytes = MIN(align(ctx->input_idx, 8), message_size);
size_t nb_bytes = MC_MIN(gap(ctx->input_idx, 8), message_size);
size_t word = ctx->input_idx >> 3;
size_t byte = ctx->input_idx & 7;
FOR (i, 0, nb_bytes) {
@ -589,7 +578,7 @@ void crypto_blake2b_update(crypto_blake2b_ctx *ctx,
// Align with block boundaries (faster than byte by byte)
if ((ctx->input_idx & 127) != 0) {
size_t nb_words = MIN(align(ctx->input_idx, 128), message_size) >> 3;
size_t nb_words = MC_MIN(gap(ctx->input_idx, 128), message_size) >> 3;
load64_le_buf(ctx->input + (ctx->input_idx >> 3), message, nb_words);
ctx->input_idx += nb_words << 3;
message += nb_words << 3;
@ -637,7 +626,7 @@ void crypto_blake2b_update(crypto_blake2b_ctx *ctx,
void crypto_blake2b_final(crypto_blake2b_ctx *ctx, u8 *hash)
{
blake2b_compress(ctx, 1); // compress the last block
size_t hash_size = MIN(ctx->hash_size, 64);
size_t hash_size = MC_MIN(ctx->hash_size, 64);
size_t nb_words = hash_size >> 3;
store64_le_buf(hash, ctx->hash, nb_words);
FOR (i, nb_words << 3, hash_size) {
@ -698,7 +687,7 @@ static void extended_hash(u8 *digest, u32 digest_size,
const u8 *input , u32 input_size)
{
crypto_blake2b_ctx ctx;
crypto_blake2b_init (&ctx, MIN(digest_size, 64));
crypto_blake2b_init (&ctx, MC_MIN(digest_size, 64));
blake_update_32 (&ctx, digest_size);
crypto_blake2b_update(&ctx, input, input_size);
crypto_blake2b_final (&ctx, digest);
@ -721,12 +710,12 @@ static void extended_hash(u8 *digest, u32 digest_size,
}
}
#define LSB(x) ((x) & 0xffffffff)
#define LSB(x) ((u64)(u32)x)
#define G(a, b, c, d) \
a += b + 2 * LSB(a) * LSB(b); d ^= a; d = rotr64(d, 32); \
c += d + 2 * LSB(c) * LSB(d); b ^= c; b = rotr64(b, 24); \
a += b + 2 * LSB(a) * LSB(b); d ^= a; d = rotr64(d, 16); \
c += d + 2 * LSB(c) * LSB(d); b ^= c; b = rotr64(b, 63)
a += b + ((LSB(a) * LSB(b)) << 1); d ^= a; d = rotr64(d, 32); \
c += d + ((LSB(c) * LSB(d)) << 1); b ^= c; b = rotr64(b, 24); \
a += b + ((LSB(a) * LSB(b)) << 1); d ^= a; d = rotr64(d, 16); \
c += d + ((LSB(c) * LSB(d)) << 1); b ^= c; b = rotr64(b, 63)
#define ROUND(v0, v1, v2, v3, v4, v5, v6, v7, \
v8, v9, v10, v11, v12, v13, v14, v15) \
G(v0, v4, v8, v12); G(v1, v5, v9, v13); \
@ -874,16 +863,22 @@ void crypto_argon2(u8 *hash, u32 hash_size, void *work_area,
u32 next_slice = ((slice + 1) % 4) * segment_size;
u32 window_start = pass == 0 ? 0 : next_slice;
u32 nb_segments = pass == 0 ? slice : 3;
u32 window_size = nb_segments * segment_size + block - 1;
u64 lane =
pass == 0 && slice == 0
? segment
: (index_seed >> 32) % config.nb_lanes;
u32 window_size =
nb_segments * segment_size +
(lane == segment ? block-1 :
block == 0 ? (u32)-1 : 0);
// Find reference block
u64 j1 = index_seed & 0xffffffff; // block selector
u64 j2 = index_seed >> 32; // lane selector
u64 x = (j1 * j1) >> 32;
u64 y = (window_size * x) >> 32;
u64 z = (window_size - 1) - y;
u64 ref = (window_start + z) % lane_size;
u32 index = (j2%config.nb_lanes)*lane_size + (u32)ref;
u32 index = lane * lane_size + (u32)ref;
blk *reference = blocks + index;
// Shuffle the previous & reference block
@ -1244,25 +1239,25 @@ static void fe_mul(fe h, const fe f, const fe g)
// |G1|, |G3|, |G5|, |G7|, |G9| < 2^30
i64 t0 = f0*(i64)g0 + F1*(i64)G9 + f2*(i64)G8 + F3*(i64)G7 + f4*(i64)G6
+ F5*(i64)G5 + f6*(i64)G4 + F7*(i64)G3 + f8*(i64)G2 + F9*(i64)G1;
+ F5*(i64)G5 + f6*(i64)G4 + F7*(i64)G3 + f8*(i64)G2 + F9*(i64)G1;
i64 t1 = f0*(i64)g1 + f1*(i64)g0 + f2*(i64)G9 + f3*(i64)G8 + f4*(i64)G7
+ f5*(i64)G6 + f6*(i64)G5 + f7*(i64)G4 + f8*(i64)G3 + f9*(i64)G2;
+ f5*(i64)G6 + f6*(i64)G5 + f7*(i64)G4 + f8*(i64)G3 + f9*(i64)G2;
i64 t2 = f0*(i64)g2 + F1*(i64)g1 + f2*(i64)g0 + F3*(i64)G9 + f4*(i64)G8
+ F5*(i64)G7 + f6*(i64)G6 + F7*(i64)G5 + f8*(i64)G4 + F9*(i64)G3;
+ F5*(i64)G7 + f6*(i64)G6 + F7*(i64)G5 + f8*(i64)G4 + F9*(i64)G3;
i64 t3 = f0*(i64)g3 + f1*(i64)g2 + f2*(i64)g1 + f3*(i64)g0 + f4*(i64)G9
+ f5*(i64)G8 + f6*(i64)G7 + f7*(i64)G6 + f8*(i64)G5 + f9*(i64)G4;
+ f5*(i64)G8 + f6*(i64)G7 + f7*(i64)G6 + f8*(i64)G5 + f9*(i64)G4;
i64 t4 = f0*(i64)g4 + F1*(i64)g3 + f2*(i64)g2 + F3*(i64)g1 + f4*(i64)g0
+ F5*(i64)G9 + f6*(i64)G8 + F7*(i64)G7 + f8*(i64)G6 + F9*(i64)G5;
+ F5*(i64)G9 + f6*(i64)G8 + F7*(i64)G7 + f8*(i64)G6 + F9*(i64)G5;
i64 t5 = f0*(i64)g5 + f1*(i64)g4 + f2*(i64)g3 + f3*(i64)g2 + f4*(i64)g1
+ f5*(i64)g0 + f6*(i64)G9 + f7*(i64)G8 + f8*(i64)G7 + f9*(i64)G6;
+ f5*(i64)g0 + f6*(i64)G9 + f7*(i64)G8 + f8*(i64)G7 + f9*(i64)G6;
i64 t6 = f0*(i64)g6 + F1*(i64)g5 + f2*(i64)g4 + F3*(i64)g3 + f4*(i64)g2
+ F5*(i64)g1 + f6*(i64)g0 + F7*(i64)G9 + f8*(i64)G8 + F9*(i64)G7;
+ F5*(i64)g1 + f6*(i64)g0 + F7*(i64)G9 + f8*(i64)G8 + F9*(i64)G7;
i64 t7 = f0*(i64)g7 + f1*(i64)g6 + f2*(i64)g5 + f3*(i64)g4 + f4*(i64)g3
+ f5*(i64)g2 + f6*(i64)g1 + f7*(i64)g0 + f8*(i64)G9 + f9*(i64)G8;
+ f5*(i64)g2 + f6*(i64)g1 + f7*(i64)g0 + f8*(i64)G9 + f9*(i64)G8;
i64 t8 = f0*(i64)g8 + F1*(i64)g7 + f2*(i64)g6 + F3*(i64)g5 + f4*(i64)g4
+ F5*(i64)g3 + f6*(i64)g2 + F7*(i64)g1 + f8*(i64)g0 + F9*(i64)G9;
+ F5*(i64)g3 + f6*(i64)g2 + F7*(i64)g1 + f8*(i64)g0 + F9*(i64)G9;
i64 t9 = f0*(i64)g9 + f1*(i64)g8 + f2*(i64)g7 + f3*(i64)g6 + f4*(i64)g5
+ f5*(i64)g4 + f6*(i64)g3 + f7*(i64)g2 + f8*(i64)g1 + f9*(i64)g0;
+ f5*(i64)g4 + f6*(i64)g3 + f7*(i64)g2 + f8*(i64)g1 + f9*(i64)g0;
// t0 < 0.67 * 2^61
// t1 < 0.41 * 2^61
// t2 < 0.52 * 2^61
@ -1296,25 +1291,25 @@ static void fe_sq(fe h, const fe f)
// |f5_38|, |f6_19|, |f7_38|, |f8_19|, |f9_38| < 2^31
i64 t0 = f0 *(i64)f0 + f1_2*(i64)f9_38 + f2_2*(i64)f8_19
+ f3_2*(i64)f7_38 + f4_2*(i64)f6_19 + f5 *(i64)f5_38;
+ f3_2*(i64)f7_38 + f4_2*(i64)f6_19 + f5 *(i64)f5_38;
i64 t1 = f0_2*(i64)f1 + f2 *(i64)f9_38 + f3_2*(i64)f8_19
+ f4 *(i64)f7_38 + f5_2*(i64)f6_19;
+ f4 *(i64)f7_38 + f5_2*(i64)f6_19;
i64 t2 = f0_2*(i64)f2 + f1_2*(i64)f1 + f3_2*(i64)f9_38
+ f4_2*(i64)f8_19 + f5_2*(i64)f7_38 + f6 *(i64)f6_19;
+ f4_2*(i64)f8_19 + f5_2*(i64)f7_38 + f6 *(i64)f6_19;
i64 t3 = f0_2*(i64)f3 + f1_2*(i64)f2 + f4 *(i64)f9_38
+ f5_2*(i64)f8_19 + f6 *(i64)f7_38;
+ f5_2*(i64)f8_19 + f6 *(i64)f7_38;
i64 t4 = f0_2*(i64)f4 + f1_2*(i64)f3_2 + f2 *(i64)f2
+ f5_2*(i64)f9_38 + f6_2*(i64)f8_19 + f7 *(i64)f7_38;
+ f5_2*(i64)f9_38 + f6_2*(i64)f8_19 + f7 *(i64)f7_38;
i64 t5 = f0_2*(i64)f5 + f1_2*(i64)f4 + f2_2*(i64)f3
+ f6 *(i64)f9_38 + f7_2*(i64)f8_19;
+ f6 *(i64)f9_38 + f7_2*(i64)f8_19;
i64 t6 = f0_2*(i64)f6 + f1_2*(i64)f5_2 + f2_2*(i64)f4
+ f3_2*(i64)f3 + f7_2*(i64)f9_38 + f8 *(i64)f8_19;
+ f3_2*(i64)f3 + f7_2*(i64)f9_38 + f8 *(i64)f8_19;
i64 t7 = f0_2*(i64)f7 + f1_2*(i64)f6 + f2_2*(i64)f5
+ f3_2*(i64)f4 + f8 *(i64)f9_38;
+ f3_2*(i64)f4 + f8 *(i64)f9_38;
i64 t8 = f0_2*(i64)f8 + f1_2*(i64)f7_2 + f2_2*(i64)f6
+ f3_2*(i64)f5_2 + f4 *(i64)f4 + f9 *(i64)f9_38;
+ f3_2*(i64)f5_2 + f4 *(i64)f4 + f9 *(i64)f9_38;
i64 t9 = f0_2*(i64)f9 + f1_2*(i64)f8 + f2_2*(i64)f7
+ f3_2*(i64)f6 + f4 *(i64)f5_2;
+ f3_2*(i64)f6 + f4 *(i64)f5_2;
// t0 < 0.67 * 2^61
// t1 < 0.41 * 2^61
// t2 < 0.52 * 2^61
@ -1417,17 +1412,17 @@ static int invsqrt(fe isr, const fe x)
// Can be achieved with a simple double & add ladder,
// but it would be slower.
fe_sq(t0, x);
fe_sq(t1,t0); fe_sq(t1, t1); fe_mul(t1, x, t1);
fe_sq(t1,t0); fe_sq(t1, t1); fe_mul(t1, x, t1);
fe_mul(t0, t0, t1);
fe_sq(t0, t0); fe_mul(t0, t1, t0);
fe_sq(t1, t0); FOR (i, 1, 5) fe_sq(t1, t1); fe_mul(t0, t1, t0);
fe_sq(t1, t0); FOR (i, 1, 10) fe_sq(t1, t1); fe_mul(t1, t1, t0);
fe_sq(t2, t1); FOR (i, 1, 20) fe_sq(t2, t2); fe_mul(t1, t2, t1);
fe_sq(t1, t1); FOR (i, 1, 10) fe_sq(t1, t1); fe_mul(t0, t1, t0);
fe_sq(t1, t0); FOR (i, 1, 50) fe_sq(t1, t1); fe_mul(t1, t1, t0);
fe_sq(t2, t1); FOR (i, 1, 100) fe_sq(t2, t2); fe_mul(t1, t2, t1);
fe_sq(t1, t1); FOR (i, 1, 50) fe_sq(t1, t1); fe_mul(t0, t1, t0);
fe_sq(t0, t0); FOR (i, 1, 2) fe_sq(t0, t0); fe_mul(t0, t0, x);
fe_sq(t0, t0); fe_mul(t0, t1, t0);
fe_sq(t1, t0); FOR (i, 1, 5) { fe_sq(t1, t1); } fe_mul(t0, t1, t0);
fe_sq(t1, t0); FOR (i, 1, 10) { fe_sq(t1, t1); } fe_mul(t1, t1, t0);
fe_sq(t2, t1); FOR (i, 1, 20) { fe_sq(t2, t2); } fe_mul(t1, t2, t1);
fe_sq(t1, t1); FOR (i, 1, 10) { fe_sq(t1, t1); } fe_mul(t0, t1, t0);
fe_sq(t1, t0); FOR (i, 1, 50) { fe_sq(t1, t1); } fe_mul(t1, t1, t0);
fe_sq(t2, t1); FOR (i, 1, 100) { fe_sq(t2, t2); } fe_mul(t1, t2, t1);
fe_sq(t1, t1); FOR (i, 1, 50) { fe_sq(t1, t1); } fe_mul(t0, t1, t0);
fe_sq(t0, t0); FOR (i, 1, 2) { fe_sq(t0, t0); } fe_mul(t0, t0, x);
// quartic = x^((p-1)/4)
i32 *quartic = t1;
@ -1947,7 +1942,7 @@ static int slide_step(slide_ctx *ctx, int width, int i, const u8 scalar[32])
ctx->next_check--;
} else {
// compute digit of next window
int w = MIN(width, i + 1);
int w = MC_MIN(width, i + 1);
int v = -(scalar_bit(scalar, i) << (w-1));
FOR_T (int, j, 0, w-1) {
v += scalar_bit(scalar, i-(w-1)+j) << j;
@ -2006,7 +2001,7 @@ int crypto_eddsa_check_equation(const u8 signature[64], const u8 public_key[32],
// Merged double and add ladder, fused with sliding
slide_ctx h_slide; slide_init(&h_slide, h);
slide_ctx s_slide; slide_init(&s_slide, s);
int i = MAX(h_slide.next_check, s_slide.next_check);
int i = MC_MAX(h_slide.next_check, s_slide.next_check);
ge *sum = &minus_A; // reuse minus_A for the sum
ge_zero(sum);
while (i >= 0) {
@ -2870,9 +2865,9 @@ static void lock_auth(u8 mac[16], const u8 auth_key[32],
crypto_poly1305_ctx poly_ctx; // auto wiped...
crypto_poly1305_init (&poly_ctx, auth_key);
crypto_poly1305_update(&poly_ctx, ad , ad_size);
crypto_poly1305_update(&poly_ctx, zero , align(ad_size, 16));
crypto_poly1305_update(&poly_ctx, zero , gap(ad_size, 16));
crypto_poly1305_update(&poly_ctx, cipher_text, text_size);
crypto_poly1305_update(&poly_ctx, zero , align(text_size, 16));
crypto_poly1305_update(&poly_ctx, zero , gap(text_size, 16));
crypto_poly1305_update(&poly_ctx, sizes , 16);
crypto_poly1305_final (&poly_ctx, mac); // ...here
}

@ -1,4 +1,4 @@
// Monocypher version 4.0.1
// Monocypher version 4.0.2
//
// This file is dual-licensed. Choose whichever licence you want from
// the two licences listed below.

File diff suppressed because it is too large Load Diff

@ -32,7 +32,7 @@ extern "C" {
#define GLAPI extern
#endif
#define GL_GLEXT_VERSION 20201119
#define GL_GLEXT_VERSION 20231129
#include "khrplatform.h"
@ -5397,12 +5397,12 @@ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severi
typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam);
typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufSize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufSize, GLenum *categories, GLenum *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam);
GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufSize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufSize, GLenum *categories, GLenum *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
#endif
#endif /* GL_AMD_debug_output */
@ -7370,6 +7370,16 @@ GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1,
#endif
#endif /* GL_EXT_framebuffer_blit */
#ifndef GL_EXT_framebuffer_blit_layers
#define GL_EXT_framebuffer_blit_layers 1
typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERLAYERSEXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERLAYEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint srcLayer, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstLayer, GLbitfield mask, GLenum filter);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glBlitFramebufferLayersEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
GLAPI void APIENTRY glBlitFramebufferLayerEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint srcLayer, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstLayer, GLbitfield mask, GLenum filter);
#endif
#endif /* GL_EXT_framebuffer_blit_layers */
#ifndef GL_EXT_framebuffer_multisample
#define GL_EXT_framebuffer_multisample 1
#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
@ -7524,7 +7534,6 @@ GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index,
#ifndef GL_EXT_gpu_shader4
#define GL_EXT_gpu_shader4 1
#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD
#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
#define GL_SAMPLER_BUFFER_EXT 0x8DC2
@ -7552,6 +7561,7 @@ GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index,
#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904
#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905
#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD
typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
@ -7563,6 +7573,29 @@ typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count,
typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params);
GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
@ -7575,6 +7608,29 @@ GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuin
GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value);
GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value);
GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value);
GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);
GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);
GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);
GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);
GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);
GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);
GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);
GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);
GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);
GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);
GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);
GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);
GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);
#endif
#endif /* GL_EXT_gpu_shader4 */
@ -8168,6 +8224,10 @@ GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers);
#define GL_EXT_shader_integer_mix 1
#endif /* GL_EXT_shader_integer_mix */
#ifndef GL_EXT_shader_samples_identical
#define GL_EXT_shader_samples_identical 1
#endif /* GL_EXT_shader_samples_identical */
#ifndef GL_EXT_shadow_funcs
#define GL_EXT_shadow_funcs 1
#endif /* GL_EXT_shadow_funcs */
@ -8536,6 +8596,11 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode);
#define GL_SR8_EXT 0x8FBD
#endif /* GL_EXT_texture_sRGB_R8 */
#ifndef GL_EXT_texture_sRGB_RG8
#define GL_EXT_texture_sRGB_RG8 1
#define GL_SRG8_EXT 0x8FBE
#endif /* GL_EXT_texture_sRGB_RG8 */
#ifndef GL_EXT_texture_sRGB_decode
#define GL_EXT_texture_sRGB_decode 1
#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
@ -8574,6 +8639,36 @@ GLAPI void APIENTRY glTextureNormalEXT (GLenum mode);
#define GL_RGBA_SNORM 0x8F93
#endif /* GL_EXT_texture_snorm */
#ifndef GL_EXT_texture_storage
#define GL_EXT_texture_storage 1
#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
#define GL_RGBA32F_EXT 0x8814
#define GL_RGB32F_EXT 0x8815
#define GL_ALPHA32F_EXT 0x8816
#define GL_LUMINANCE32F_EXT 0x8818
#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
#define GL_RGBA16F_EXT 0x881A
#define GL_RGB16F_EXT 0x881B
#define GL_ALPHA16F_EXT 0x881C
#define GL_LUMINANCE16F_EXT 0x881E
#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
#define GL_BGRA8_EXT 0x93A1
#define GL_R8_EXT 0x8229
#define GL_RG8_EXT 0x822B
#define GL_R32F_EXT 0x822E
#define GL_RG32F_EXT 0x8230
#define GL_R16F_EXT 0x822D
#define GL_RG16F_EXT 0x822F
typedef void (APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
typedef void (APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
GLAPI void APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
GLAPI void APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
#endif
#endif /* GL_EXT_texture_storage */
#ifndef GL_EXT_texture_swizzle
#define GL_EXT_texture_swizzle 1
#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
@ -10163,12 +10258,6 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s,
typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v);
typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);
typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);
typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x);
typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y);
@ -10181,6 +10270,12 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, c
typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);
typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);
typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y);
GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v);
@ -10210,12 +10305,6 @@ GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t,
GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v);
GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v);
GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);
GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);
GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);
GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);
GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);
GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x);
GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v);
GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y);
@ -10228,6 +10317,12 @@ GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfN
GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);
GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);
GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);
GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);
GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);
#endif
#endif /* GL_NV_half_float */
@ -10630,7 +10725,7 @@ typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenu
typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount);
typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
@ -10695,7 +10790,7 @@ GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode,
GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint *baseAndCount);
GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
@ -11364,6 +11459,10 @@ GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id);
#endif
#endif /* GL_NV_transform_feedback2 */
#ifndef GL_NV_uniform_buffer_std430_layout
#define GL_NV_uniform_buffer_std430_layout 1
#endif /* GL_NV_uniform_buffer_std430_layout */
#ifndef GL_NV_uniform_buffer_unified_memory
#define GL_NV_uniform_buffer_unified_memory 1
#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E
@ -11765,54 +11864,6 @@ GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GL
#ifndef GL_NV_vertex_program4
#define GL_NV_vertex_program4 1
#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);
GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);
GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);
GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);
GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);
GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);
GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);
GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);
GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);
GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);
GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);
GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);
GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);
GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);
GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);
#endif
#endif /* GL_NV_vertex_program4 */
#ifndef GL_NV_video_capture

@ -153,6 +153,20 @@ typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi)
@ -235,14 +249,21 @@ typedef unsigned short int khronos_uint16_t;
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
#ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif

@ -20,7 +20,7 @@ extern "C" {
#include <windows.h>
#endif
#define WGL_WGLEXT_VERSION 20200813
#define WGL_WGLEXT_VERSION 20231018
/* Generated C header for:
* API: wgl

@ -0,0 +1,4 @@
add_files(
openttd_social_integration_api.h
openttd_social_integration_api_v1.h
)

@ -0,0 +1,20 @@
Copyright 2024 OpenTTD project
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

@ -0,0 +1,38 @@
/*
* Copyright 2024 OpenTTD project
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Although all the source-files created by OpenTTD are licensed under the
* GPL-v2, this file is an exception. This file is part of the API for
* social integration plugins, and licensed under the MIT license, to allow
* for non-free implementations.
*/
/** @file openttd_social_integration_api.h Interface definitions for plugins to report/respond to social integration. */
#ifndef OPENTTD_SOCIAL_INTEGRATION_API_H
#define OPENTTD_SOCIAL_INTEGRATION_API_H
#include "openttd_social_integration_api_v1.h"
#endif /* OPENTTD_SOCIAL_INTEGRATION_API_H */

@ -0,0 +1,157 @@
/*
* Copyright 2024 OpenTTD project
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Although all the source-files created by OpenTTD are licensed under the
* GPL-v2, this file is an exception. This file is part of the API for
* social integration plugins, and licensed under the MIT license, to allow
* for non-free implementations.
*/
/** @file v1.h Version 1 definition of the OpenTTD Social Integration Plugin API. */
#ifndef OPENTTD_SOCIAL_INTEGRATION_API_V1_H
#define OPENTTD_SOCIAL_INTEGRATION_API_V1_H
#ifdef __cplusplus
extern "C" {
#endif
/** Pointers supplied by the plugin for OpenTTD to use. */
struct OpenTTD_SocialIntegration_v1_PluginInfo {
/**
* The Social Platform this plugin is for.
*
* UTF-8, nul-terminated. The plugin is and remains the owner of the memory.
*
* As there can only be one plugin active for each Social Platform, this
* value is used to determine which plugin to use.
*
* A complete list of names can be found here:
* https://wiki.openttd.org/en/Development/Social%20Integration
*
* Please use names from that list, including capitalization.
*
* If you create a plugin for a new Social Platform, please add it to the
* wiki page.
*/
const char *social_platform;
const char *name; ///< Full name of the plugin. UTF-8, nul-terminated. The plugin is and remains the owner of the memory.
const char *version; ///< Version of the plugin. UTF-8, nul-terminated. The plugin is and remains the owner of the memory.
};
/** Pointers supplied by the plugin for OpenTTD to use. */
struct OpenTTD_SocialIntegration_v1_PluginApi {
/**
* OpenTTD tells the plugin to shut down.
*
* The plugin should free any resources it allocated, and must not call any of the callback functions after this call.
*/
void (*shutdown)();
/**
* OpenTTD calls this function at regular intervals, to handle any callbacks the plugin might have.
*
* It is also safe to call the OpenTTD_SocialIntegrationCallbacks functions here.
*
* @return True if the plugin wants to be called again, false if the plugin wants to be unloaded.
*/
bool (*run_callbacks)();
/**
* The player has entered the main menu.
*/
void (*event_enter_main_menu)();
/**
* The player has entered the Scenario Editor.
*
* @param map_width The width of the map in tiles.
* @param map_height The height of the map in tiles.
*/
void (*event_enter_scenario_editor)(unsigned int map_width, unsigned int map_height);
/**
* The player has entered a singleplayer game.
*
* @param map_width The width of the map in tiles.
* @param map_height The height of the map in tiles.
*/
void (*event_enter_singleplayer)(unsigned int map_width, unsigned int map_height);
/**
* The player has entered a multiplayer game.
*
* @param map_width The width of the map in tiles.
* @param map_height The height of the map in tiles.
*/
void (*event_enter_multiplayer)(unsigned int map_width, unsigned int map_height);
/**
* The player is joining a multiplayer game.
*
* This is followed by event_enter_multiplayer() if the join was successful.
*/
void (*event_joining_multiplayer)();
};
/** Pointers supplied by OpenTTD, for the plugin to use. */
struct OpenTTD_SocialIntegration_v1_OpenTTDInfo {
const char *openttd_version; ///< Version of OpenTTD. UTF-8, nul-terminated. OpenTTD is and remains the owner of the memory.
};
/** The result of the initialization. */
enum OpenTTD_SocialIntegration_v1_InitResult : int {
OTTD_SOCIAL_INTEGRATION_V1_INIT_SUCCESS = 1, ///< Plugin initialized successfully.
OTTD_SOCIAL_INTEGRATION_V1_INIT_FAILED = -1, ///< Plugin failed to initialize (generic error).
OTTD_SOCIAL_INTEGRATION_V1_INIT_PLATFORM_NOT_RUNNING = -2, ///< The Social Platform is not running.
};
/**
* Type of the Init function the plugin is expected to export from its dynamic library.
*
* The plugin has to export the implementation of this function as "SocialIntegration_vN_Init", where N is the API version this entry point is for.
* A single plugin can have multiple versions implemented.
*
* @param[out] plugin_api Structure the plugin must fill with pointers. Can contain nullptr if the plugin does not support a feature. The plugin is owner of the memory.
* @param[in] openttd_info Structure that OpenTTD filled with pointers. All pointers will remain valid until shutdown(). OpenTTD is owner of the memory.
* @return The status of the initialization.
*/
typedef OpenTTD_SocialIntegration_v1_InitResult (*OpenTTD_SocialIntegration_v1_Init)(OpenTTD_SocialIntegration_v1_PluginApi *plugin_api, const OpenTTD_SocialIntegration_v1_OpenTTDInfo *openttd_info);
/**
* Type of the GetInfo function the plugin is expected to export from its dynamic library.
*
* The plugin has to export the implementation of this function as "SocialIntegration_vN_GetInfo", where N is the API version this entry point is for.
* A single plugin can have multiple versions implemented.
*
* @param[out] plugin_info Structure the plugin must fill with pointers. The plugin is owner of the memory.
*/
typedef void (*OpenTTD_SocialIntegration_v1_GetInfo)(OpenTTD_SocialIntegration_v1_PluginInfo *plugin_info);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* OPENTTD_SOCIAL_INTEGRATION_API_V1_H */

@ -1,4 +0,0 @@
add_files(
randombytes.h
randombytes.c
)

@ -1,21 +0,0 @@
The MIT License
Copyright (c) 2017 Daan Sprenkels <hello@dsprenkels.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -1,88 +0,0 @@
# Pluggable randombytes function
[![Travis-CI](https://travis-ci.org/dsprenkels/sss.svg?branch=master)](https://travis-ci.org/dsprenkels/randombytes)
[![Appveyor](https://ci.appveyor.com/api/projects/status/github/dsprenkels/randombytes?branch=master&svg=true)](https://ci.appveyor.com/project/dsprenkels/randombytes)
`randombytes` is a library that exposes a single function for retrieving
_crypto-secure_ random bytes. It is loosely based on [Libsodium's random bytes
API][libsodium_randombytes]. If you can, you should use that one. Otherwise, you
can use this library.
## Usage
`randombytes` takes two arguments:
1. A pointer to the buffer
2. The length of the buffer in bytes
The function will always return an `int` which will be `0` on success. The
caller _must_ check this. If some kind of error occured, `errno` MAY contain a
hint to what the error was, and a subsequent call to the `randombytes` function
MAY succeed. An example of when the function may fail is when `/dev/urandom`
could not be opened, because there were no file descriptors left to use for the
process.
On sensible systems (like the ones with `arc4random`) the latency is very low.
However, this is totally not guaranteed. Do not expect this function to be very
fast. Benchmark for your specific setup, and use a fast CSPRNG if you need.
Example code:
```c
#include "randombytes.h"
#include <inttypes.h>
#include <stdio.h>
int main()
{
// Generate some random bytes and print them in hex
int ret;
uint8_t buf[20];
size_t i;
ret = randombytes(&buf[0], sizeof(buf));
if (ret != 0) {
printf("Error in `randombytes`");
return 1;
}
for (i = 0; i < sizeof(buf); ++i) {
printf("%02hhx", buf[i]);
}
printf("\n");
return 0;
}
```
## How secure is it really?
While building this I keep one rule of thumb which is: **Trust the OS**.
Most OS'es implement a secure random generator, which is seeded by a good
entropy source. We will always use this random source. This essentially means
that the implementation is highly platform-dependent. For example we use
`getrandom` on Linux and `arc4random` on BSD systems.
### What if the OS's random generator is bad?
If you are dealing with an OS that has a compromised random generator you are
out of luck. The reason why you cannot generate high quality random data from
userspace is that userspace is made so that everything is too deterministic.
A secure random generator needs a good source of entropy, such as 2.4 GHz noise
or the user's mouse movements. Collecting these kinds of events only works well
when working on the lowest level.
## Questions
### It does not compile on my platform!
[Please open an issue.](https://github.com/dsprenkels/randombytes/issues/new)
If possible I will try to make a `randombytes` implementation for your platform.
### Do you have bindings for language _x_?
No, your language probably already has a random source. Use that one.
### Other
Feel free to send me an email on my Github associated e-mail address.
[libsodium_randombytes]: https://github.com/jedisct1/libsodium/blob/master/src/libsodium/randombytes/sysrandom/randombytes_sysrandom.c

@ -1,339 +0,0 @@
// In the case that are compiling on linux, we need to define _GNU_SOURCE
// *before* randombytes.h is included. Otherwise SYS_getrandom will not be
// declared.
#if defined(__linux__)
# define _GNU_SOURCE
#endif /* defined(__linux__) */
#include "randombytes.h"
#if defined(_WIN32)
/* Windows */
# include <windows.h>
# include <wincrypt.h> /* CryptAcquireContext, CryptGenRandom */
#endif /* defined(_WIN32) */
/* wasi */
#if defined(__wasi__)
#include <stdlib.h>
#endif
#if defined(__linux__)
/* Linux */
// We would need to include <linux/random.h>, but not every target has access
// to the linux headers. We only need RNDGETENTCNT, so we instead inline it.
// RNDGETENTCNT is originally defined in `include/uapi/linux/random.h` in the
// linux repo.
# define RNDGETENTCNT 0x80045200
# include <assert.h>
# include <errno.h>
# include <fcntl.h>
# include <poll.h>
# include <stdint.h>
# include <stdio.h>
# include <sys/ioctl.h>
# if defined(__linux__) && defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC_MINOR__ > 24))
# define USE_GLIBC
# include <sys/random.h>
# endif /* defined(__linux__) && defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC_MINOR__ > 24)) */
# include <sys/stat.h>
# include <sys/syscall.h>
# include <sys/types.h>
# include <unistd.h>
// We need SSIZE_MAX as the maximum read len from /dev/urandom
# if !defined(SSIZE_MAX)
# define SSIZE_MAX (SIZE_MAX / 2 - 1)
# endif /* defined(SSIZE_MAX) */
#endif /* defined(__linux__) */
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
/* Dragonfly, FreeBSD, NetBSD, OpenBSD (has arc4random) */
# include <sys/param.h>
# if defined(BSD)
# include <stdlib.h>
# endif
#endif
#if defined(__EMSCRIPTEN__)
# include <assert.h>
# include <emscripten.h>
# include <errno.h>
# include <stdbool.h>
#endif /* defined(__EMSCRIPTEN__) */
#if defined(_WIN32)
static int randombytes_win32_randombytes(void* buf, const size_t n)
{
HCRYPTPROV ctx;
BOOL tmp;
tmp = CryptAcquireContext(&ctx, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
if (tmp == FALSE) return -1;
tmp = CryptGenRandom(ctx, (DWORD)n, (BYTE*) buf);
if (tmp == FALSE) return -1;
tmp = CryptReleaseContext(ctx, 0);
if (tmp == FALSE) return -1;
return 0;
}
#endif /* defined(_WIN32) */
#if defined(__wasi__)
static int randombytes_wasi_randombytes(void *buf, size_t n) {
arc4random_buf(buf, n);
return 0;
}
#endif /* defined(__wasi__) */
#if defined(__linux__) && (defined(USE_GLIBC) || defined(SYS_getrandom))
# if defined(USE_GLIBC)
// getrandom is declared in glibc.
# elif defined(SYS_getrandom)
static ssize_t getrandom(void *buf, size_t buflen, unsigned int flags) {
return syscall(SYS_getrandom, buf, buflen, flags);
}
# endif
static int randombytes_linux_randombytes_getrandom(void *buf, size_t n)
{
/* I have thought about using a separate PRF, seeded by getrandom, but
* it turns out that the performance of getrandom is good enough
* (250 MB/s on my laptop).
*/
size_t offset = 0, chunk;
int ret;
while (n > 0) {
/* getrandom does not allow chunks larger than 33554431 */
chunk = n <= 33554431 ? n : 33554431;
do {
ret = getrandom((char *)buf + offset, chunk, 0);
} while (ret == -1 && errno == EINTR);
if (ret < 0) return ret;
offset += ret;
n -= ret;
}
assert(n == 0);
return 0;
}
#endif // defined(__linux__) && (defined(USE_GLIBC) || defined(SYS_getrandom))
#if defined(__linux__) && !defined(SYS_getrandom)
static int randombytes_linux_read_entropy_ioctl(int device, int *entropy)
{
return ioctl(device, RNDGETENTCNT, entropy);
}
static int randombytes_linux_read_entropy_proc(FILE *stream, int *entropy)
{
int retcode;
do {
rewind(stream);
retcode = fscanf(stream, "%d", entropy);
} while (retcode != 1 && errno == EINTR);
if (retcode != 1) {
return -1;
}
return 0;
}
static int randombytes_linux_wait_for_entropy(int device)
{
/* We will block on /dev/random, because any increase in the OS' entropy
* level will unblock the request. I use poll here (as does libsodium),
* because we don't *actually* want to read from the device. */
enum { IOCTL, PROC } strategy = IOCTL;
const int bits = 128;
struct pollfd pfd;
int fd;
FILE *proc_file;
int retcode, retcode_error = 0; // Used as return codes throughout this function
int entropy = 0;
/* If the device has enough entropy already, we will want to return early */
retcode = randombytes_linux_read_entropy_ioctl(device, &entropy);
// printf("errno: %d (%s)\n", errno, strerror(errno));
if (retcode != 0 && (errno == ENOTTY || errno == ENOSYS)) {
// The ioctl call on /dev/urandom has failed due to a
// - ENOTTY (unsupported action), or
// - ENOSYS (invalid ioctl; this happens on MIPS, see #22).
//
// We will fall back to reading from
// `/proc/sys/kernel/random/entropy_avail`. This less ideal,
// because it allocates a file descriptor, and it may not work
// in a chroot. But at this point it seems we have no better
// options left.
strategy = PROC;
// Open the entropy count file
proc_file = fopen("/proc/sys/kernel/random/entropy_avail", "r");
} else if (retcode != 0) {
// Unrecoverable ioctl error
return -1;
}
if (entropy >= bits) {
return 0;
}
do {
fd = open("/dev/random", O_RDONLY);
} while (fd == -1 && errno == EINTR); /* EAGAIN will not occur */
if (fd == -1) {
/* Unrecoverable IO error */
return -1;
}
pfd.fd = fd;
pfd.events = POLLIN;
for (;;) {
retcode = poll(&pfd, 1, -1);
if (retcode == -1 && (errno == EINTR || errno == EAGAIN)) {
continue;
} else if (retcode == 1) {
if (strategy == IOCTL) {
retcode = randombytes_linux_read_entropy_ioctl(device, &entropy);
} else if (strategy == PROC) {
retcode = randombytes_linux_read_entropy_proc(proc_file, &entropy);
} else {
return -1; // Unreachable
}
if (retcode != 0) {
// Unrecoverable I/O error
retcode_error = retcode;
break;
}
if (entropy >= bits) {
break;
}
} else {
// Unreachable: poll() should only return -1 or 1
retcode_error = -1;
break;
}
}
do {
retcode = close(fd);
} while (retcode == -1 && errno == EINTR);
if (strategy == PROC) {
do {
retcode = fclose(proc_file);
} while (retcode == -1 && errno == EINTR);
}
if (retcode_error != 0) {
return retcode_error;
}
return retcode;
}
static int randombytes_linux_randombytes_urandom(void *buf, size_t n)
{
int fd;
size_t offset = 0, count;
ssize_t tmp;
do {
fd = open("/dev/urandom", O_RDONLY);
} while (fd == -1 && errno == EINTR);
if (fd == -1) return -1;
if (randombytes_linux_wait_for_entropy(fd) == -1) return -1;
while (n > 0) {
count = n <= SSIZE_MAX ? n : SSIZE_MAX;
tmp = read(fd, (char *)buf + offset, count);
if (tmp == -1 && (errno == EAGAIN || errno == EINTR)) {
continue;
}
if (tmp == -1) return -1; /* Unrecoverable IO error */
offset += tmp;
n -= tmp;
}
close(fd);
assert(n == 0);
return 0;
}
#endif /* defined(__linux__) && !defined(SYS_getrandom) */
#if defined(BSD)
static int randombytes_bsd_randombytes(void *buf, size_t n)
{
arc4random_buf(buf, n);
return 0;
}
#endif /* defined(BSD) */
#if defined(__EMSCRIPTEN__)
static int randombytes_js_randombytes_nodejs(void *buf, size_t n) {
const int ret = EM_ASM_INT({
var crypto;
try {
crypto = require('crypto');
} catch (error) {
return -2;
}
try {
writeArrayToMemory(crypto.randomBytes($1), $0);
return 0;
} catch (error) {
return -1;
}
}, buf, n);
switch (ret) {
case 0:
return 0;
case -1:
errno = EINVAL;
return -1;
case -2:
default:
errno = ENOSYS;
return -1;
}
}
#endif /* defined(__EMSCRIPTEN__) */
int randombytes(void *buf, size_t n)
{
#if defined(__EMSCRIPTEN__)
// # pragma message("Using crypto api from NodeJS")
return randombytes_js_randombytes_nodejs(buf, n);
#elif defined(__linux__)
# if defined(USE_GLIBC)
// # pragma message("Using getrandom function call")
/* Use getrandom system call */
return randombytes_linux_randombytes_getrandom(buf, n);
# elif defined(SYS_getrandom)
// # pragma message("Using getrandom system call")
/* Use getrandom system call */
return randombytes_linux_randombytes_getrandom(buf, n);
# else
// # pragma message("Using /dev/urandom device")
/* When we have enough entropy, we can read from /dev/urandom */
return randombytes_linux_randombytes_urandom(buf, n);
# endif
#elif defined(BSD)
// # pragma message("Using arc4random system call")
/* Use arc4random system call */
return randombytes_bsd_randombytes(buf, n);
#elif defined(_WIN32)
// # pragma message("Using Windows cryptographic API")
/* Use windows API */
return randombytes_win32_randombytes(buf, n);
#elif defined(__wasi__)
// # pragma message("Using WASI arc4random_buf system call")
/* Use WASI */
return randombytes_wasi_randombytes(buf, n);
#else
# error "randombytes(...) is not supported on this platform"
#endif
}

@ -1,25 +0,0 @@
#ifndef sss_RANDOMBYTES_H
#define sss_RANDOMBYTES_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
/* Load size_t on windows */
#include <crtdefs.h>
#else
#include <unistd.h>
#endif /* _WIN32 */
/*
* Write `n` bytes of high quality random bytes to `buf`
*/
int randombytes(void *buf, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* sss_RANDOMBYTES_H */

@ -15,6 +15,8 @@
#include "sqvm.h"
#include "sqtable.h"
#include "../../../core/bit_cast.hpp"
#include "../../../string_func.h"
#include "../../../safeguards.h"
@ -56,24 +58,26 @@ typedef sqvector<ExpState> ExpStateVec;
class SQCompiler
{
public:
SQCompiler(SQVM *v, SQLEXREADFUNC rg, SQUserPointer up, const SQChar* sourcename, bool raiseerror, bool lineinfo) : _token(0), _fs(nullptr), _lex(_ss(v), rg, up, ThrowError, this), _debugline(0), _debugop(0)
SQCompiler(SQVM *v, SQLEXREADFUNC rg, SQUserPointer up, const SQChar* sourcename, bool raiseerror, bool lineinfo) : _token(0), _fs(nullptr), _lex(_ss(v), rg, up), _debugline(0), _debugop(0)
{
_vm=v;
_sourcename = SQString::Create(_ss(v), sourcename);
_lineinfo = lineinfo;_raiseerror = raiseerror;
}
NORETURN static void ThrowError(void *ud, const SQChar *s) {
SQCompiler *c = (SQCompiler *)ud;
c->Error("%s", s);
}
NORETURN void Error(const SQChar *s, ...) WARN_FORMAT(2, 3)
[[noreturn]] void Error(const SQChar *s, ...) WARN_FORMAT(2, 3)
{
static SQChar temp[256];
va_list vl;
va_start(vl, s);
vseprintf(temp, lastof(temp), s, vl);
va_end(vl);
throw temp;
throw CompileException(temp);
}
[[noreturn]] void Error(const std::string &msg)
{
throw CompileException(msg);
}
void Lex(){ _token = _lex.Lex();}
void PushExpState(){ _expstates.push_back(ExpState()); }
@ -163,7 +167,7 @@ public:
_debugline = 1;
_debugop = 0;
SQFuncState funcstate(_ss(_vm), nullptr,ThrowError,this);
SQFuncState funcstate(_ss(_vm), nullptr);
funcstate._name = SQString::Create(_ss(_vm), "main");
_fs = &funcstate;
_fs->AddParameter(_fs->CreateString("this"));
@ -185,20 +189,12 @@ public:
#endif
return true;
}
catch (SQChar *compilererror) {
if(_raiseerror && _ss(_vm)->_compilererrorhandler) {
_ss(_vm)->_compilererrorhandler(_vm, compilererror, type(_sourcename) == OT_STRING?_stringval(_sourcename):"unknown",
_lex._currentline, _lex._currentcolumn);
}
_vm->_lasterror = SQString::Create(_ss(_vm), compilererror, -1);
return false;
}
catch (const std::string &compilererror) {
catch (const CompileException &compilererror) {
if(_raiseerror && _ss(_vm)->_compilererrorhandler) {
_ss(_vm)->_compilererrorhandler(_vm, compilererror.c_str(), type(_sourcename) == OT_STRING ? _stringval(_sourcename) : "unknown",
_ss(_vm)->_compilererrorhandler(_vm, compilererror.what(), type(_sourcename) == OT_STRING ? _stringval(_sourcename) : "unknown",
_lex._currentline, _lex._currentcolumn);
}
_vm->_lasterror = SQString::Create(_ss(_vm), compilererror);
_vm->_lasterror = SQString::Create(_ss(_vm), compilererror.what());
return false;
}
}
@ -666,8 +662,7 @@ public:
_fs->AddInstruction(_OP_LOADINT, _exst._deref,_integer(constval));
}
else if(ctype == OT_FLOAT && sizeof(SQFloat) == sizeof(SQInt32)) {
SQFloat f = _float(constval);
_fs->AddInstruction(_OP_LOADFLOAT, _exst._deref,*((SQInt32 *)&f));
_fs->AddInstruction(_OP_LOADFLOAT, _exst._deref, std::bit_cast<SQInt32>(_float(constval)));
}
else {
_fs->AddInstruction(_OP_LOAD, _exst._deref, _fs->GetConstant(constval));
@ -713,7 +708,7 @@ public:
break;
case TK_FLOAT:
if(sizeof(SQFloat) == sizeof(SQInt32)) {
_fs->AddInstruction(_OP_LOADFLOAT, _fs->PushTarget(),*((SQInt32 *)&_lex._fvalue));
_fs->AddInstruction(_OP_LOADFLOAT, _fs->PushTarget(), std::bit_cast<SQInt32>(_lex._fvalue));
}
else {
_fs->AddInstruction(_OP_LOAD, _fs->PushTarget(), _fs->GetNumericConstant(_lex._fvalue));

@ -2,6 +2,8 @@
#ifndef _SQCOMPILER_H_
#define _SQCOMPILER_H_
#include <stdexcept>
struct SQVM;
#define TK_IDENTIFIER 258
@ -71,12 +73,7 @@ struct SQVM;
#define TK_ENUM 323
#define TK_CONST 324
/* MSVC doesn't like NORETURN for function prototypes, but we kinda need it for GCC. */
#if defined(_MSC_VER) && !defined(__clang__)
typedef void(*CompilerErrorFunc)(void *ud, const SQChar *s);
#else
typedef NORETURN void(*CompilerErrorFunc)(void *ud, const SQChar *s);
#endif
using CompileException = std::runtime_error;
bool Compile(SQVM *vm, SQLEXREADFUNC rg, SQUserPointer up, const SQChar *sourcename, SQObjectPtr &out, bool raiseerror, bool lineinfo);
#endif //_SQCOMPILER_H_

@ -12,6 +12,8 @@
#include "sqopcodes.h"
#include "sqfuncstate.h"
#include "../../../core/bit_cast.hpp"
#include "../../../safeguards.h"
#ifdef _DEBUG_DUMP
@ -92,7 +94,7 @@ void DumpLiteral(SQObjectPtr &o)
}
#endif
SQFuncState::SQFuncState(SQSharedState *ss,SQFuncState *parent,CompilerErrorFunc efunc,void *ed)
SQFuncState::SQFuncState(SQSharedState *ss,SQFuncState *parent)
{
_nliterals = 0;
_literals = SQTable::Create(ss,0);
@ -105,15 +107,13 @@ SQFuncState::SQFuncState(SQSharedState *ss,SQFuncState *parent,CompilerErrorFunc
_traps = 0;
_returnexp = 0;
_varparams = false;
_errfunc = efunc;
_errtarget = ed;
_bgenerator = false;
}
void SQFuncState::Error(const SQChar *err)
{
_errfunc(_errtarget,err);
throw CompileException(err);
}
#ifdef _DEBUG_DUMP
@ -200,7 +200,7 @@ void SQFuncState::Dump(SQFunctionProto *func)
}
}
else if(inst.op==_OP_LOADFLOAT) {
printf("[%03d] %15s %d %f %d %d\n",n,g_InstrDesc[inst.op].name,inst._arg0,*((SQFloat*)&inst._arg1),inst._arg2,inst._arg3);
printf("[%03d] %15s %d %f %d %d\n",n,g_InstrDesc[inst.op].name,inst._arg0,std::bit_cast<SQFloat>(inst._arg1),inst._arg2,inst._arg3);
}
else if(inst.op==_OP_ARITH){
printf("[%03d] %15s %d %d %d %c\n",n,g_InstrDesc[inst.op].name,inst._arg0,inst._arg1,inst._arg2,inst._arg3);
@ -243,19 +243,20 @@ SQInteger SQFuncState::GetConstant(const SQObject &cons)
void SQFuncState::SetIntructionParams(SQInteger pos,SQInteger arg0,SQInteger arg1,SQInteger arg2,SQInteger arg3)
{
_instructions[pos]._arg0=(unsigned char)*((SQUnsignedInteger *)&arg0);
_instructions[pos]._arg1=(SQInt32)*((SQUnsignedInteger *)&arg1);
_instructions[pos]._arg2=(unsigned char)*((SQUnsignedInteger *)&arg2);
_instructions[pos]._arg3=(unsigned char)*((SQUnsignedInteger *)&arg3);
_instructions[pos]._arg0 = (unsigned char)std::bit_cast<SQUnsignedInteger>(arg0);
_instructions[pos]._arg1 = (SQInt32)std::bit_cast<SQUnsignedInteger>(arg1);
_instructions[pos]._arg2 = (unsigned char)std::bit_cast<SQUnsignedInteger>(arg2);
_instructions[pos]._arg3 = (unsigned char)std::bit_cast<SQUnsignedInteger>(arg3);
}
void SQFuncState::SetIntructionParam(SQInteger pos,SQInteger arg,SQInteger val)
{
switch(arg){
case 0:_instructions[pos]._arg0=(unsigned char)*((SQUnsignedInteger *)&val);break;
case 1:case 4:_instructions[pos]._arg1=(SQInt32)*((SQUnsignedInteger *)&val);break;
case 2:_instructions[pos]._arg2=(unsigned char)*((SQUnsignedInteger *)&val);break;
case 3:_instructions[pos]._arg3=(unsigned char)*((SQUnsignedInteger *)&val);break;
case 0: _instructions[pos]._arg0 = (unsigned char)std::bit_cast<SQUnsignedInteger>(val); break;
case 1:
case 4: _instructions[pos]._arg1 = (SQInt32)std::bit_cast<SQUnsignedInteger>(val); break;
case 2: _instructions[pos]._arg2 = (unsigned char)std::bit_cast<SQUnsignedInteger>(val); break;
case 3: _instructions[pos]._arg3 = (unsigned char)std::bit_cast<SQUnsignedInteger>(val); break;
};
}
@ -549,7 +550,7 @@ SQFunctionProto *SQFuncState::BuildProto()
SQFuncState *SQFuncState::PushChildState(SQSharedState *ss)
{
SQFuncState *child = (SQFuncState *)sq_malloc(sizeof(SQFuncState));
new (child) SQFuncState(ss,this,_errfunc,_errtarget);
new (child) SQFuncState(ss,this);
_childstates.push_back(child);
return child;
}

@ -6,12 +6,12 @@
struct SQFuncState
{
SQFuncState(SQSharedState *ss,SQFuncState *parent,CompilerErrorFunc efunc,void *ed);
SQFuncState(SQSharedState *ss,SQFuncState *parent);
~SQFuncState();
#ifdef _DEBUG_DUMP
void Dump(SQFunctionProto *func);
#endif
void Error(const SQChar *err);
[[noreturn]] void Error(const SQChar *err);
SQFuncState *PushChildState(SQSharedState *ss);
void PopChildState();
void AddInstruction(SQOpcode _op,SQInteger arg0=0,SQInteger arg1=0,SQInteger arg2=0,SQInteger arg3=0){SQInstruction i(_op,arg0,arg1,arg2,arg3);AddInstruction(i);}
@ -75,9 +75,6 @@ struct SQFuncState
SQSharedState *_sharedstate;
sqvector<SQFuncState*> _childstates;
SQInteger GetConstant(const SQObject &cons);
private:
CompilerErrorFunc _errfunc;
void *_errtarget;
};

@ -35,10 +35,8 @@ void SQLexer::APPEND_CHAR(char32_t c)
}
}
SQLexer::SQLexer(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up,CompilerErrorFunc efunc,void *ed)
SQLexer::SQLexer(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up)
{
_errfunc = efunc;
_errtarget = ed;
_sharedstate = ss;
_keywords = SQTable::Create(ss, 26);
ADD_KEYWORD(while, TK_WHILE);
@ -94,9 +92,9 @@ SQLexer::SQLexer(SQSharedState *ss, SQLEXREADFUNC rg, SQUserPointer up,CompilerE
Next();
}
NORETURN void SQLexer::Error(const SQChar *err)
[[noreturn]] void SQLexer::Error(const SQChar *err)
{
_errfunc(_errtarget,err);
throw CompileException(err);
}
void SQLexer::Next()

@ -5,8 +5,8 @@
struct SQLexer
{
~SQLexer();
SQLexer(SQSharedState *ss,SQLEXREADFUNC rg,SQUserPointer up,CompilerErrorFunc efunc,void *ed);
NORETURN void Error(const SQChar *err);
SQLexer(SQSharedState *ss,SQLEXREADFUNC rg,SQUserPointer up);
[[noreturn]] void Error(const SQChar *err);
SQInteger Lex();
const SQChar *Tok2Str(SQInteger tok);
private:
@ -35,8 +35,6 @@ public:
char32_t _currdata;
SQSharedState *_sharedstate;
sqvector<SQChar> _longstr;
CompilerErrorFunc _errfunc;
void *_errtarget;
};
#endif

@ -17,6 +17,8 @@
#include "sqarray.h"
#include "sqclass.h"
#include "../../../core/bit_cast.hpp"
#include "../../../string_func.h"
#include "../../../safeguards.h"
@ -50,7 +52,7 @@ bool SQVM::BW_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,con
case BW_XOR: res = i1 ^ i2; break;
case BW_SHIFTL: res = i1 << i2; break;
case BW_SHIFTR: res = i1 >> i2; break;
case BW_USHIFTR:res = (SQInteger)(*((SQUnsignedInteger*)&i1) >> i2); break;
case BW_USHIFTR:res = (SQInteger)(std::bit_cast<SQUnsignedInteger>(i1) >> i2); break;
default: { Raise_Error("internal vm error bitwise op failed"); return false; }
}
}
@ -216,7 +218,7 @@ bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObjectPtr &o2,SQInteger &result)
_RET_SUCCEED(_integer(res))
}
}
FALLTHROUGH;
[[fallthrough]];
default:
_RET_SUCCEED( _userpointer(o1) < _userpointer(o2)?-1:1 );
}
@ -288,7 +290,7 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
//else keeps going to the default
}
}
FALLTHROUGH;
[[fallthrough]];
default:
seprintf(buf, lastof(buf),"(%s : 0x%p)",GetTypeName(o),(void*)_rawval(o));
}
@ -471,10 +473,10 @@ bool SQVM::DerefInc(SQInteger op,SQObjectPtr &target, SQObjectPtr &self, SQObjec
#define arg0 (_i_._arg0)
#define arg1 (_i_._arg1)
#define sarg1 (*(const_cast<SQInt32 *>(&_i_._arg1)))
#define sarg1 (std::bit_cast<SQInt32>(_i_._arg1))
#define arg2 (_i_._arg2)
#define arg3 (_i_._arg3)
#define sarg3 ((SQInteger)*((const signed char *)&_i_._arg3))
#define sarg3 ((SQInteger)std::bit_cast<char>(_i_._arg3))
SQRESULT SQVM::Suspend()
{
@ -540,7 +542,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
_generator(o1)->Resume(this, arg_2+1);
_FINISH(0);
}
FALLTHROUGH;
[[fallthrough]];
default:
Raise_Error("cannot iterate %s", GetTypeName(o1));
}
@ -763,7 +765,7 @@ exception_restore:
continue;
case _OP_LOAD: TARGET = ci->_literals[arg1]; continue;
case _OP_LOADINT: TARGET = (SQInteger)arg1; continue;
case _OP_LOADFLOAT: TARGET = *((const SQFloat *)&arg1); continue;
case _OP_LOADFLOAT: TARGET = std::bit_cast<SQFloat>(arg1); continue;
case _OP_DLOAD: TARGET = ci->_literals[arg1]; STK(arg2) = ci->_literals[arg3];continue;
case _OP_TAILCALL:
temp_reg = STK(arg1);
@ -775,7 +777,7 @@ exception_restore:
ct_stackbase = _stackbase;
goto common_call;
}
FALLTHROUGH;
[[fallthrough]];
case _OP_CALL: {
ct_tailcall = false;
ct_target = arg0;
@ -1337,7 +1339,7 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr
return true;
}
}
FALLTHROUGH;
[[fallthrough]];
case OT_USERDATA:
if(_delegable(self)->_delegate) {
SQObjectPtr t;

@ -147,6 +147,10 @@ add_files(
dock_gui.cpp
driver.cpp
driver.h
dropdown.cpp
dropdown_common_type.h
dropdown_func.h
dropdown_type.h
economy.cpp
economy_base.h
economy_func.h
@ -161,6 +165,7 @@ add_files(
engine_func.h
engine_gui.cpp
engine_gui.h
engine_override.h
engine_type.h
error.h
error_gui.cpp
@ -258,6 +263,7 @@ add_files(
music_gui.cpp
newgrf.cpp
newgrf.h
newgrf_act5.h
newgrf_airport.cpp
newgrf_airport.h
newgrf_airporttiles.cpp
@ -280,6 +286,7 @@ add_files(
newgrf_config.h
newgrf_debug.h
newgrf_debug_gui.cpp
newgrf_dump.h
newgrf_engine.cpp
newgrf_engine.h
newgrf_extension.cpp
@ -412,17 +419,23 @@ add_files(
signal.cpp
signal_func.h
signal_type.h
signature.cpp
signature.h
signs.cpp
signs_base.h
signs_cmd.cpp
signs_func.h
signs_gui.cpp
signs_type.h
slider.cpp
slider_func.h
slope_func.h
slope_type.h
smallmap_colours.h
smallmap_gui.cpp
smallmap_gui.h
social_integration.cpp
social_integration.h
sortlist_type.h
sound.cpp
sound_func.h

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save