Compare commits

...

575 Commits

Author SHA1 Message Date
Jonathan G Rennison af102d123b Add button to toggle train purchase window dual pane mode 21 hours ago
Jonathan G Rennison 8a134d0f94 Fix narrowing cast warning 22 hours ago
Jonathan G Rennison 827146de00 Dirty settings window when using mode toggle in signal window 22 hours ago
Jeremy Gao bca37ef9e7 Change: correct punctuations in zh_CN 22 hours ago
Jonathan G Rennison fa9db4ed6d Debug: Fix missing newlines in multi-line vehicle flags 1 day 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 day ago
Jonathan G Rennison 2aefeec225 Fix infrastructure totals when removing canals in ForceClearWaterTile 1 day ago
Jonathan G Rennison 226c3d5d17 Apply limit train acceleration setting before acceleration scaling
See: #699
1 day ago
Jonathan G Rennison c3829f5088 Show scheduled dispatch tag in order window 1 day ago
Jonathan G Rennison 9aca7ed2b4 Fix logging of game load times in crash and desync logs 4 days ago
Jonathan G Rennison 05915b2129 Fix handling of reservations when reserving at one way tunnel-bridge exit 5 days ago
Alistair Lynn 7ef8706ed2 Add: Setting to uniformly slow the acceleration and braking of realistic trains
This does not affect the maximum speed.
6 days ago
Jonathan G Rennison 0351734729 Fix narrowing warning using packet GetDeserialisationPosition 6 days ago
Jonathan G Rennison 7997430688 Add various missing includes 6 days ago
Jonathan G Rennison f09f412c43 Add hash table index to EngineOverrideManager
Use for EngineOverrideManager::GetID lookups
6 days ago
Jonathan G Rennison 556722399a Move EngineOverrideManager to separate header 6 days ago
Jonathan G Rennison b42d12deb2 Add do/while wrappers around grfmsg/GrfMsg 6 days 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
6 days ago
Jonathan G Rennison c6c7191b16 Avoid unnecessary allocation of temporaries in layout line cache 1 week ago
Jonathan G Rennison 99e6b75337 Move NewGRF sprite dump declarations to new header file 1 week ago
Jonathan G Rennison dc6ba9b9d8 Move NewGRF shadow copy groups into internal header 1 week ago
Jonathan G Rennison 56356bb761 Change container type for several uses of std::map/std::set 1 week 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
1 week ago
Jonathan G Rennison cb1e41fc88 Remove use of memcmp in CheckCaches 1 week ago
Jonathan G Rennison 2b539a2d37 Fix water infrastructure total when changing owner of object on water 1 week 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
1 week ago
Jonathan G Rennison cbea3b8b46 Add console command to merge two companies 1 week ago
Jonathan G Rennison f2f8692fb2 Add setting to allow track editing to ignore realistic braking restrictions 1 week ago
Jonathan G Rennison 7874fb7a12 Add public key auth support for settings_access console command 1 week 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
1 week 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
2 weeks ago
Jonathan G Rennison 431a6a1262 Allow sorting by average order occupancy in shared order group mode
See: #698
2 weeks ago
Jonathan G Rennison d39bdd352b Merge PR #700 into jgrpp 2 weeks ago
pvillaverde dc465000f7 🌐 Update Galician Translations 2024-05-26 2 weeks ago
Jonathan G Rennison 1d70c781c6 Fix vehicle window showing profit last year in wallclock timekeeping mode 2 weeks ago
Qwest8K 6dfe5c4da9
Update: Russian translation (#695)
Russian localization update
2 weeks ago
Jonathan G Rennison a8d830aa3e Fix signal side when using both sides signal style with no-entry signals 2 weeks ago
Jonathan G Rennison a24d72f0d7 Fix flag values in CustomSignalSpriteContextFlags 2 weeks ago
Jonathan G Rennison 8907b9aa31 Reduce diff with upstream for console command functionality 2 weeks ago
Jonathan G Rennison 88d7be1d99 Change FormatArrayAsHex to be uppercase by default
To match upstream
2 weeks ago
Jonathan G Rennison 48910a8b7d Version: Committing version data for tag: jgrpp-0.59.1 3 weeks ago
Jonathan G Rennison 5e971bfc02 Fix abstract filetype not being set for network client join savegames 3 weeks ago
Jonathan G Rennison fc5b3b90b4 Remove incorrect assertion as temporary fix for #692
See: https://github.com/OpenTTD/OpenTTD/issues/12651
3 weeks ago
Rubidium 1d13ac7280 Fix #12655, 4f6d75f: inconsistent state in client list and potential crash after client leaves
(cherry picked from commit f939e81bf0)
3 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)
3 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
3 weeks ago
Jonathan G Rennison 66d03530dc Adjust handling of vehicle subspeed with realistic braking
In particular when descending a steep slope with insufficient braking
3 weeks ago
Jonathan G Rennison 6d1f3b673e Fix non-percentage servicing interval when using wallclock mode 3 weeks ago
Jonathan G Rennison 89902c8ab1 Fix advisory max speed being higher than strict max for reservation end
In GetCurrentMaxSpeedInfoInternal
3 weeks ago
Jonathan G Rennison 242e87652b Fix setting display for industry cargo scaling 3 weeks ago
Jonathan G Rennison b81da24a64 Fix setting default value for industry cargo scaling mode in old saves 3 weeks ago
Jonathan G Rennison bdd1d36bd9 Fix road vehicle restart loading at same station when using implicit orders 4 weeks ago
TELK b1faf3d39f Update: Korean translation 4 weeks 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
4 weeks 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)
4 weeks 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
1 month ago
Jonathan G Rennison 247b40c95b Adjust setting texts for show running costs per year setting 1 month ago
Jonathan G Rennison d90c540f9e Enable economy day length scaling in wallclock timekeeping mode 1 month ago
Jonathan G Rennison 9a07f14f56 Show running costs in calendar years by default 1 month 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
1 month ago
Jonathan G Rennison adc7840f01 Scheduled dispatch: Caveat text for number of vehicles required 1 month ago
Jonathan G Rennison a14f850f33 Debug: Show unreachable error groups in sprite dump when show details enabled 1 month 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)
1 month ago
Jonathan G Rennison 991b7a958e Do not reset lateness on auto-timetable congestion detection, when using scheduled dispatch 1 month 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
1 month ago
Jonathan G Rennison 29871e412c Fix 69e7c1697: Add missing include for MSVC 1 month ago
Jonathan G Rennison ce40e85ccc Fix ROADSTOP_DRAW_MODE_WAYP_GROUND when used with RSF_DRAW_MODE_REGISTER 1 month ago
Jonathan G Rennison 07cfa5f602 Fix documentation comment for RSF_DRAW_MODE_REGISTER 1 month ago
Jonathan G Rennison 980de7353d TBTR: Fix replacement servicing condition when using infinite money 1 month 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
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
Jonathan G Rennison 0dcbcedbac Fix ScriptRail::BuildSignal when using realistic braking with block signals 2 months ago
FedelloKirfed 46d71463d9 🌐 Update Galician Translations 2024-04-14 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
2 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.
2 months ago
Jonathan G Rennison 0008e7d769 Fix velocity unit names used in cargo payments graph window 2 months ago
Jonathan G Rennison 4d47eee48d Lang: Update tiles/day and tiles/sec unit name strings 2 months ago
Jonathan G Rennison 6e689c2b93 Fix tiles/day speed unit in wallclock mode 2 months ago
Jonathan G Rennison e041fb8b25 Fix industry window production last month string in wallclock mode 2 months ago
Jonathan G Rennison 9dc332ca59 Fix choppy audio playback of sound effects on Windows
Increase default audio buffer size

See: #680
See: 25aeb1c5
2 months ago
Rubidium d5e28a904d Fix fb9d4af: use different nonces for key exchange and stream encryption 2 months ago
translators 9954187680 Update: Translations from eints
greek: 172 changes by gh658804
ukrainian: 18 changes by StepanIvasyn
portuguese (brazilian): 9 changes by pasantoro
2 months ago
Jonathan G Rennison 083a05a179 Adjust case of vehicle list window drop down items 2 months ago
Jonathan G Rennison d31359f4d2 Saveload: Fix doc comment for SlXvGetFeatureName 2 months ago
Patric Stout 77f02faf15
Codefix 977aba73be: also update comment about removal of is_random (#12400) 2 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
2 months ago
translators 340c2802da Update: Translations from eints
ukrainian: 14 changes by StepanIvasyn
dutch: 3 changes by Afoklala
portuguese (brazilian): 34 changes by pasantoro
2 months ago
Patric Stout e866ca8adc
Cleanup 69d5b9d3: actually clean up all remnants of "no-thread" builds (#12398) 2 months ago
Patric Stout c0308acb03
Fix: "-q" displays NewGRF IDs in the wrong byte-order (#12397) 2 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
2 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
2 months ago
Peter Nelson 8d312b305b
Codechange: Replace currency macros with functions. (#12396) 2 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
2 months ago
Peter Nelson e16b982b6a Codechange: Use iteration when dealing with all HouseSpecs. 2 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.
2 months ago
Peter Nelson 8746be8bf2
Codechange: Use FindVehiclesWithOrder when removing a road stop. (#12144) 2 months ago
frosch 907cb4fc53
Fix: [Script] ScriptSubsidy::GetExpireDate should return an economy-date (#12372) 2 months ago
Michael Lutz 8fb7d74dfe Fix eabb9db: Drag building of road stops should not allow mixing z levels. 2 months ago
Michael Lutz 69acc132ca Fix #12387, eabb9db: [NewGRF] Wrong tile offset passed to rail station CB 149 (slope check) 2 months ago
Loïc Guilloux 71087bb6d3
Change: [CI] Always use latest stable Xcode (#12390) 2 months ago
Jonathan G Rennison 0ba9d9bb18 Version: Committing version data for tag: jgrpp-0.58.2 2 months ago
glx22 64a67d8821 Change: [CI] Always use latest stable Xcode
(cherry picked from commit d750db9bbefe853002edea59ad72ca37a4702b6c)
2 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
2 months ago
Jonathan G Rennison 433484cda3
Fix #12388: Vehicle::CopyVehicleConfigAndStatistics not releasing unit number (#12389) 2 months ago
Jonathan G Rennison 315dd62bd9 Fix Vehicle::CopyVehicleConfigAndStatistics not releasing unit number
See: https://github.com/OpenTTD/OpenTTD/issues/12388
2 months ago
SamuXarick afaf452534 Fix: Changing NPF max search nodes while in-game had no effect (#12194)
(cherry picked from commit f845b4bbc3)
2 months ago
Peter Nelson 5c345f55e2 Fix #12368: Incorrect offset for click position within industry chain window. (#12370)
(cherry picked from commit 97c1738541)
2 months ago
Peter Nelson b919c412b9 Fix 2fd9096: Label for fruit incorrectly changed to `FRUI` from `FRUT`. (#12367)
(cherry picked from commit eebfb83aa2)
2 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
2 months ago
Jonathan G Rennison 8e9600991a Clear vehicle unit number on load for non-primary vehicles 2 months ago
Jonathan G Rennison 459e13fc5a Remove unused command: CMD_SET_VEHICLE_UNIT_NUMBER 2 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
2 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.
2 months ago
Peter Nelson 4751179dc5
Codefix: Remove unused class member and extraneous spaces. (#12378) 2 months ago
Rubidium 9aa6669266 Fix: inconsistent check for client authorized status 2 months ago
Rubidium 84bbe235e4 Fix: do not send chat to clients that have not authorized yet 2 months ago
Tyler Trahan f71ada4f30
Fix #12268: Capitalize "Wait to unbunch" order string (#12375) 2 months ago
SamuXarick f845b4bbc3
Fix: Changing NPF max search nodes while in-game had no effect (#12194) 2 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
2 months ago
Peter Nelson 97c1738541
Fix #12368: Incorrect offset for click position within industry chain window. (#12370) 2 months ago
Peter Nelson eebfb83aa2
Fix 2fd9096: Label for fruit incorrectly changed to `FRUI` from `FRUT`. (#12367) 2 months ago
Jonathan G Rennison c295b1d99e Use OTTD2FS for unlink when using iconv 2 months ago
Tyler Trahan 8928f4979a
Change: Add dividers in vehicle group action dropdown (#12284) 2 months ago
Jonathan G Rennison e9c8c36af7 Add missing include to src/sl/saveload.cpp 2 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
2 months ago
Rubidium caa7c44052 Cleanup: remove checks for old MSVC versions 2 months ago
Rubidium d09b5aaeba Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity 2 months ago
Rubidium c01bf06ee1 Codefix: some minor errors in tcp-game protocol documentation 2 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
2 months ago
Peter Nelson 668186ca5b
Codechange: Remove macros involved with NewGRFClass. (#12363)
Use direct class instantiation instead.
2 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
2 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
2 months ago
frosch 0b6d73fab2 Add: [SDL2] Driver parameter 'no_mouse_capture' to ease interactive debugging (#12336)
(cherry picked from commit 603154899a)
2 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
2 months ago
Tyler Trahan d21369b258 Change: Show unbunching action in timetable window (#12351)
(cherry picked from commit 2732b3d6c6)

# Conflicts:
#	src/order_gui.cpp
2 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)
2 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) 3 months ago
Jonathan G Rennison 679a59875b Changelog: Fix spelling error 3 months ago
Rubidium aff09306de Fix #12076: Do not allow 'join' command on dedicated servers 3 months ago
Loïc Guilloux 253ba0d354
Fix #12195: Reset cursor when no Object is selected (#12207) 3 months ago
Jonathan G Rennison b37f4da1b3 Version: Committing version data for tag: jgrpp-0.58.1 3 months ago
Jonathan G Rennison 2bb5c9ac84 Add setting to disable script parameter randomisation 3 months ago
Jonathan G Rennison e730956213 Re-add "path signals only" mode to the signal cycle setting 3 months ago
TELK 7241b28199
Update: Korean translation (#661)
Update: Korean translation
3 months ago
Jonathan G Rennison 3a4398b613 Fix signed/unsigned comparison warning 3 months ago
Jonathan G Rennison b04a356f53 Merge branch 'master' into jgrpp
# Conflicts:
#	src/vehicle.cpp
3 months ago
Loïc Guilloux b53d79b1d2
Codechange: Don't use NOT_REACHED() when catching unhandled thread exceptions (#12199) 3 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.
3 months ago
Tyler Trahan 3fd5c33ae6
Fix f6dd505: Only reset unbunching departure data in the correct depot (#12155) 3 months ago
Patric Stout 7824ae5b59 Fix #12196: disable "select upgrade" button when filtering 3 months ago
Patric Stout b307541099 Fix #12196: always show selected content, even when filtering 3 months ago
Jonathan G Rennison cb5c6abc00 Fix display of ships entering viewports on an aqueduct 3 months ago
Tyler Trahan 890040ceea
Update: Developer credits (#12173) 3 months ago
Jonathan G Rennison 9e807d2072 Fix desync after joining a server with flood_from_edges setting enabled 3 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
3 months ago
Jonathan G Rennison 421a937112 Fix plan window add lines button text when active 3 months ago
Peter Nelson f0a891c4f7
Cleanup: Remove unused last_num_specs from SlRoadStopTileData. (#12198)
Inadvertently copy & pasted from another Sl handler.
3 months ago
Jonathan G Rennison 26fc78d2bf Fix incorrect accounting of company quarterly statistics 3 months ago
translators c0b5510a94 Update: Translations from eints
portuguese (brazilian): 157 changes by pasantoro
polish: 5 changes by pAter-exe
3 months ago
Jonathan G Rennison a816829cd1 Merge branch 'master' into jgrpp
# Conflicts:
#	src/station_gui.cpp
#	src/vehicle_cmd.cpp
#	src/vehicle_gui.cpp
3 months ago
Jonathan G Rennison f403d99c90 Saveload: Add helper to iterate orders from order lists and vehicles 3 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
3 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
3 months ago
Loïc Guilloux fad77261ea
Fix f6dd505: Missing savegame conversion for current_order (#12188) 3 months ago
Jonathan G Rennison cd40eba453 Add an option to disable use of tagged pointers 3 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.
3 months ago
Jonathan G Rennison 7e0acd686e Add NewGRF signal style flag to draw on both sides 3 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
3 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
3 months ago
Jonathan G Rennison 7a2ea83654 Plans: Adjust button tooltips 3 months ago
Jonathan G Rennison 5047b2ef4e Plans: Allow taking ownership of unowned plans
Except for unauthed network clients
3 months ago
Peter Nelson e93d081a4a
Codechange: Use range-for instead of indexed loop. (#12191) 3 months ago
Jonathan G Rennison 3a301cd986 Add helper functions for network settings admin state 3 months ago
Peter Nelson 59420d57ec
Codechange: Use vehicle tile hash to build depot vehicle list. (#12186)
This avoids iterating the entire vehicle pool.
3 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.
3 months ago
Peter Nelson bf865dc536 Codechange: Add `GetVisibleRangeIterators()` to `Scrollbar`. 3 months ago
Loïc Guilloux f612bc6ee2
Fix bf4b6696: [Script] Broken ScriptText circular reference detection (#12187) 3 months ago
Kuhnovic 2fb1593550
Fix e38c3c5: Added missing return statement (#12185) 3 months ago
Patric Stout e775ef2b70
Fix: initialize _switch_mode_time so crash-logs before first game have a realistic time (#12184) 3 months ago
Jonathan G Rennison f186b640f6 Plans: Add initial scenario editor support
See: #655
3 months ago
Jonathan G Rennison e5a34feaed Plans: Remove visibility/window code from CmdAddPlan, use callback 3 months ago
Jonathan G Rennison a20f862cd0 Plans: Adjust command flags 3 months ago
Jonathan G Rennison d09f93879b Fix main viewport only partial redraw when changing UI scale using slider 3 months ago
Jonathan G Rennison 1e0ff41d33 Add UI setting to show speed before destination in vehicle status bar 3 months ago
Jonathan G Rennison 5d7c87f5e4 Add setting for whether to show vehicle running costs per calendar year
See #660
3 months ago
Jonathan G Rennison a429bddbac Batch depot order removals when deleting companies 3 months ago
Jonathan G Rennison 8caa4d8708 Use btree_set in Station::RemoveFromAllNearbyLists 3 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)
3 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
3 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
3 months ago
Jonathan G Rennison cc04fe5005 Duplicate vehicle status bar velocity strings 3 months ago
Jonathan G Rennison 18e1d57fc6 Duplicate STR_ORDERS_GO_TO_TOOLTIP string 3 months ago
Jonathan G Rennison 567e235883 Merge branch 'master' into jgrpp
# Conflicts:
#	src/saveload/saveload.h
3 months ago
Patric Stout e939f59cbb
Codechange: replace "byte" with "uint8_t" in settings (#12179) 3 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
3 months ago
Jonathan G Rennison 0d20a54dc5 Use pointer tags instead of dereferencing in RebuildVehicleTickCaches 3 months ago
Jonathan G Rennison bd04aff725 Use front/vehicle type filtered iteration in ScriptVehicleList 3 months ago
Jonathan G Rennison ac683bc278 ScriptList: Generalise FillList pool iteration 3 months ago
Jonathan G Rennison 746e3874c5 Fix VF_STOP_LOADING flag not always being cleared when leaving station 3 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
3 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
3 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
3 months ago
Jonathan G Rennison be4aea0dad Rationalise handling of train too heavy advice messages 3 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.
3 months ago
Peter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 3 months ago
Peter Nelson ae3390fe48 Codechange: Add ColourShade enum. 3 months ago
Peter Nelson 0463d4c198 Codechange: Remove direct access to _colour_gradient.
Access is now through GetColourGradient, which ensures parameters are in range.
3 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.
3 months ago
Jonathan G Rennison 601071744e Fix timetabled waiting in depots
See: #658
3 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.
3 months ago
Jonathan G Rennison 528aae3f3b Saveload: Remove unused engine save/load desc 3 months ago
Jonathan G Rennison ee7a347287 Fix 07278a41: Narrowing conversion warning fix 3 months ago
Jonathan G Rennison 090656bd7f Adjust handling of year display in wallclock mode and company inauguration years
See: #657
3 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
3 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
3 months ago
Tyler Trahan 677ec70b0e
Fix fd9e72a: Helptext for timekeeping unit setting erroneously refers to vehicle movement (#12172) 3 months ago
Jonathan G Rennison 07278a41e5 Fix narrowing conversion warnings in pool resize capacity calculation 3 months ago
Jonathan G Rennison 3891ab57f8 Workflow: Upgrade image and actions for linux-dedicated build 3 months ago
Jonathan G Rennison 3429c324f6 Workflow: Update actions in Linux distros release 3 months ago
Jonathan G Rennison 96df846138 Workflow: Remove linux-legacy release 3 months ago
Richard Wheeler c25d9f5c81
Fix: Make link graph node borders scale with GUI (#12167) 3 months ago
Jonathan G Rennison 222832f1d4
Fix #12166: Crash when opening tram road stop build window (#12168) 3 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
3 months ago
SamuXarick b22fb43cea
Fix #10490: Allow ships to exit depots if another is not moving at the exit point (#12161) 3 months ago
Peter Nelson 2b79e7cdf5
Fix b7630b0: Incorrect padding for text purchase list. (#12160)
Restore to original (and more normal) framerect padding.
3 months ago
frosch bb86023d50
Fix #12127, 555a379: Truncation ellipses rendered shadows even for black font without shadows (#12132) 3 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
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
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 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
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
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
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
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
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

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

@ -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@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) -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@v4
uses: ./.github/workflows/ci-linux.yml
secrets: inherit
- 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 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@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 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@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 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@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: ${{ 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'

@ -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

@ -38,6 +38,19 @@ jobs:
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,13 +69,28 @@ 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@v3
@ -70,8 +98,14 @@ jobs:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml
- name: Autobuild
uses: github/codeql-action/autobuild@v3
- 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@v3

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

@ -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

@ -12,11 +12,16 @@ 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@v4
with:
@ -40,6 +45,11 @@ jobs:
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 \

@ -53,6 +53,11 @@ jobs:
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,13 +176,15 @@ 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@v4

@ -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

@ -1,2 +1,2 @@
jgrpp-0.58.0 20240224 0 64be289942b09943e8280f5ca468c8be4757f083 1 0 2024
cbec696a8bef3ab0b3b16c340c5730ddaf724d5eb5a14990d03656d5265cf3f9 -
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)
@ -536,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();
```

@ -110,9 +110,6 @@ 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.

@ -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.58.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)

@ -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/>.
*/

@ -41,6 +41,7 @@ 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()
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 +86,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 +136,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")

@ -171,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,13 +57,6 @@ 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)
@ -85,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)
@ -109,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()

@ -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}")

@ -304,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 />
@ -675,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).
@ -724,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>

@ -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>

@ -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>

@ -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,6 +2,102 @@
* * *
### 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.

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.5.
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,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; }

@ -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; }

@ -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,8 @@
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

@ -15,6 +15,8 @@
#include "sqvm.h"
#include "sqtable.h"
#include "../../../core/bit_cast.hpp"
#include "../../../string_func.h"
#include "../../../safeguards.h"
@ -660,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));
@ -707,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));

@ -12,6 +12,8 @@
#include "sqopcodes.h"
#include "sqfuncstate.h"
#include "../../../core/bit_cast.hpp"
#include "../../../safeguards.h"
#ifdef _DEBUG_DUMP
@ -198,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);
@ -241,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;
};
}

@ -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; }
}
}
@ -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()
{
@ -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);

@ -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
@ -420,6 +427,8 @@ add_files(
signs_func.h
signs_gui.cpp
signs_type.h
slider.cpp
slider_func.h
slope_func.h
slope_type.h
smallmap_colours.h

@ -27,9 +27,8 @@ public:
/**
* Start a new AI company.
* @param company At which slot the AI company should start.
* @param deviate Whether to apply random deviation to the configured AI.
*/
static void StartNew(CompanyID company, bool deviate = true);
static void StartNew(CompanyID company);
/**
* Called every game-tick to let AIs do something.

@ -35,7 +35,7 @@
return !_networking || (_network_server && _settings_game.ai.ai_in_multiplayer);
}
/* static */ void AI::StartNew(CompanyID company, bool deviate)
/* static */ void AI::StartNew(CompanyID company)
{
assert(Company::IsValidID(company));
@ -58,7 +58,6 @@
/* Load default data and store the name in the settings */
config->Change(info->GetName(), -1, false);
}
if (deviate) config->AddRandomDeviation(company);
config->AnchorUnchangeableSettings();
c->ai_info = info;
@ -213,25 +212,30 @@
if (!_settings_game.ai_config[c]->ResetInfo(true)) {
DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName().c_str());
_settings_game.ai_config[c]->Change(std::nullopt);
if (Company::IsValidAiID(c)) {
/* The code belonging to an already running AI was deleted. We can only do
* one thing here to keep everything sane and that is kill the AI. After
* killing the offending AI we start a random other one in it's place, just
* like what would happen if the AI was missing during loading. */
AI::Stop(c);
AI::StartNew(c, false);
}
} else if (Company::IsValidAiID(c)) {
/* Update the reference in the Company struct. */
Company::Get(c)->ai_info = _settings_game.ai_config[c]->GetInfo();
}
}
if (_settings_newgame.ai_config[c] != nullptr && _settings_newgame.ai_config[c]->HasScript()) {
if (!_settings_newgame.ai_config[c]->ResetInfo(false)) {
DEBUG(script, 0, "After a reload, the AI by the name '%s' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName().c_str());
_settings_newgame.ai_config[c]->Change(std::nullopt);
}
}
if (Company::IsValidAiID(c) && Company::Get(c)->ai_config != nullptr) {
AIConfig *config = Company::Get(c)->ai_config.get();
if (!config->ResetInfo(true)) {
/* The code belonging to an already running AI was deleted. We can only do
* one thing here to keep everything sane and that is kill the AI. After
* killing the offending AI we start a random other one in it's place, just
* like what would happen if the AI was missing during loading. */
AI::Stop(c);
AI::StartNew(c);
} else {
/* Update the reference in the Company struct. */
Company::Get(c)->ai_info = config->GetInfo();
}
}
}
}

@ -127,20 +127,20 @@ struct AIConfigWindow : public Window {
}
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_AIC_DECREASE_NUMBER:
case WID_AIC_INCREASE_NUMBER:
case WID_AIC_DECREASE_INTERVAL:
case WID_AIC_INCREASE_INTERVAL:
*size = maxdim(*size, NWidgetScrollbar::GetHorizontalDimension());
size = maxdim(size, NWidgetScrollbar::GetHorizontalDimension());
break;
case WID_AIC_LIST:
this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
resize->height = this->line_height;
size->height = 8 * this->line_height;
resize.height = this->line_height;
size.height = 8 * this->line_height;
break;
}
}

@ -27,7 +27,7 @@
*/
static bool CheckAPIVersion(const std::string &api_version)
{
static constexpr std::initializer_list<const char*> versions{ "0.7", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "12", "13", "14" };
static constexpr std::initializer_list<const char*> versions{ "0.7", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "1.7", "1.8", "1.9", "1.10", "1.11", "12", "13", "14", "15" };
return std::find_if(versions.begin(), versions.end(), [&](const char *v) { return api_version == v; }) != versions.end();
}

@ -67,22 +67,24 @@ int GetAircraftFlightLevel(T *v, bool takeoff = false);
struct AircraftCache {
uint32_t cached_max_range_sqr; ///< Cached squared maximum range.
uint16_t cached_max_range; ///< Cached maximum range.
byte image_movement_state; ///< Cached image aircraft movement state
uint8_t image_movement_state; ///< Cached image aircraft movement state
bool operator==(const AircraftCache &) const = default;
};
/**
* Aircraft, helicopters, rotors and their shadows belong to this class.
*/
struct Aircraft final : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
uint16_t crashed_counter; ///< Timer for handling crash animations.
byte pos; ///< Next desired position of the aircraft.
byte previous_pos; ///< Previous desired position of the aircraft.
StationID targetairport; ///< Airport to go to next.
byte state; ///< State of the airport. @see AirportMovementStates
uint16_t crashed_counter; ///< Timer for handling crash animations.
uint8_t pos; ///< Next desired position of the aircraft.
uint8_t previous_pos; ///< Previous desired position of the aircraft.
StationID targetairport; ///< Airport to go to next.
uint8_t state; ///< State of the airport. @see AirportMovementStates
Direction last_direction;
byte number_consecutive_turns; ///< Protection to prevent the aircraft of making a lot of turns in order to reach a specific point.
byte turn_counter; ///< Ticks between each turn to prevent > 45 degree turns.
byte flags; ///< Aircraft flags. @see AirVehicleFlags
uint8_t number_consecutive_turns; ///< Protection to prevent the aircraft of making a lot of turns in order to reach a specific point.
uint8_t turn_counter; ///< Ticks between each turn to prevent > 45 degree turns.
uint8_t flags; ///< Aircraft flags. @see AirVehicleFlags
AircraftCache acache;
@ -114,6 +116,7 @@ struct Aircraft final : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
void OnPeriodic() override;
uint Crash(bool flooded = false) override;
TileIndex GetOrderStationLocation(StationID station) override;
TileIndex GetCargoTile() const override { return this->First()->tile; }
ClosestDepot FindClosestDepot() override;
/**
@ -145,6 +148,6 @@ void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteS
Station *GetTargetAirportIfValid(const Aircraft *v);
void HandleMissingAircraftOrders(Aircraft *v);
const char *AirportMovementStateToString(byte state);
const char *AirportMovementStateToString(uint8_t state);
#endif /* AIRCRAFT_H */

@ -133,7 +133,7 @@ static StationID FindNearestHangar(const Aircraft *v)
const Station *next_dest = nullptr;
if (max_range != 0) {
if (v->current_order.IsType(OT_GOTO_STATION) ||
(v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() != ODATFB_NEAREST_DEPOT)) {
(v->current_order.IsType(OT_GOTO_DEPOT) && (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) == 0)) {
last_dest = Station::GetIfValid(v->last_station_visited);
next_dest = Station::GetIfValid(v->current_order.GetDestination());
} else {
@ -486,6 +486,7 @@ void Aircraft::OnNewDay()
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
if (!EconTime::UsingWallclockUnits()) AgeVehicle(this);
EconomyAgeVehicle(this);
}
void Aircraft::OnPeriodic()
@ -691,7 +692,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
* ~ acceleration * 77 (km-ish/h / 256)
*/
uint spd = v->acceleration * 77;
byte t;
uint8_t t;
/* Adjust speed limits by plane speed factor to prevent taxiing
* and take-off speeds being too low. */
@ -709,7 +710,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
speed_limit = v->vcache.cached_max_speed;
}
v->subspeed = (t = v->subspeed) + (byte)spd;
v->subspeed = (t = v->subspeed) + (uint8_t)spd;
/* Aircraft's current speed is used twice so that very fast planes are
* forced to slow down rapidly in the short distance needed. The magic
@ -736,7 +737,7 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
spd = v->GetOldAdvanceSpeed(spd);
spd += v->progress;
v->progress = (byte)spd;
v->progress = (uint8_t)spd;
return spd >> 8;
}
@ -860,7 +861,7 @@ template int GetAircraftFlightLevel(Aircraft *v, bool takeoff);
* @param rotation The rotation of the airport.
* @return The index of the entry point
*/
static byte AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc, Direction rotation)
static uint8_t AircraftGetEntryPoint(const Aircraft *v, const AirportFTAClass *apc, Direction rotation)
{
assert(v != nullptr);
assert(apc != nullptr);
@ -1268,10 +1269,13 @@ static bool HandleCrashedAircraft(Aircraft *v)
if (v->crashed_counter < 500 && st == nullptr && ((v->crashed_counter % 3) == 0) ) {
int z = GetSlopePixelZ(Clamp(v->x_pos, 0, MapMaxX() * TILE_SIZE), Clamp(v->y_pos, 0, MapMaxY() * TILE_SIZE));
v->z_pos -= 1;
if (v->z_pos == z) {
if (v->z_pos <= z) {
v->crashed_counter = 500;
v->z_pos++;
v->z_pos = z + 1;
} else {
v->crashed_counter = 0;
}
SetAircraftPosition(v, v->x_pos, v->y_pos, v->z_pos);
}
if (v->crashed_counter < 650) {
@ -1771,7 +1775,7 @@ static void AircraftEventHandler_Flying(Aircraft *v, const AirportFTAClass *apc)
/* {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
* if it is an airplane, look for LANDING, for helicopter HELILANDING
* it is possible to choose from multiple landing runways, so loop until a free one is found */
byte landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
uint8_t landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
const AirportFTA *current = apc->layout[v->pos].next;
while (current != nullptr) {
if (current->heading == landingtype) {
@ -1918,8 +1922,8 @@ static bool AirportMove(Aircraft *v, const AirportFTAClass *apc)
const AirportFTA *current = &apc->layout[v->pos];
/* we have arrived in an important state (eg terminal, hangar, etc.) */
if (current->heading == v->state) {
byte prev_pos = v->pos; // location could be changed in state, so save it before-hand
byte prev_state = v->state;
uint8_t prev_pos = v->pos; // location could be changed in state, so save it before-hand
uint8_t prev_state = v->state;
_aircraft_state_handlers[v->state](v, apc);
if (v->state != FLYING) v->previous_pos = prev_pos;
if (v->state != prev_state || v->pos != prev_pos) UpdateAircraftCache(v);
@ -2055,7 +2059,7 @@ static const MovementTerminalMapping _airport_terminal_mapping[] = {
* @param last_terminal Terminal number to stop examining.
* @return A terminal or helipad has been found, and has been assigned to the aircraft.
*/
static bool FreeTerminal(Aircraft *v, byte i, byte last_terminal)
static bool FreeTerminal(Aircraft *v, uint8_t i, uint8_t last_terminal)
{
assert(last_terminal <= lengthof(_airport_terminal_mapping));
Station *st = Station::Get(v->targetairport);
@ -2255,8 +2259,8 @@ bool Aircraft::Tick()
}
if (HasBit(this->vcache.cached_veh_flags, VCF_REDRAW_ON_SPEED_CHANGE)) {
extern byte MapAircraftMovementState(const Aircraft *v);
byte state = MapAircraftMovementState(this);
extern uint8_t MapAircraftMovementState(const Aircraft *v);
uint8_t state = MapAircraftMovementState(this);
if (state != this->acache.image_movement_state) {
this->InvalidateImageCacheOfChain();
this->acache.image_movement_state = state;
@ -2313,7 +2317,7 @@ void UpdateAirplanesOnNewStation(const Station *st)
if (!st->airport.HasHangar()) RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, st->index, true);
}
const char *AirportMovementStateToString(byte state)
const char *AirportMovementStateToString(uint8_t state)
{
#define AMS(s) case s: return #s;
switch (state) {

@ -110,12 +110,12 @@ AirportMovingData RotateAirportMovingData(const AirportMovingData *orig, Directi
AirportFTAClass::AirportFTAClass(
const AirportMovingData *moving_data_,
const byte *terminals_,
const byte num_helipads_,
const byte *entry_points_,
const uint8_t *terminals_,
const uint8_t num_helipads_,
const uint8_t *entry_points_,
Flags flags_,
const AirportFTAbuildup *apFA,
byte delta_z_
uint8_t delta_z_
) :
moving_data(moving_data_),
terminals(terminals_),
@ -204,7 +204,7 @@ static AirportFTA *AirportBuildAutomata(uint nofelements, const AirportFTAbuildu
* @param airport_type %Airport type to query FTA from. @see AirportTypes
* @return Finite state machine of the airport.
*/
const AirportFTAClass *GetAirport(const byte airport_type)
const AirportFTAClass *GetAirport(const uint8_t airport_type)
{
if (airport_type == AT_DUMMY) return &_airportfta_dummy;
return AirportSpec::Get(airport_type)->fsm;
@ -215,7 +215,7 @@ const AirportFTAClass *GetAirport(const byte airport_type)
* @param hangar_tile The tile on which the vehicle is build
* @return The position (index in airport node array) where the aircraft ends up
*/
byte GetVehiclePosOnBuild(TileIndex hangar_tile)
uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile)
{
const Station *st = Station::GetByTile(hangar_tile);
const AirportFTAClass *apc = st->airport.GetFTA();

@ -152,12 +152,12 @@ public:
AirportFTAClass(
const AirportMovingData *moving_data,
const byte *terminals,
const byte num_helipads,
const byte *entry_points,
const uint8_t *terminals,
const uint8_t num_helipads,
const uint8_t *entry_points,
Flags flags,
const AirportFTAbuildup *apFA,
byte delta_z
uint8_t delta_z
);
~AirportFTAClass();
@ -167,7 +167,7 @@ public:
* @param position Element number to get movement data about.
* @return Pointer to the movement data.
*/
const AirportMovingData *MovingData(byte position) const
const AirportMovingData *MovingData(uint8_t position) const
{
assert(position < nofelements);
return &moving_data[position];
@ -175,12 +175,12 @@ public:
const AirportMovingData *moving_data; ///< Movement data.
struct AirportFTA *layout; ///< state machine for airport
const byte *terminals; ///< %Array with the number of terminal groups, followed by the number of terminals in each group.
const byte num_helipads; ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals.
const uint8_t *terminals; ///< %Array with the number of terminal groups, followed by the number of terminals in each group.
const uint8_t num_helipads; ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals.
Flags flags; ///< Flags for this airport type.
byte nofelements; ///< number of positions the airport consists of
const byte *entry_points; ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction
byte delta_z; ///< Z adjustment for helicopter pads
uint8_t nofelements; ///< number of positions the airport consists of
const uint8_t *entry_points; ///< when an airplane arrives at this airport, enter it at position entry_point, index depends on direction
uint8_t delta_z; ///< Z adjustment for helicopter pads
};
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
@ -190,12 +190,12 @@ DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
struct AirportFTA {
AirportFTA *next; ///< possible extra movement choices from this position
uint64_t block; ///< 64 bit blocks (st->airport.flags), should be enough for the most complex airports
byte position; ///< the position that an airplane is at
byte next_position; ///< next position from this position
byte heading; ///< heading (current orders), guiding an airplane to its target on an airport
uint8_t position; ///< the position that an airplane is at
uint8_t next_position; ///< next position from this position
uint8_t heading; ///< heading (current orders), guiding an airplane to its target on an airport
};
const AirportFTAClass *GetAirport(const byte airport_type);
byte GetVehiclePosOnBuild(TileIndex hangar_tile);
const AirportFTAClass *GetAirport(const uint8_t airport_type);
uint8_t GetVehiclePosOnBuild(TileIndex hangar_tile);
#endif /* AIRPORT_H */

@ -22,7 +22,8 @@
#include "station_type.h"
#include "newgrf_airport.h"
#include "newgrf_callbacks.h"
#include "widgets/dropdown_type.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "vehicle_func.h"
@ -36,11 +37,11 @@
static AirportClassID _selected_airport_class; ///< the currently visible airport class
static int _selected_airport_index; ///< the index of the selected airport in the current class or -1
static byte _selected_airport_layout; ///< selected airport layout number.
static uint8_t _selected_airport_layout; ///< selected airport layout number.
static void ShowBuildAirportPicker(Window *parent);
SpriteID GetCustomAirportSprite(const AirportSpec *as, byte layout);
SpriteID GetCustomAirportSprite(const AirportSpec *as, uint8_t layout);
void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32_t p1, uint32_t p2, uint64_t p3, uint32_t cmd)
{
@ -232,8 +233,8 @@ class BuildAirportWindow : public PickerWindowBase {
{
DropDownList list;
for (uint i = 0; AirportClass::IsClassIDValid((AirportClassID)i); i++) {
list.push_back(std::make_unique<DropDownListStringItem>(AirportClass::Get((AirportClassID)i)->name, i, false));
for (const auto &cls : AirportClass::Classes()) {
list.push_back(MakeDropDownListStringItem(cls.name, cls.Index()));
}
return list;
@ -308,17 +309,17 @@ public:
}
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_AP_CLASS_DROPDOWN: {
Dimension d = {0, 0};
for (uint i = 0; i < AirportClass::GetClassCount(); i++) {
d = maxdim(d, GetStringBoundingBox(AirportClass::Get((AirportClassID)i)->name));
for (const auto &cls : AirportClass::Classes()) {
d = maxdim(d, GetStringBoundingBox(cls.name));
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -327,11 +328,11 @@ public:
const AirportSpec *as = AirportSpec::Get(i);
if (!as->enabled) continue;
size->width = std::max(size->width, GetStringBoundingBox(as->name).width + padding.width);
size.width = std::max(size.width, GetStringBoundingBox(as->name).width + padding.width);
}
this->line_height = GetCharacterHeight(FS_NORMAL) + padding.height;
size->height = 5 * this->line_height;
size.height = 5 * this->line_height;
break;
}
@ -339,13 +340,13 @@ public:
for (int i = 0; i < NUM_AIRPORTS; i++) {
const AirportSpec *as = AirportSpec::Get(i);
if (!as->enabled) continue;
for (byte layout = 0; layout < as->num_table; layout++) {
for (uint8_t layout = 0; layout < as->num_table; layout++) {
SpriteID sprite = GetCustomAirportSprite(as, layout);
if (sprite != 0) {
Dimension d = GetSpriteSize(sprite);
d.width += WidgetDimensions::scaled.framerect.Horizontal();
d.height += WidgetDimensions::scaled.framerect.Vertical();
*size = maxdim(d, *size);
size = maxdim(d, size);
}
}
}
@ -355,12 +356,12 @@ public:
for (int i = NEW_AIRPORT_OFFSET; i < NUM_AIRPORTS; i++) {
const AirportSpec *as = AirportSpec::Get(i);
if (!as->enabled) continue;
for (byte layout = 0; layout < as->num_table; layout++) {
for (uint8_t layout = 0; layout < as->num_table; layout++) {
StringID string = GetAirportTextCallback(as, layout, CBID_AIRPORT_ADDITIONAL_TEXT);
if (string == STR_UNDEFINED) continue;
Dimension d = GetStringMultiLineBoundingBox(string, *size);
*size = maxdim(d, *size);
Dimension d = GetStringMultiLineBoundingBox(string, size);
size = maxdim(d, size);
}
}
break;
@ -487,8 +488,8 @@ public:
break;
case WID_AP_AIRPORT_LIST: {
int num_clicked = this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
if (num_clicked == INT_MAX) break;
int32_t num_clicked = this->vscroll->GetScrolledRowFromWidget(pt.y, this, widget, 0, this->line_height);
if (num_clicked == INT32_MAX) break;
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(num_clicked);
if (as->IsAvailable()) this->SelectOtherAirport(num_clicked);
break;
@ -537,14 +538,12 @@ public:
if (change_class) {
/* If that fails, select the first available airport
* from the first class where airports are available. */
for (AirportClassID j = APC_BEGIN; j < APC_MAX; j++) {
AirportClass *apclass = AirportClass::Get(j);
for (uint i = 0; i < apclass->GetSpecCount(); i++) {
const AirportSpec *as = apclass->GetSpec(i);
for (const auto &cls : AirportClass::Classes()) {
for (const auto &as : cls.Specs()) {
if (as->IsAvailable()) {
_selected_airport_class = j;
this->vscroll->SetCount(apclass->GetSpecCount());
this->SelectOtherAirport(i);
_selected_airport_class = cls.Index();
this->vscroll->SetCount(cls.GetSpecCount());
this->SelectOtherAirport(as->GetIndex());
return;
}
}

@ -8,6 +8,7 @@
/** @file articulated_vehicles.cpp Implementation of articulated vehicles. */
#include "stdafx.h"
#include "articulated_vehicles.h"
#include "core/bitmath_func.hpp"
#include "core/random_func.hpp"
#include "train.h"
@ -141,15 +142,23 @@ void GetArticulatedPartsEngineIDs(EngineID engine_type, bool purchase_window, st
* Returns the default (non-refitted) capacity of a specific EngineID.
* @param engine the EngineID of interest
* @param cargo_type returns the default cargo type, if needed
* @param attempt_refit cargo ID to attempt to use
* @return capacity
*/
static inline uint16_t GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_type)
static inline uint16_t GetVehicleDefaultCapacity(EngineID engine, CargoID *cargo_type, CargoID attempt_refit = INVALID_CARGO)
{
const Engine *e = Engine::Get(engine);
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : INVALID_CARGO);
CargoID cargo = INVALID_CARGO;
if (e->CanCarryCargo()) {
if (attempt_refit != INVALID_CARGO && HasBit(e->info.refit_mask, attempt_refit)) {
cargo = attempt_refit;
} else {
cargo = e->GetDefaultCargoType();
}
}
if (cargo_type != nullptr) *cargo_type = cargo;
if (cargo == INVALID_CARGO) return 0;
return e->GetDisplayDefaultCapacity();
return e->GetDisplayDefaultCapacity(nullptr, cargo);
}
/**
@ -175,16 +184,20 @@ static inline CargoTypes GetAvailableVehicleCargoTypes(EngineID engine, bool inc
/**
* Get the capacity of the parts of a given engine.
* @param engine The engine to get the capacities from.
* @param attempt_refit Attempt to get capacity when refitting to this cargo.
* @return The cargo capacities.
*/
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
CargoArray GetCapacityOfArticulatedParts(EngineID engine, CargoID attempt_refit)
{
CargoArray capacity{};
const Engine *e = Engine::Get(engine);
CargoID cargo_type;
uint16_t cargo_capacity = GetVehicleDefaultCapacity(engine, &cargo_type);
if (cargo_type < NUM_CARGO) capacity[cargo_type] = cargo_capacity;
auto get_engine_cargo = [&capacity, attempt_refit](EngineID eng) {
CargoID cargo_type;
uint16_t cargo_capacity = GetVehicleDefaultCapacity(eng, &cargo_type, attempt_refit);
if (cargo_type < NUM_CARGO) capacity[cargo_type] += cargo_capacity;
};
get_engine_cargo(engine);
if (!e->IsArticulatedCallbackVehicleType()) return capacity;
@ -194,8 +207,7 @@ CargoArray GetCapacityOfArticulatedParts(EngineID engine)
EngineID artic_engine = GetNextArticulatedPart(i, engine);
if (artic_engine == INVALID_ENGINE) break;
cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
if (cargo_type < NUM_CARGO) capacity[cargo_type] += cargo_capacity;
get_engine_cargo(artic_engine);
}
return capacity;

@ -16,7 +16,7 @@
uint CountArticulatedParts(EngineID engine_type, bool purchase_window);
void GetArticulatedPartsEngineIDs(EngineID engine_type, bool purchase_window, std::vector<EngineID> &ids);
CargoArray GetCapacityOfArticulatedParts(EngineID engine);
CargoArray GetCapacityOfArticulatedParts(EngineID engine, CargoID attempt_refit = INVALID_CARGO);
CargoTypes GetCargoTypesOfArticulatedParts(EngineID engine);
void AddArticulatedParts(Vehicle *first);
void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type, CargoTypes *union_mask, CargoTypes *intersection_mask);

@ -343,7 +343,7 @@ static CommandCost BuildReplacementMultiPartShipSimple(EngineID e, const Vehicle
for (; v != nullptr && old != nullptr; v = v->Next(), old = old->Next()) {
if (old->cargo_type == INVALID_CARGO) continue;
byte subtype = GetBestFittingSubType(old, v, old->cargo_type);
uint8_t subtype = GetBestFittingSubType(old, v, old->cargo_type);
CommandCost refit_cost = DoCommand(0, v->index, old->cargo_type | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v));
if (refit_cost.Succeeded()) cost.AddCost(refit_cost);
}
@ -396,7 +396,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_
CargoID c = FindFirstBit(available);
assert(old_cargo_vehs[c] != nullptr);
byte subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c);
uint8_t subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c);
CommandCost refit_cost = DoCommand(0, v->index, c | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v));
if (refit_cost.Succeeded()) cost.AddCost(refit_cost);
}
@ -453,7 +453,7 @@ static CommandCost BuildReplacementMultiPartShip(EngineID e, const Vehicle *old_
if (c == INVALID_CARGO) continue;
assert(old_cargo_vehs[c] != nullptr);
byte subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c);
uint8_t subtype = GetBestFittingSubType(old_cargo_vehs[c], v, c);
CommandCost refit_cost = DoCommand(0, v->index, c | (subtype << 8) | (1 << 16), DC_EXEC, GetCmdRefitVeh(v));
if (refit_cost.Succeeded()) cost.AddCost(refit_cost);
}
@ -514,7 +514,7 @@ static CommandCost BuildReplacementVehicle(const Vehicle *old_veh, Vehicle **new
/* Refit the vehicle if needed */
if (refit_cargo != CARGO_NO_REFIT) {
byte subtype = GetBestFittingSubType(old_veh, new_veh, refit_cargo);
uint8_t subtype = GetBestFittingSubType(old_veh, new_veh, refit_cargo);
cost.AddCost(DoCommand(0, new_veh->index, refit_cargo | (subtype << 8), DC_EXEC, GetCmdRefitVeh(new_veh)));
assert(cost.Succeeded()); // This should be ensured by GetNewCargoTypeForReplace()
@ -557,8 +557,9 @@ static inline CommandCost CmdMoveVehicle(const Vehicle *v, const Vehicle *after,
* @param old_head The old front vehicle (no wagons attached anymore)
* @param new_head The new head of the completely replaced vehicle chain
* @param flags the command flags to use
* @param start_stop_check whether to run the start-stop check
*/
CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, DoCommandFlag flags)
CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, DoCommandFlag flags, bool start_stop_check)
{
CommandCost cost = CommandCost();
@ -569,7 +570,7 @@ CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head, DoComma
if (cost.Succeeded() && old_head != new_head) cost.AddCost(DoCommand(0, old_head->group_id, new_head->index, DC_EXEC, CMD_ADD_VEHICLE_GROUP));
/* Perform start/stop check whether the new vehicle suits newgrf restrictions etc. */
if (cost.Succeeded()) {
if (start_stop_check && cost.Succeeded()) {
/* Start the vehicle, might be denied by certain things */
assert((new_head->vehstatus & VS_STOPPED) != 0);
cost.AddCost(CmdStartStopVehicle(new_head, true));
@ -777,7 +778,6 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
/* Sell superfluous new vehicles that could not be inserted. */
if (cost.Succeeded() && wagon_removal) {
assert(Train::From(new_head)->gcache.cached_total_length <= _settings_game.vehicle.max_train_length * TILE_SIZE);
for (auto it = std::next(std::begin(replacements)); it != std::end(replacements); ++it) {
Vehicle *wagon = it->new_veh;
if (wagon == nullptr) continue;
@ -797,7 +797,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
}
/* The new vehicle chain is constructed, now take over orders and everything... */
if (cost.Succeeded()) cost.AddCost(CopyHeadSpecificThings(old_head, new_head, flags));
if (cost.Succeeded()) cost.AddCost(CopyHeadSpecificThings(old_head, new_head, flags, true));
if (cost.Succeeded()) {
/* Success ! */
@ -864,7 +864,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
*nothing_to_do = false;
/* The new vehicle is constructed, now take over orders and everything... */
cost.AddCost(CopyHeadSpecificThings(old_head, new_head, flags));
cost.AddCost(CopyHeadSpecificThings(old_head, new_head, flags, true));
if (cost.Succeeded()) {
/* The new vehicle is constructed, now take over cargo */

@ -97,7 +97,7 @@ inline CommandCost RemoveEngineReplacementForCompany(Company *c, EngineID engine
bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company);
CommandCost CopyHeadSpecificThings(Vehicle*, Vehicle*, DoCommandFlag);
CommandCost CopyHeadSpecificThings(Vehicle*, Vehicle*, DoCommandFlag, bool start_stop_check);
bool AutoreplaceMultiPartShipWouldSucceed(EngineID e, const Vehicle *old_veh, CargoTypes all_cargoes);

@ -24,15 +24,14 @@
#include "core/geometry_func.hpp"
#include "rail_gui.h"
#include "road_gui.h"
#include "widgets/dropdown_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "widgets/autoreplace_widget.h"
#include "safeguards.h"
void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_list, uint16_t min, uint16_t max, EngineID selected_id, bool show_count, GroupID selected_group);
static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListItem &b, const GUIEngineListSortCache &cache)
{
return Engine::Get(a.engine_id)->list_position < Engine::Get(b.engine_id)->list_position;
}
@ -83,7 +82,7 @@ class ReplaceVehicleWindow : public Window {
bool reset_sel_engine; ///< Also reset #sel_engine while updating left and/or right and no valid engine selected.
GroupID sel_group; ///< Group selected to replace.
int details_height; ///< Minimal needed height of the details panels, in text lines (found so far).
byte sort_criteria; ///< Criteria of sorting vehicles.
uint8_t sort_criteria; ///< Criteria of sorting vehicles.
bool descending_sort_order; ///< Order of sorting vehicles.
bool show_hidden_engines; ///< Whether to show the hidden engines.
RailType sel_railtype; ///< Type of rail tracks selected. #INVALID_RAILTYPE to show all.
@ -111,27 +110,6 @@ class ReplaceVehicleWindow : public Window {
return true;
}
void AddChildren(const GUIEngineList &source, GUIEngineList &target, EngineID parent, int indent, int side)
{
for (const auto &item : source) {
if (item.variant_id != parent || item.engine_id == parent) continue;
const Engine *e = Engine::Get(item.engine_id);
EngineDisplayFlags flags = item.flags;
if (e->display_last_variant != INVALID_ENGINE) flags &= ~EngineDisplayFlags::Shaded;
target.emplace_back(e->display_last_variant == INVALID_ENGINE ? item.engine_id : e->display_last_variant, item.engine_id, flags, indent);
/* Add variants if not folded */
if ((item.flags & (EngineDisplayFlags::HasVariants | EngineDisplayFlags::IsFolded)) == EngineDisplayFlags::HasVariants) {
/* Add this engine again as a child */
if ((item.flags & EngineDisplayFlags::Shaded) == EngineDisplayFlags::None) {
target.emplace_back(item.engine_id, item.engine_id, EngineDisplayFlags::None, indent + 1);
}
AddChildren(source, target, item.engine_id, indent + 1, side);
}
}
}
/**
* Generate an engines list
* @param draw_left true if generating the left list, otherwise false
@ -141,7 +119,7 @@ class ReplaceVehicleWindow : public Window {
std::vector<EngineID> variants;
EngineID selected_engine = INVALID_ENGINE;
VehicleType type = (VehicleType)this->window_number;
byte side = draw_left ? 0 : 1;
uint8_t side = draw_left ? 0 : 1;
GUIEngineList list;
@ -205,7 +183,7 @@ class ReplaceVehicleWindow : public Window {
this->engines[side].clear();
if (side == 1) {
AddChildren(list, this->engines[side], INVALID_ENGINE, 0, side);
GUIEngineListAddChildren(this->engines[side], list);
} else {
this->engines[side].swap(list);
}
@ -315,26 +293,26 @@ public:
this->sel_group = id_g;
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_RV_SORT_ASCENDING_DESCENDING: {
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better.
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
case WID_RV_LEFT_MATRIX:
case WID_RV_RIGHT_MATRIX:
resize->height = GetEngineListHeight((VehicleType)this->window_number);
size->height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize->height;
resize.height = GetEngineListHeight((VehicleType)this->window_number);
size.height = (this->window_number <= VEH_ROAD ? 8 : 4) * resize.height;
break;
case WID_RV_LEFT_DETAILS:
case WID_RV_RIGHT_DETAILS:
size->height = GetCharacterHeight(FS_NORMAL) * this->details_height + padding.height;
size.height = GetCharacterHeight(FS_NORMAL) * this->details_height + padding.height;
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
@ -345,7 +323,7 @@ public:
d = maxdim(d, GetStringBoundingBox(str));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -354,7 +332,7 @@ public:
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_WAGONS));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -363,7 +341,7 @@ public:
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -374,7 +352,7 @@ public:
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -385,7 +363,7 @@ public:
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -396,7 +374,7 @@ public:
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
}
@ -487,11 +465,9 @@ public:
case WID_RV_LEFT_MATRIX:
case WID_RV_RIGHT_MATRIX: {
int side = (widget == WID_RV_LEFT_MATRIX) ? 0 : 1;
EngineID start = static_cast<EngineID>(this->vscroll[side]->GetPosition()); // what is the offset for the start (scrolling)
EngineID end = static_cast<EngineID>(std::min<size_t>(this->vscroll[side]->GetCapacity() + start, this->engines[side].size()));
/* Do the actual drawing */
DrawEngineList((VehicleType)this->window_number, r, this->engines[side], start, end, this->sel_engine[side], side == 0, this->sel_group);
DrawEngineList((VehicleType)this->window_number, r, this->engines[side], *this->vscroll[side], this->sel_engine[side], side == 0, this->sel_group);
break;
}
}
@ -564,8 +540,8 @@ public:
case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
DropDownList list;
list.push_back(std::make_unique<DropDownListStringItem>(STR_REPLACE_ENGINES, 1, false));
list.push_back(std::make_unique<DropDownListStringItem>(STR_REPLACE_WAGONS, 0, false));
list.push_back(MakeDropDownListStringItem(STR_REPLACE_ENGINES, 1));
list.push_back(MakeDropDownListStringItem(STR_REPLACE_WAGONS, 0));
ShowDropDownList(this, std::move(list), this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
break;
}
@ -608,7 +584,7 @@ public:
case WID_RV_LEFT_MATRIX:
case WID_RV_RIGHT_MATRIX: {
byte click_side;
uint8_t click_side;
if (widget == WID_RV_LEFT_MATRIX) {
click_side = 0;
} else {

@ -314,7 +314,7 @@ static const uint NUM_SONGS_PLAYLIST = 32;
/* Functions to read DOS music CAT files, similar to but not quite the same as sound effect CAT files */
char *GetMusicCatEntryName(const std::string &filename, size_t entrynum);
byte *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen);
uint8_t *GetMusicCatEntryData(const std::string &filename, size_t entrynum, size_t &entrylen);
enum MusicTrackType {
MTT_STANDARDMIDI, ///< Standard MIDI file
@ -324,7 +324,7 @@ enum MusicTrackType {
/** Metadata about a music track. */
struct MusicSongInfo {
std::string songname; ///< name of song displayed in UI
byte tracknr; ///< track number of song displayed in UI
uint8_t tracknr; ///< track number of song displayed in UI
std::string filename; ///< file on disk containing song (when used in MusicSet class)
MusicTrackType filetype; ///< decoder required for song file
int cat_index; ///< entry index in CAT file, for filetype==MTT_MPSMIDI
@ -338,7 +338,7 @@ struct MusicSet : BaseSet<MusicSet, NUM_SONGS_AVAILABLE, false> {
/** Data about individual songs in set. */
MusicSongInfo songinfo[NUM_SONGS_AVAILABLE];
/** Number of valid songs in set. */
byte num_available;
uint8_t num_available;
bool FillSetDetails(const IniFile &ini, const std::string &path, const std::string &full_filename);
};

@ -22,17 +22,15 @@
typedef Pool<BaseStation, StationID, 32, 64000> StationPool;
extern StationPool _station_pool;
struct StationSpecList {
const StationSpec *spec;
template <typename T>
struct SpecMapping {
const T *spec; ///< Custom spec.
uint32_t grfid; ///< GRF ID of this custom station
uint16_t localidx; ///< Station ID within GRF of station
};
struct RoadStopSpecList {
const RoadStopSpec *spec;
uint32_t grfid; ///< GRF ID of this custom road stop
uint16_t localidx; ///< Station ID within GRF of road stop
};
using StationSpecList = SpecMapping<StationSpec>;
using RoadStopSpecList = SpecMapping<RoadStopSpec>;
struct RoadStopTileData {
TileIndex tile;
@ -82,8 +80,8 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
std::vector<RoadStopSpecList> roadstop_speclist; ///< List of road stop specs of this station
uint16_t random_bits; ///< Random bits assigned to this station
byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station
byte delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
uint8_t waiting_triggers; ///< Waiting triggers (NewGRF) for this station
uint8_t delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
uint8_t cached_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask, used to determine if trigger processing should happen.
uint8_t cached_roadstop_anim_triggers; ///< NOSAVE: Combined animation trigger bitmask for road stops, used to determine if trigger processing should happen.
CargoTypes cached_cargo_triggers; ///< NOSAVE: Combined cargo trigger bitmask
@ -121,7 +119,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
* @param available will return false if ever the variable asked for does not exist
* @return the value stored in the corresponding variable
*/
virtual uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint16_t variable, byte parameter, bool *available) const = 0;
virtual uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint16_t variable, uint8_t parameter, bool *available) const = 0;
/**
* Update the coordinated of the sign (as shown in the viewport).
@ -197,7 +195,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
return (this->facilities & facilities) != 0;
}
inline byte GetRoadStopRandomBits(TileIndex tile) const
inline uint8_t GetRoadStopRandomBits(TileIndex tile) const
{
for (const RoadStopTileData &tile_data : this->custom_roadstop_tile_data) {
if (tile_data.tile == tile) return tile_data.random_bits;
@ -205,7 +203,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
return 0;
}
inline byte GetRoadStopAnimationFrame(TileIndex tile) const
inline uint8_t GetRoadStopAnimationFrame(TileIndex tile) const
{
for (const RoadStopTileData &tile_data : this->custom_roadstop_tile_data) {
if (tile_data.tile == tile) return tile_data.animation_frame;
@ -214,11 +212,11 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
}
private:
bool SetRoadStopTileData(TileIndex tile, byte data, bool animation);
bool SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation);
public:
inline void SetRoadStopRandomBits(TileIndex tile, byte random_bits) { this->SetRoadStopTileData(tile, random_bits, false); }
inline bool SetRoadStopAnimationFrame(TileIndex tile, byte frame) { return this->SetRoadStopTileData(tile, frame, true); }
inline void SetRoadStopRandomBits(TileIndex tile, uint8_t random_bits) { this->SetRoadStopTileData(tile, random_bits, false); }
inline bool SetRoadStopAnimationFrame(TileIndex tile, uint8_t frame) { return this->SetRoadStopTileData(tile, frame, true); }
void RemoveRoadStopTileData(TileIndex tile);
static void PostDestructor(size_t index);
@ -323,4 +321,14 @@ struct SpecializedStation : public BaseStation {
static Pool::IterateWrapper<T> Iterate(size_t from = 0) { return Pool::IterateWrapper<T>(from); }
};
/**
* Get spec mapping list for each supported custom spec type.
* @tparam T Spec type.
* @param bst Station of custom spec list.
* @return Speclist of custom spec type.
*/
template <class T> std::vector<SpecMapping<T>> &GetStationSpecList(BaseStation *bst);
template <> inline std::vector<SpecMapping<StationSpec>> &GetStationSpecList<StationSpec>(BaseStation *bst) { return bst->speclist; }
template <> inline std::vector<SpecMapping<RoadStopSpec>> &GetStationSpecList<RoadStopSpec>(BaseStation *bst) { return bst->roadstop_speclist; }
#endif /* BASE_STATION_BASE_H */

@ -36,14 +36,14 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
const uint16_t *src_n = (const uint16_t *)(src->data + src->offset[zoom][1]);
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
}
Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
uint16_t *anim = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)bp->dst) + bp->top * this->anim_buf_pitch + bp->left;
const byte *remap = bp->remap; // store so we don't have to access it via bp every time
const uint8_t *remap = bp->remap; // store so we don't have to access it via bp every time
const int width = bp->width;
const int pitch = bp->pitch;
const int anim_pitch = this->anim_buf_pitch;
@ -54,10 +54,10 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
Colour *dst_ln = dst + pitch;
uint16_t *anim_ln = anim + anim_pitch;
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
src_px++;
const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
src_n += 2;
Colour *dst_end = dst;

@ -33,7 +33,7 @@ template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bpp
GNU_TARGET("sse4.1")
inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom)
{
const byte * const remap = bp->remap;
const uint8_t * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
uint16_t *anim_line = this->anim_buf + this->ScreenToAnimOffset((uint32_t *)bp->dst) + bp->top * this->anim_buf_pitch + bp->left;
int effective_width = bp->width;
@ -42,7 +42,7 @@ inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom
const Blitter_32bppSSE_Base::SpriteData * const sd = (const Blitter_32bppSSE_Base::SpriteData *) bp->sprite;
const SpriteInfo * const si = &sd->infos[zoom];
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
const Colour *src_rgba_line = (const Colour *) ((const uint8_t *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
if (read_mode != RM_WITH_MARGIN) {
src_rgba_line += bp->skip_left;
@ -104,20 +104,20 @@ inline void Blitter_32bppSSE4_Anim::Draw(const BlitterParams *bp, ZoomLevel zoom
if (animated) {
/* Remap colours. */
const byte m0 = mvX2;
const uint8_t m0 = mvX2;
if (m0 >= PALETTE_ANIM_START) {
const Colour c0 = (this->LookupColourInPalette(m0).data & 0x00FFFFFF) | (src[0].data & 0xFF000000);
InsertFirstUint32(AdjustBrightneSSE(c0, (byte) (mvX2 >> 8)).data, srcABCD);
InsertFirstUint32(AdjustBrightneSSE(c0, (uint8_t) (mvX2 >> 8)).data, srcABCD);
}
const byte m1 = mvX2 >> 16;
const uint8_t m1 = mvX2 >> 16;
if (m1 >= PALETTE_ANIM_START) {
const Colour c1 = (this->LookupColourInPalette(m1).data & 0x00FFFFFF) | (src[1].data & 0xFF000000);
InsertSecondUint32(AdjustBrightneSSE(c1, (byte) (mvX2 >> 24)).data, srcABCD);
InsertSecondUint32(AdjustBrightneSSE(c1, (uint8_t) (mvX2 >> 24)).data, srcABCD);
}
/* Update anim buffer. */
const byte a0 = src[0].a;
const byte a1 = src[1].a;
const uint8_t a0 = src[0].a;
const uint8_t a1 = src[1].a;
uint32_t anim01 = 0;
if (a0 == 255) {
if (a1 == 255) {
@ -185,9 +185,9 @@ bmno_full_transparency:
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
/* Remap colours. */
const uint m0 = (byte) mvX2;
const uint m0 = (uint8_t) mvX2;
const uint r0 = remap[m0];
const uint m1 = (byte) (mvX2 >> 16);
const uint m1 = (uint8_t) (mvX2 >> 16);
const uint r1 = remap[m1];
if (mvX2 & 0x00FF00FF) {
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
@ -195,7 +195,7 @@ bmno_full_transparency:
Colour m_colour = m_colour_init; \
{ \
const Colour srcm = (Colour) (m_src); \
const uint m = (byte) (m_m); \
const uint m = (uint8_t) (m_m); \
const uint r = remap[m]; \
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
m_colour = r == 0 ? m_colour : cmap; \
@ -225,8 +225,8 @@ bmno_full_transparency:
/* Update anim buffer. */
if (animated) {
const byte a0 = src[0].a;
const byte a1 = src[1].a;
const uint8_t a0 = src[0].a;
const uint8_t a1 = src[1].a;
uint32_t anim01 = mvX2 & 0xFF00FF00;
if (a0 == 255) {
anim01 |= r0;
@ -437,7 +437,7 @@ bmcr_alpha_blend_single_brightness:
next_line:
if (mode != BM_TRANSPARENT && mode != BM_TRANSPARENT_REMAP) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
src_rgba_line = (const Colour*) ((const uint8_t*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
anim_line += this->anim_buf_pitch;
}

@ -41,26 +41,26 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
/* skip upper lines in src_px and src_n */
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
}
/* skip lines in dst */
Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
/* store so we don't have to access it via bp every time (compiler assumes pointer aliasing) */
const byte *remap = bp->remap;
const uint8_t *remap = bp->remap;
for (int y = 0; y < bp->height; y++) {
/* next dst line begins here */
Colour *dst_ln = dst + bp->pitch;
/* next src line begins here */
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
src_px++;
/* next src_n line begins here */
const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
src_n += 2;
/* we will end this line when we reach this point */
@ -317,9 +317,9 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
ZoomLevel zoom_max;
uint8_t missing_zoom_levels = 0;
if (sprite[ZOOM_LVL_NORMAL].type == SpriteType::Font) {
zoom_min = ZOOM_LVL_NORMAL;
zoom_max = ZOOM_LVL_NORMAL;
if (sprite[ZOOM_LVL_MIN].type == SpriteType::Font) {
zoom_min = ZOOM_LVL_MIN;
zoom_max = ZOOM_LVL_MIN;
} else {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = (ZoomLevel) std::min(_settings_client.gui.zoom_max, ZOOM_LVL_DRAW_SPR);
@ -459,8 +459,8 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
dst_n_ln = (uint32_t *)dst_n;
}
lengths[z][0] = (byte *)dst_px_ln - (byte *)dst_px_orig[z]; // all are aligned to 4B boundary
lengths[z][1] = (byte *)dst_n_ln - (byte *)dst_n_orig[z];
lengths[z][0] = (uint8_t *)dst_px_ln - (uint8_t *)dst_px_orig[z]; // all are aligned to 4B boundary
lengths[z][1] = (uint8_t *)dst_n_ln - (uint8_t *)dst_n_orig[z];
px_buffer_next = (Colour *)dst_px_ln;
n_buffer_next = (uint16_t *)dst_n_ln;
@ -478,10 +478,10 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
missing_zoom_levels = UINT8_MAX;
}
dest_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
dest_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
dest_sprite->height = sprite[ZOOM_LVL_MIN].height;
dest_sprite->width = sprite[ZOOM_LVL_MIN].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
dest_sprite->next = nullptr;
dest_sprite->missing_zoom_levels = missing_zoom_levels;

@ -19,7 +19,7 @@ public:
struct SpriteData {
BlitterSpriteFlags flags;
uint32_t offset[ZOOM_LVL_SPR_COUNT][2]; ///< Offsets (from .data) to streams for different zoom levels, and the normal and remap image information.
byte data[]; ///< Data, all zoomlevels.
uint8_t data[]; ///< Data, all zoomlevels.
};
Blitter_32bppOptimized()

@ -137,19 +137,19 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
Sprite *Blitter_32bppSimple::Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator)
{
Blitter_32bppSimple::Pixel *dst;
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite[ZOOM_LVL_NORMAL].height * (size_t)sprite[ZOOM_LVL_NORMAL].width * sizeof(*dst));
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite[ZOOM_LVL_MIN].height * (size_t)sprite[ZOOM_LVL_MIN].width * sizeof(*dst));
dest_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
dest_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
dest_sprite->height = sprite[ZOOM_LVL_MIN].height;
dest_sprite->width = sprite[ZOOM_LVL_MIN].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
dest_sprite->next = nullptr;
dest_sprite->missing_zoom_levels = 0;
dst = (Blitter_32bppSimple::Pixel *)dest_sprite->data;
SpriteLoader::CommonPixel *src = (SpriteLoader::CommonPixel *)sprite[ZOOM_LVL_NORMAL].data;
SpriteLoader::CommonPixel *src = (SpriteLoader::CommonPixel *)sprite[ZOOM_LVL_MIN].data;
for (int i = 0; i < sprite[ZOOM_LVL_NORMAL].height * sprite[ZOOM_LVL_NORMAL].width; i++) {
for (int i = 0; i < sprite[ZOOM_LVL_MIN].height * sprite[ZOOM_LVL_MIN].width; i++) {
if (src->m == 0) {
dst[i].r = src->r;
dst[i].g = src->g;

@ -26,10 +26,10 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri
* Second uint32_t of a line = the number of transparent pixels from the right.
* Then all RGBA then all MV.
*/
ZoomLevel zoom_min = ZOOM_LVL_NORMAL;
ZoomLevel zoom_max = ZOOM_LVL_NORMAL;
ZoomLevel zoom_min = ZOOM_LVL_MIN;
ZoomLevel zoom_max = ZOOM_LVL_MIN;
uint8_t missing_zoom_levels = 0;
if (sprite[ZOOM_LVL_NORMAL].type != SpriteType::Font) {
if (sprite[ZOOM_LVL_MIN].type != SpriteType::Font) {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = (ZoomLevel) std::min(_settings_client.gui.zoom_max, ZOOM_LVL_DRAW_SPR);
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_DRAW_SPR;
@ -62,10 +62,10 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri
}
Sprite *dst_sprite = (Sprite *) allocator(sizeof(Sprite) + sizeof(SpriteData) + all_sprites_size);
dst_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
dst_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
dst_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
dst_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
dst_sprite->height = sprite[ZOOM_LVL_MIN].height;
dst_sprite->width = sprite[ZOOM_LVL_MIN].width;
dst_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
dst_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
dst_sprite->next = nullptr;
dst_sprite->missing_zoom_levels = missing_zoom_levels;
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
@ -142,7 +142,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::SpriteCollection &spri
(*dst_rgba_line).data = nb_pix_transp;
Colour *nb_right = dst_rgba_line + 1;
dst_rgba_line = (Colour*) ((byte*) dst_rgba_line + sd.infos[z].sprite_line_size);
dst_rgba_line = (Colour*) ((uint8_t*) dst_rgba_line + sd.infos[z].sprite_line_size);
/* Count the number of transparent pixels from the right. */
dst_rgba = dst_rgba_line - 1;

@ -61,7 +61,7 @@ public:
struct SpriteData {
BlitterSpriteFlags flags;
SpriteInfo infos[ZOOM_LVL_SPR_COUNT];
byte data[]; ///< Data, all zoomlevels.
uint8_t data[]; ///< Data, all zoomlevels.
};
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator);

@ -10,10 +10,17 @@
#ifndef BLITTER_32BPP_SSE_FUNC_HPP
#define BLITTER_32BPP_SSE_FUNC_HPP
/* ATTENTION
* This file is compiled multiple times with different defines for SSE_VERSION and MARGIN_NORMAL_THRESHOLD.
* Be careful when declaring things with external linkage.
* Use internal linkage instead, i.e. "static".
*/
#define INTERNAL_LINKAGE static
#ifdef WITH_SSE
GNU_TARGET(SSE_TARGET)
inline void InsertFirstUint32(const uint32_t value, __m128i &into)
INTERNAL_LINKAGE inline void InsertFirstUint32(const uint32_t value, __m128i &into)
{
#if (SSE_VERSION >= 4)
into = _mm_insert_epi32(into, value, 0);
@ -24,7 +31,7 @@ inline void InsertFirstUint32(const uint32_t value, __m128i &into)
}
GNU_TARGET(SSE_TARGET)
inline void InsertSecondUint32(const uint32_t value, __m128i &into)
INTERNAL_LINKAGE inline void InsertSecondUint32(const uint32_t value, __m128i &into)
{
#if (SSE_VERSION >= 4)
into = _mm_insert_epi32(into, value, 1);
@ -35,7 +42,7 @@ inline void InsertSecondUint32(const uint32_t value, __m128i &into)
}
GNU_TARGET(SSE_TARGET)
inline void LoadUint64(const uint64_t value, __m128i &into)
INTERNAL_LINKAGE inline void LoadUint64(const uint64_t value, __m128i &into)
{
#ifdef POINTER_IS_64BIT
into = _mm_cvtsi64_si128(value);
@ -50,7 +57,7 @@ inline void LoadUint64(const uint64_t value, __m128i &into)
}
GNU_TARGET(SSE_TARGET)
inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
INTERNAL_LINKAGE inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
{
#if (SSE_VERSION == 2)
from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing
@ -61,7 +68,7 @@ inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
}
GNU_TARGET(SSE_TARGET)
inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
INTERNAL_LINKAGE inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
{
#if (SSE_VERSION == 2)
__m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1
@ -73,7 +80,7 @@ inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
}
GNU_TARGET(SSE_TARGET)
inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask)
INTERNAL_LINKAGE inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask, const __m128i &alpha_mask)
{
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8_t into uint16
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
@ -97,7 +104,7 @@ inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &dist
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
*/
GNU_TARGET(SSE_TARGET)
inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
INTERNAL_LINKAGE inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
{
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
@ -111,7 +118,7 @@ inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribu
IGNORE_UNINITIALIZED_WARNING_START
GNU_TARGET(SSE_TARGET)
static Colour ReallyAdjustBrightness(Colour colour, uint8_t brightness)
INTERNAL_LINKAGE Colour ReallyAdjustBrightness(Colour colour, uint8_t brightness)
{
uint64_t c16 = colour.b | (uint64_t) colour.g << 16 | (uint64_t) colour.r << 32;
c16 *= brightness;
@ -145,7 +152,7 @@ IGNORE_UNINITIALIZED_WARNING_STOP
/** ReallyAdjustBrightness() is not called that often.
* Inlining this function implies a far jump, which has a huge latency.
*/
inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness)
INTERNAL_LINKAGE inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness)
{
/* Shortcut for normal brightness. */
if (likely(brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS)) return colour;
@ -154,7 +161,7 @@ inline Colour AdjustBrightneSSE(Colour colour, uint8_t brightness)
}
GNU_TARGET(SSE_TARGET)
inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness)
INTERNAL_LINKAGE inline __m128i AdjustBrightnessOfTwoPixels([[maybe_unused]] __m128i from, [[maybe_unused]] uint32_t brightness)
{
#if (SSE_VERSION < 3)
NOT_REACHED();
@ -214,7 +221,7 @@ inline void Blitter_32bppSSSE3::Draw(const Blitter::BlitterParams *bp, ZoomLevel
inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#endif
{
const byte * const remap = bp->remap;
const uint8_t * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
int effective_width = bp->width;
@ -222,7 +229,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
const SpriteData * const sd = (const SpriteData *) bp->sprite;
const SpriteInfo * const si = &sd->infos[zoom];
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
const Colour *src_rgba_line = (const Colour *) ((const uint8_t *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
uint32_t bm_normal_brightness = 0;
if (mode == BM_NORMAL_WITH_BRIGHTNESS) {
@ -313,7 +320,7 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
Colour m_colour = m_colour_init; \
{ \
const Colour srcm = (Colour) (m_src); \
const uint m = (byte) (m_m); \
const uint m = (uint8_t) (m_m); \
const uint r = remap[m]; \
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
m_colour = r == 0 ? m_colour : cmap; \
@ -496,7 +503,7 @@ bmcr_alpha_blend_single_brightness:
next_line:
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP || mode == BM_COLOUR_REMAP_WITH_BRIGHTNESS) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
src_rgba_line = (const Colour*) ((const uint8_t*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
}
}

@ -10,6 +10,12 @@
#ifndef BLITTER_32BPP_SSE_TYPE_H
#define BLITTER_32BPP_SSE_TYPE_H
/* ATTENTION
* This file is compiled multiple times with different defines for SSE_VERSION.
* Be careful when declaring things with external linkage.
* Use internal linkage instead, i.e. "static".
*/
#ifdef WITH_SSE
#include "32bpp_simple.hpp"
@ -22,7 +28,7 @@
#endif
#define META_LENGTH 2 ///< Number of uint32_t inserted before each line of pixels in a sprite.
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_32X ? 8 : 4) ///< Minimum width to use margins with BM_NORMAL.
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_8X ? 8 : 4) ///< Minimum width to use margins with BM_NORMAL.
#define MARGIN_REMAP_THRESHOLD 4 ///< Minimum width to use margins with BM_COLOUR_REMAP.
#undef ALIGN

@ -167,8 +167,8 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
/* skip upper lines in src_px and src_n */
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
src_px = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
src_n = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
}
/* skip lines in dst */
@ -177,7 +177,7 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
uint8_t *anim = VideoDriver::GetInstance()->GetAnimBuffer() + ((uint32_t *)bp->dst - (uint32_t *)_screen.dst_ptr) + bp->top * bp->pitch + bp->left;
/* store so we don't have to access it via bp everytime (compiler assumes pointer aliasing) */
const byte *remap = bp->remap;
const uint8_t *remap = bp->remap;
for (int y = 0; y < bp->height; y++) {
/* next dst line begins here */
@ -185,11 +185,11 @@ inline void Blitter_40bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
uint8_t *anim_ln = anim + bp->pitch;
/* next src line begins here */
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32_t *)src_px);
const Colour *src_px_ln = (const Colour *)((const uint8_t *)src_px + *(const uint32_t *)src_px);
src_px++;
/* next src_n line begins here */
const uint16_t *src_n_ln = (const uint16_t *)((const byte *)src_n + *(const uint32_t *)src_n);
const uint16_t *src_n_ln = (const uint16_t *)((const uint8_t *)src_n + *(const uint32_t *)src_n);
src_n += 2;
/* we will end this line when we reach this point */

@ -129,9 +129,9 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri
ZoomLevel zoom_min;
ZoomLevel zoom_max;
if (sprite[ZOOM_LVL_NORMAL].type == SpriteType::Font) {
zoom_min = ZOOM_LVL_NORMAL;
zoom_max = ZOOM_LVL_NORMAL;
if (sprite[ZOOM_LVL_MIN].type == SpriteType::Font) {
zoom_min = ZOOM_LVL_MIN;
zoom_max = ZOOM_LVL_MIN;
} else {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = (ZoomLevel) std::min(_settings_client.gui.zoom_max, ZOOM_LVL_DRAW_SPR);
@ -148,10 +148,10 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri
/* Don't allocate memory each time, but just keep some
* memory around as this function is called quite often
* and the memory usage is quite low. */
static ReusableBuffer<byte> temp_buffer;
static ReusableBuffer<uint8_t> temp_buffer;
SpriteData *temp_dst = (SpriteData *)temp_buffer.Allocate(memory);
memset(temp_dst, 0, sizeof(*temp_dst));
byte *dst = temp_dst->data;
uint8_t *dst = temp_dst->data;
/* Make the sprites per zoom-level */
for (ZoomLevel i = zoom_min; i <= zoom_max; i++) {
@ -167,7 +167,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri
uint trans = 0;
uint pixels = 0;
uint last_colour = 0;
byte *count_dst = nullptr;
uint8_t *count_dst = nullptr;
/* Store the scaled image */
const SpriteLoader::CommonPixel *src = &sprite[i].data[y * sprite[i].width];
@ -214,7 +214,7 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri
}
}
uint size = dst - (byte *)temp_dst;
uint size = dst - (uint8_t *)temp_dst;
/* Safety check, to make sure we guessed the size correctly */
assert(size < memory);
@ -222,10 +222,10 @@ Sprite *Blitter_8bppOptimized::Encode(const SpriteLoader::SpriteCollection &spri
/* Allocate the exact amount of memory we need */
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + size);
dest_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
dest_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
dest_sprite->height = sprite[ZOOM_LVL_MIN].height;
dest_sprite->width = sprite[ZOOM_LVL_MIN].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
dest_sprite->next = nullptr;
dest_sprite->missing_zoom_levels = 0;
memcpy(dest_sprite->data, temp_dst, size);

@ -19,7 +19,7 @@ public:
/** Data stored about a (single) sprite. */
struct SpriteData {
uint32_t offset[ZOOM_LVL_SPR_COUNT]; ///< Offsets (from .data) to streams for different zoom levels.
byte data[]; ///< Data, all zoomlevels.
uint8_t data[]; ///< Data, all zoomlevels.
};
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;

@ -65,18 +65,18 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
Sprite *Blitter_8bppSimple::Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator)
{
Sprite *dest_sprite;
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite[ZOOM_LVL_NORMAL].height * (size_t)sprite[ZOOM_LVL_NORMAL].width);
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + (size_t)sprite[ZOOM_LVL_MIN].height * (size_t)sprite[ZOOM_LVL_MIN].width);
dest_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
dest_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
dest_sprite->height = sprite[ZOOM_LVL_MIN].height;
dest_sprite->width = sprite[ZOOM_LVL_MIN].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
dest_sprite->next = nullptr;
dest_sprite->missing_zoom_levels = 0;
/* Copy over only the 'remap' channel, as that is what we care about in 8bpp */
for (int i = 0; i < sprite[ZOOM_LVL_NORMAL].height * sprite[ZOOM_LVL_NORMAL].width; i++) {
dest_sprite->data[i] = sprite[ZOOM_LVL_NORMAL].data[i].m;
for (int i = 0; i < sprite[ZOOM_LVL_MIN].height * sprite[ZOOM_LVL_MIN].width; i++) {
dest_sprite->data[i] = sprite[ZOOM_LVL_MIN].data[i].m;
}
return dest_sprite;

@ -58,7 +58,7 @@ public:
/** Parameters related to blitting. */
struct BlitterParams {
const void *sprite; ///< Pointer to the sprite how ever the encoder stored it
const byte *remap; ///< XXX -- Temporary storage for remap array
const uint8_t *remap; ///< XXX -- Temporary storage for remap array
int brightness_adjust; ///< Brightness adjustment
int skip_left; ///< How much pixels of the source to skip on the left (based on zoom of dst)

@ -94,7 +94,7 @@ public:
* @param name the blitter to select.
* @post Sets the blitter so GetCurrentBlitter() returns it too.
*/
static Blitter *SelectBlitter(const std::string &name)
static Blitter *SelectBlitter(const std::string_view name)
{
BlitterFactory *b = GetBlitterFactory(name);
if (b == nullptr) return nullptr;
@ -112,17 +112,17 @@ public:
* @param name the blitter factory to select.
* @return The blitter factory, or nullptr when there isn't one with the wanted name.
*/
static BlitterFactory *GetBlitterFactory(const std::string &name)
static BlitterFactory *GetBlitterFactory(const std::string_view name)
{
#if defined(DEDICATED)
const char *default_blitter = "null";
const std::string_view default_blitter = "null";
#elif defined(WITH_COCOA)
const char *default_blitter = "32bpp-anim";
const std::string_view default_blitter = "32bpp-anim";
#else
const char *default_blitter = "8bpp-optimized";
const std::string_view default_blitter = "8bpp-optimized";
#endif
if (GetBlitters().empty()) return nullptr;
const char *bname = name.empty() ? default_blitter : name.c_str();
const std::string_view bname = name.empty() ? default_blitter : name;
for (auto &it : GetBlitters()) {
BlitterFactory *b = it.second;

@ -20,10 +20,10 @@ Sprite *Blitter_Null::Encode(const SpriteLoader::SpriteCollection &sprite, Alloc
Sprite *dest_sprite;
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite));
dest_sprite->height = sprite[ZOOM_LVL_NORMAL].height;
dest_sprite->width = sprite[ZOOM_LVL_NORMAL].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_NORMAL].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_NORMAL].y_offs;
dest_sprite->height = sprite[ZOOM_LVL_MIN].height;
dest_sprite->width = sprite[ZOOM_LVL_MIN].width;
dest_sprite->x_offs = sprite[ZOOM_LVL_MIN].x_offs;
dest_sprite->y_offs = sprite[ZOOM_LVL_MIN].y_offs;
dest_sprite->next = nullptr;
dest_sprite->missing_zoom_levels = 0;

@ -39,7 +39,7 @@ static inline bool EndOfBuffer(BmpBuffer *buffer)
return buffer->pos == buffer->read;
}
static inline byte ReadByte(BmpBuffer *buffer)
static inline uint8_t ReadByte(BmpBuffer *buffer)
{
if (buffer->read < 0) return 0;
@ -83,9 +83,9 @@ static inline void SetStreamOffset(BmpBuffer *buffer, int offset)
static inline bool BmpRead1(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
uint x, y, i;
byte pad = GB(4 - info->width / 8, 0, 2);
byte *pixel_row;
byte b;
uint8_t pad = GB(4 - info->width / 8, 0, 2);
uint8_t *pixel_row;
uint8_t b;
for (y = info->height; y > 0; y--) {
x = 0;
pixel_row = &data->bitmap[(y - 1) * info->width];
@ -110,9 +110,9 @@ static inline bool BmpRead1(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
static inline bool BmpRead4(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
uint x, y;
byte pad = GB(4 - info->width / 2, 0, 2);
byte *pixel_row;
byte b;
uint8_t pad = GB(4 - info->width / 2, 0, 2);
uint8_t *pixel_row;
uint8_t b;
for (y = info->height; y > 0; y--) {
x = 0;
pixel_row = &data->bitmap[(y - 1) * info->width];
@ -140,12 +140,12 @@ static inline bool BmpRead4Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
uint x = 0;
uint y = info->height - 1;
byte *pixel = &data->bitmap[y * info->width];
uint8_t *pixel = &data->bitmap[y * info->width];
while (y != 0 || x < info->width) {
if (EndOfBuffer(buffer)) return false; // the file is shorter than expected
byte n = ReadByte(buffer);
byte c = ReadByte(buffer);
uint8_t n = ReadByte(buffer);
uint8_t c = ReadByte(buffer);
if (n == 0) {
switch (c) {
case 0: // end of line
@ -159,8 +159,8 @@ static inline bool BmpRead4Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
case 2: { // delta
if (EndOfBuffer(buffer)) return false;
byte dx = ReadByte(buffer);
byte dy = ReadByte(buffer);
uint8_t dx = ReadByte(buffer);
uint8_t dy = ReadByte(buffer);
/* Check for over- and underflow. */
if (x + dx >= info->width || x + dx < x || dy > y) return false;
@ -175,7 +175,7 @@ static inline bool BmpRead4Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
uint i = 0;
while (i++ < c) {
if (EndOfBuffer(buffer) || x >= info->width) return false;
byte b = ReadByte(buffer);
uint8_t b = ReadByte(buffer);
*pixel++ = GB(b, 4, 4);
x++;
if (i++ < c) {
@ -214,8 +214,8 @@ static inline bool BmpRead8(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
uint i;
uint y;
byte pad = GB(4 - info->width, 0, 2);
byte *pixel;
uint8_t pad = GB(4 - info->width, 0, 2);
uint8_t *pixel;
for (y = info->height; y > 0; y--) {
if (EndOfBuffer(buffer)) return false; // the file is shorter than expected
pixel = &data->bitmap[(y - 1) * info->width];
@ -233,12 +233,12 @@ static inline bool BmpRead8Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
uint x = 0;
uint y = info->height - 1;
byte *pixel = &data->bitmap[y * info->width];
uint8_t *pixel = &data->bitmap[y * info->width];
while (y != 0 || x < info->width) {
if (EndOfBuffer(buffer)) return false; // the file is shorter than expected
byte n = ReadByte(buffer);
byte c = ReadByte(buffer);
uint8_t n = ReadByte(buffer);
uint8_t c = ReadByte(buffer);
if (n == 0) {
switch (c) {
case 0: // end of line
@ -252,8 +252,8 @@ static inline bool BmpRead8Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
case 2: { // delta
if (EndOfBuffer(buffer)) return false;
byte dx = ReadByte(buffer);
byte dy = ReadByte(buffer);
uint8_t dx = ReadByte(buffer);
uint8_t dy = ReadByte(buffer);
/* Check for over- and underflow. */
if (x + dx >= info->width || x + dx < x || dy > y) return false;
@ -294,8 +294,8 @@ static inline bool BmpRead8Rle(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
static inline bool BmpRead24(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
uint x, y;
byte pad = GB(4 - info->width * 3, 0, 2);
byte *pixel_row;
uint8_t pad = GB(4 - info->width * 3, 0, 2);
uint8_t *pixel_row;
for (y = info->height; y > 0; y--) {
pixel_row = &data->bitmap[(y - 1) * info->width * 3];
for (x = 0; x < info->width; x++) {
@ -395,7 +395,7 @@ bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
assert(info != nullptr && data != nullptr);
data->bitmap = CallocT<byte>(static_cast<size_t>(info->width) * info->height * ((info->bpp == 24) ? 3 : 1));
data->bitmap = CallocT<uint8_t>(static_cast<size_t>(info->width) * info->height * ((info->bpp == 24) ? 3 : 1));
/* Load image */
SetStreamOffset(buffer, info->offset);

@ -24,13 +24,13 @@ struct BmpInfo {
struct BmpData {
Colour *palette;
byte *bitmap;
uint8_t *bitmap;
};
#define BMP_BUFFER_SIZE 1024
struct BmpBuffer {
byte data[BMP_BUFFER_SIZE];
uint8_t data[BMP_BUFFER_SIZE];
int pos;
int read;
FILE *file;

@ -96,12 +96,12 @@ public:
this->Window::Close();
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
if (widget == WID_BEM_MESSAGE) {
*size = GetStringBoundingBox(STR_MISSING_GRAPHICS_ERROR);
size->width += WidgetDimensions::scaled.frametext.Horizontal();
size->height += WidgetDimensions::scaled.frametext.Vertical();
size = GetStringBoundingBox(STR_MISSING_GRAPHICS_ERROR);
size.width += WidgetDimensions::scaled.frametext.Horizontal();
size.height += WidgetDimensions::scaled.frametext.Vertical();
}
}
@ -210,7 +210,7 @@ public:
this->Window::Close();
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
/* We cache the button size. This is safe as no reinit can happen here. */
if (this->button_size.width == 0) {
@ -222,13 +222,13 @@ public:
switch (widget) {
case WID_BAFD_QUESTION:
/* The question is twice as wide as the buttons, and determine the height based on the width. */
size->width = this->button_size.width * 2;
size->height = GetStringHeight(STR_MISSING_GRAPHICS_SET_MESSAGE, size->width - WidgetDimensions::scaled.frametext.Horizontal()) + WidgetDimensions::scaled.frametext.Vertical();
size.width = this->button_size.width * 2;
size.height = GetStringHeight(STR_MISSING_GRAPHICS_SET_MESSAGE, size.width - WidgetDimensions::scaled.frametext.Horizontal()) + WidgetDimensions::scaled.frametext.Vertical();
break;
case WID_BAFD_YES:
case WID_BAFD_NO:
*size = this->button_size;
size = this->button_size;
break;
}
}
@ -384,9 +384,9 @@ bool HandleBootstrap()
* This way the mauve and gray colours work and we can show the user interface. */
GfxInitPalettes();
static const int offsets[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0x04, 0x08 };
for (uint i = 0; i != 16; i++) {
for (int j = 0; j < 8; j++) {
_colour_gradient[i][j] = offsets[i] + j;
for (Colours i = COLOUR_BEGIN; i != COLOUR_END; i++) {
for (ColourShade j = SHADE_BEGIN; j < SHADE_END; j++) {
SetColourGradient(i, j, offsets[i] + j);
}
}

@ -63,7 +63,7 @@ enum BridgeSpecCtrlFlags {
*/
struct BridgeSpec {
CalTime::Year avail_year; ///< the year where it becomes available
byte min_length; ///< the minimum length (not counting start and end tile)
uint8_t min_length; ///< the minimum length (not counting start and end tile)
uint16_t max_length; ///< the maximum length (not counting start and end tile)
uint16_t price; ///< the price multiplier
uint16_t speed; ///< maximum travel speed (1 unit = 1/1.6 mph = 1 km-ish/h)
@ -72,9 +72,9 @@ struct BridgeSpec {
StringID material; ///< the string that contains the bridge description
StringID transport_name[2]; ///< description of the bridge, when built for road or rail
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
byte flags; ///< bit 0 set: disable drawing of far pillars.
byte ctrl_flags; ///< control flags
byte pillar_flags[12]; ///< bridge pillar flags: 6 x pairs of x and y flags
uint8_t flags; ///< bit 0 set: disable drawing of far pillars.
uint8_t ctrl_flags; ///< control flags
uint8_t pillar_flags[12]; ///< bridge pillar flags: 6 x pairs of x and y flags
};
extern BridgeSpec _bridge[MAX_BRIDGES];

@ -18,7 +18,7 @@
#include "gfx_func.h"
#include "tunnelbridge.h"
#include "sortlist_type.h"
#include "widgets/dropdown_func.h"
#include "dropdown_func.h"
#include "core/geometry_func.hpp"
#include "cmd_helper.h"
#include "tunnelbridge_map.h"
@ -189,14 +189,14 @@ public:
this->Window::Close();
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
switch (widget) {
case WID_BBS_DROPDOWN_ORDER: {
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better.
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
case WID_BBS_DROPDOWN_CRITERIA: {
@ -206,7 +206,7 @@ public:
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
case WID_BBS_BRIDGE_LIST: {
@ -216,11 +216,11 @@ public:
sprite_dim = maxdim(sprite_dim, GetScaledSpriteSize(bridge_data.spec->sprite));
text_dim = maxdim(text_dim, GetStringBoundingBox(GetBridgeSelectString(bridge_data)));
}
resize->height = std::max(sprite_dim.height, text_dim.height) + padding.height; // Max of both sizes + account for matrix edges.
resize.height = std::max(sprite_dim.height, text_dim.height) + padding.height; // Max of both sizes + account for matrix edges.
this->icon_width = sprite_dim.width; // Width of bridge icon.
size->width = this->icon_width + WidgetDimensions::scaled.hsep_normal + text_dim.width + padding.width;
size->height = 4 * resize->height; // Smallest bridge gui is 4 entries high in the matrix.
size.width = this->icon_width + WidgetDimensions::scaled.hsep_normal + text_dim.width + padding.width;
size.height = 4 * resize.height; // Smallest bridge gui is 4 entries high in the matrix.
break;
}
}
@ -246,11 +246,11 @@ public:
case WID_BBS_BRIDGE_LIST: {
Rect tr = r.WithHeight(this->resize.step_height).Shrink(WidgetDimensions::scaled.matrix);
bool rtl = _current_text_dir == TD_RTL;
for (int i = this->vscroll->GetPosition(); this->vscroll->IsVisible(i) && i < (int)this->bridges.size(); i++) {
const BuildBridgeData &bridge_data = this->bridges.at(i);
const BridgeSpec *b = bridge_data.spec;
auto [first, last] = this->vscroll->GetVisibleRangeIterators(this->bridges);
for (auto it = first; it != last; ++it) {
const BridgeSpec *b = it->spec;
DrawSpriteIgnorePadding(b->sprite, b->pal, tr.WithWidth(this->icon_width, rtl), SA_HOR_CENTER | SA_BOTTOM);
DrawStringMultiLine(tr.Indent(this->icon_width + WidgetDimensions::scaled.hsep_normal, rtl), GetBridgeSelectString(bridge_data));
DrawStringMultiLine(tr.Indent(this->icon_width + WidgetDimensions::scaled.hsep_normal, rtl), GetBridgeSelectString(*it));
tr = tr.Translate(0, this->resize.step_height);
}
break;
@ -373,7 +373,7 @@ static WindowDesc _build_bridge_desc(__FILE__, __LINE__,
* @param transport_type The transport type
* @param road_rail_type The road/rail type
*/
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, byte road_rail_type)
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, TransportType transport_type, uint8_t road_rail_type)
{
CloseWindowByClass(WC_BUILD_BRIDGE);

@ -72,15 +72,14 @@ TileIndex GetOtherBridgeEnd(TileIndex tile)
*/
int GetBridgeHeight(TileIndex t)
{
int h;
Slope tileh = GetTileSlope(t, &h);
auto [tileh, h] = GetTileSlopeZ(t);
Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(t)));
/* one height level extra for the ramp */
return h + 1 + ApplyFoundationToSlope(f, &tileh);
return h + 1 + ApplyFoundationToSlope(f, tileh);
}
std::unordered_map<TileIndex, LongBridgeSignalStorage> _long_bridge_signal_sim_map;
robin_hood::unordered_flat_map<TileIndex, LongBridgeSignalStorage> _long_bridge_signal_sim_map;
SignalState GetBridgeEntranceSimulatedSignalStateExtended(TileIndex t, uint16_t signal)
{

@ -360,7 +360,7 @@ inline bool IsCustomBridgeHeadTile(TileIndex t)
inline TrackBits GetBridgeReservationTrackBits(TileIndex t)
{
assert_tile(IsRailBridgeHeadTile(t), t);
byte track_b = GB(_m[t].m2, 0, 3);
uint8_t track_b = GB(_m[t].m2, 0, 3);
Track track = (Track)(track_b - 1); // map array saves Track+1
if (track_b == 0) return TRACK_BIT_NONE;
return (TrackBits)(TrackToTrackBits(track) | (HasBit(_m[t].m2, 3) ? TrackToTrackBits(TrackToOppositeTrack(track)) : 0));
@ -378,7 +378,7 @@ inline void SetBridgeReservationTrackBits(TileIndex t, TrackBits b)
assert(!TracksOverlap(b));
Track track = RemoveFirstTrack(&b);
SB(_m[t].m2, 0, 3, track == INVALID_TRACK ? 0 : track + 1);
SB(_m[t].m2, 3, 1, (byte)(b != TRACK_BIT_NONE));
SB(_m[t].m2, 3, 1, (uint8_t)(b != TRACK_BIT_NONE));
}

@ -15,15 +15,21 @@
#include "signal_type.h"
#include "core/bitmath_func.hpp"
#include "3rdparty/cpp-btree/btree_set.h"
#include "3rdparty/robin_hood/robin_hood.h"
#include <vector>
#include <unordered_map>
struct LongBridgeSignalStorage {
std::vector<uint64_t> signal_red_bits;
LongBridgeSignalStorage() = default;
LongBridgeSignalStorage(const LongBridgeSignalStorage &other) = delete;
LongBridgeSignalStorage(LongBridgeSignalStorage &&other) = default;
LongBridgeSignalStorage& operator=(const LongBridgeSignalStorage &other) = delete;
LongBridgeSignalStorage& operator=(LongBridgeSignalStorage &&other) = default;
};
extern std::unordered_map<TileIndex, LongBridgeSignalStorage> _long_bridge_signal_sim_map;
extern robin_hood::unordered_flat_map<TileIndex, LongBridgeSignalStorage> _long_bridge_signal_sim_map;
extern btree::btree_set<uint32_t> _bridge_signal_style_map;

File diff suppressed because it is too large Load Diff

@ -22,7 +22,7 @@ using CargoLabel = StrongType::Typedef<uint32_t, struct CargoLabelTag, StrongTyp
/**
* Cargo slots to indicate a cargo type within a game.
*/
using CargoID = byte;
using CargoID = uint8_t;
/**
* Available types of cargo
@ -50,7 +50,7 @@ static constexpr CargoLabel CT_FOOD = CargoLabel{'FOOD'};
/* Tropic */
static constexpr CargoLabel CT_RUBBER = CargoLabel{'RUBR'};
static constexpr CargoLabel CT_FRUIT = CargoLabel{'FRUI'};
static constexpr CargoLabel CT_FRUIT = CargoLabel{'FRUT'};
static constexpr CargoLabel CT_MAIZE = CargoLabel{'MAIZ'};
static constexpr CargoLabel CT_COPPER_ORE = CargoLabel{'CORE'};
static constexpr CargoLabel CT_WATER = CargoLabel{'WATR'};
@ -149,7 +149,7 @@ struct CargoArray : std::array<uint, NUM_CARGO> {
/** Types of cargo source and destination */
enum class SourceType : byte {
enum class SourceType : uint8_t {
Industry, ///< Source/destination is an industry
Town, ///< Source/destination is a town
Headquarters, ///< Source/destination are company headquarters

@ -102,7 +102,7 @@ void BuildCargoLabelMap()
_cargo_label_map.clear();
for (const CargoSpec &cs : CargoSpec::array) {
/* During initialization, CargoSpec can be marked valid before the label has been set. */
if (!cs.IsValid() || cs.label == CargoLabel{0}) continue;
if (!cs.IsValid() || cs.label == CargoLabel{0} || cs.label == CT_INVALID) continue;
/* Label already exists, don't add again. */
if (_cargo_label_map.count(cs.label) != 0) continue;

@ -19,7 +19,7 @@
#include <vector>
/** Town growth effect when delivering cargo. */
enum TownAcceptanceEffect : byte {
enum TownAcceptanceEffect : uint8_t {
TAE_BEGIN = 0,
TAE_NONE = TAE_BEGIN, ///< Cargo has no effect.
TAE_PASSENGERS, ///< Cargo behaves passenger-like.
@ -32,7 +32,7 @@ enum TownAcceptanceEffect : byte {
};
/** Town effect when producing cargo. */
enum TownProductionEffect : byte {
enum TownProductionEffect : uint8_t {
TPE_NONE, ///< Town will not produce this cargo type.
TPE_PASSENGERS, ///< Cargo behaves passenger-like for production.
TPE_MAIL, ///< Cargo behaves mail-like for production.
@ -61,7 +61,7 @@ enum CargoClass {
CC_SPECIAL = 1 << 15, ///< Special bit used for livery refit tricks instead of normal cargoes.
};
static const byte INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo
static const uint8_t INVALID_CARGO_BITNUM = 0xFF; ///< Constant representing invalid cargo
static const uint TOWN_PRODUCTION_DIVISOR = 256;

@ -58,7 +58,7 @@ static int32_t _money_cheat_amount = 10000000;
*/
static int32_t ClickMoneyCheat(int32_t p1, int32_t p2)
{
DoCommandPEx(0, 0, 0, (uint64_t)(p2 * _money_cheat_amount), _network_server || _network_settings_access ? CMD_MONEY_CHEAT_ADMIN : CMD_MONEY_CHEAT);
DoCommandPEx(0, 0, 0, (uint64_t)(p2 * _money_cheat_amount), IsNetworkSettingsAdmin() ? CMD_MONEY_CHEAT_ADMIN : CMD_MONEY_CHEAT);
return _money_cheat_amount;
}
@ -120,6 +120,7 @@ static int32_t ClickChangeDateCheat(int32_t p1, int32_t p2)
/* Shift cached dates. */
LinkGraphSchedule::instance.ShiftDates(new_econ_date - EconTime::CurDate());
ShiftVehicleDates(new_econ_date - EconTime::CurDate());
EconTime::Detail::period_display_offset -= (p1 - EconTime::CurYear().base());
EconTime::Detail::SetDate(new_econ_date, new_econ_date_fract);
UpdateOrderUIOnDateChange();
@ -211,13 +212,13 @@ static bool IsCheatAllowed(CheatNetworkMode mode)
{
switch (mode) {
case CNM_ALL:
return !_networking || _network_server || _network_settings_access;
return !IsNonAdminNetworkClient();
case CNM_LOCAL_ONLY:
return !_networking;
case CNM_MONEY:
return !_networking || _network_server || _network_settings_access || _settings_game.difficulty.money_cheat_in_multiplayer;
return !IsNonAdminNetworkClient() || _settings_game.difficulty.money_cheat_in_multiplayer;
}
return false;
}
@ -329,7 +330,7 @@ struct CheatWindow : Window {
}
}
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
{
if (widget != WID_C_PANEL) return;
@ -378,8 +379,8 @@ struct CheatWindow : Window {
this->line_height = std::max<uint>(this->line_height, SETTING_BUTTON_HEIGHT);
this->line_height = std::max<uint>(this->line_height, GetCharacterHeight(FS_NORMAL)) + WidgetDimensions::scaled.framerect.Vertical();
size->width = width + WidgetDimensions::scaled.hsep_wide * 4 + this->box.width + SETTING_BUTTON_WIDTH /* stuff on the left */ + WidgetDimensions::scaled.hsep_wide * 2 /* extra spacing on right */;
size->height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lines;
size.width = width + WidgetDimensions::scaled.hsep_wide * 4 + this->box.width + SETTING_BUTTON_WIDTH /* stuff on the left */ + WidgetDimensions::scaled.hsep_wide * 2 /* extra spacing on right */;
size.height = WidgetDimensions::scaled.framerect.Vertical() + this->line_height * lines;
}
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
@ -506,7 +507,7 @@ struct CheatWindow : Window {
}
if (ce->mode == CNM_MONEY) {
if (!_networking) *ce->been_used = true;
DoCommandPEx(0, 0, 0, (std::strtoll(str, nullptr, 10) / _currency->rate), _network_server || _network_settings_access ? CMD_MONEY_CHEAT_ADMIN : CMD_MONEY_CHEAT);
DoCommandPEx(0, 0, 0, (std::strtoll(str, nullptr, 10) / GetCurrency().rate), IsNetworkSettingsAdmin() ? CMD_MONEY_CHEAT_ADMIN : CMD_MONEY_CHEAT);
return;
}
@ -531,7 +532,7 @@ static WindowDesc _cheats_desc(__FILE__, __LINE__,
bool CheatWindowMayBeShown()
{
return _game_mode != GM_EDITOR && (!_networking || _network_server || _network_settings_access || _settings_game.difficulty.money_cheat_in_multiplayer);
return _game_mode != GM_EDITOR && (!IsNonAdminNetworkClient() || _settings_game.difficulty.money_cheat_in_multiplayer);
}
/** Open cheat window. */

@ -46,12 +46,12 @@ static CommandCost ClearTile_Clear(TileIndex tile, DoCommandFlag flags)
return price;
}
SpriteID GetSpriteIDForClearLand(const Slope slope, byte set)
SpriteID GetSpriteIDForClearLand(const Slope slope, uint8_t set)
{
return SPR_FLAT_BARE_LAND + SlopeToSpriteOffset(slope) + set * 19;
}
void DrawClearLandTile(const TileInfo *ti, byte set)
void DrawClearLandTile(const TileInfo *ti, uint8_t set)
{
DrawGroundSprite(GetSpriteIDForClearLand(ti->tileh, set), PAL_NONE);
}
@ -173,7 +173,7 @@ static void DrawTile_Clear(TileInfo *ti, DrawTileProcParams params)
break;
case CLEAR_FIELDS:
if (params.min_visible_height <= 4 * ZOOM_LVL_BASE) {
if (params.min_visible_height <= (4 * ZOOM_BASE)) {
DrawGroundSprite(GetSpriteIDForFields(ti->tileh, GetFieldType(ti->tile)), PAL_NONE);
DrawClearLandFence(ti);
}
@ -199,8 +199,7 @@ static void DrawTile_Clear(TileInfo *ti, DrawTileProcParams params)
static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y, bool)
{
int z;
Slope tileh = GetTilePixelSlope(tile, &z);
auto [tileh, z] = GetTilePixelSlope(tile);
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
}
@ -215,25 +214,25 @@ static void UpdateFences(TileIndex tile)
assert_tile(IsTileType(tile, MP_CLEAR) && IsClearGround(tile, CLEAR_FIELDS), tile);
bool dirty = false;
bool neighbour = (IsTileType(TILE_ADDXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 1, 0), CLEAR_FIELDS));
bool neighbour = (IsTileType(TileAddXY(tile, 1, 0), MP_CLEAR) && IsClearGround(TileAddXY(tile, 1, 0), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_SW) == 0) {
SetFence(tile, DIAGDIR_SW, 3);
dirty = true;
}
neighbour = (IsTileType(TILE_ADDXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, 1), CLEAR_FIELDS));
neighbour = (IsTileType(TileAddXY(tile, 0, 1), MP_CLEAR) && IsClearGround(TileAddXY(tile, 0, 1), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_SE) == 0) {
SetFence(tile, DIAGDIR_SE, 3);
dirty = true;
}
neighbour = (IsTileType(TILE_ADDXY(tile, -1, 0), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, -1, 0), CLEAR_FIELDS));
neighbour = (IsTileType(TileAddXY(tile, -1, 0), MP_CLEAR) && IsClearGround(TileAddXY(tile, -1, 0), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_NE) == 0) {
SetFence(tile, DIAGDIR_NE, 3);
dirty = true;
}
neighbour = (IsTileType(TILE_ADDXY(tile, 0, -1), MP_CLEAR) && IsClearGround(TILE_ADDXY(tile, 0, -1), CLEAR_FIELDS));
neighbour = (IsTileType(TileAddXY(tile, 0, -1), MP_CLEAR) && IsClearGround(TileAddXY(tile, 0, -1), CLEAR_FIELDS));
if (!neighbour && GetFence(tile, DIAGDIR_NW) == 0) {
SetFence(tile, DIAGDIR_NW, 3);
dirty = true;

@ -13,9 +13,9 @@
#include "tile_cmd.h"
void DrawHillyLandTile(const TileInfo *ti);
void DrawClearLandTile(const TileInfo *ti, byte set);
void DrawClearLandTile(const TileInfo *ti, uint8_t set);
SpriteID GetSpriteIDForClearLand(const Slope slope, byte set);
SpriteID GetSpriteIDForClearLand(const Slope slope, uint8_t set);
SpriteID GetSpriteIDForHillyLand(const Slope slope, const uint rough_index);
SpriteID GetSpriteIDForRocks(const Slope slope, const uint tile_hash);
SpriteID GetSpriteIDForFields(const Slope slope, const uint field_type);

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

Loading…
Cancel
Save