Compare commits

...

664 Commits

Author SHA1 Message Date
translators 9f13d3ff2b Update: Translations from eints
chinese (simplified): 2 changes by WenSimEHRP
greek: 11 changes by gh658804
2024-05-23 04:40:46 +00:00
Tyler Trahan 8f6e21617f
Fix #12591: Give descriptive error when station construction fails due to wrong layout (#12678) 2024-05-22 17:56:03 -04:00
Rubidium b2f1a06def Change: support listing/updating authorized keys of companies by the admin in the console 2024-05-22 22:20:10 +02:00
Rubidium fea9ffa808 Codechange: also allow removing clients from the company allow lists 2024-05-22 22:20:10 +02:00
Peter Nelson 8a6745b26f
Codechange: Use PIP instead of spacer widgets for OSK spacing. (#12709)
This (slightly) simplifies the OSK widget layout.
2024-05-22 19:06:52 +01:00
Peter Nelson 766350bfd2
Fix: Hide empty house 'classes' in house picker. (#12694)
Picker class list should not list classes with no items. The house picker could break this 'rule' with NewGRFs loaded.
2024-05-22 18:06:59 +01:00
Peter Nelson 7e12b5ff0f
Fix: Crash if interface scale or font size changes with chat box present. (#12705)
Caused by the chat box being undrawn with the new dimensions, leading to out-of-bounding memory access.
2024-05-22 18:06:34 +01:00
Jonathan G Rennison 42fc32243d
Fix #12681: Abstract filetype not set for network client join savegames (#12701) 2024-05-22 09:43:01 +01:00
Peter Nelson 19ca4089a1
Codechange: Use std::filesystem::exists instead of access. (#12702) 2024-05-22 09:23:01 +01:00
translators 5bc3723bcc Update: Translations from eints
czech: 11 changes by vladoschreiner
2024-05-22 04:42:40 +00:00
Peter Nelson 5442b0dd2d
Fix: Make progress bars obey language direction. (#12704)
With RTL languages, progress bars should start from the right.
2024-05-21 00:40:08 +01:00
Peter Nelson 28e814f62a
Codechange: Use L"" instead of _T("") (#12703) 2024-05-20 17:34:22 +00:00
translators fb4a370d3f Update: Translations from eints
vietnamese: 13 changes by KhoiCanDev
chinese (simplified): 1 change by WenSimEHRP
finnish: 11 changes by hpiirai
french: 29 changes by ottdfevr
polish: 1 change by aefoes
2024-05-20 04:43:22 +00:00
translators 46d7586ab1 Update: Translations from eints
estonian: 8 changes by siimsoni
chinese (simplified): 4 changes by ahyangyi
korean: 13 changes by telk5093
2024-05-19 04:43:16 +00:00
Loïc Guilloux 29ce013eda
Codechange: Pass avail(able) as reference instead of pointer since they are never nullptr (#12696) 2024-05-18 17:04:16 +02:00
Peter Nelson ba47d1ca2b
Fix: Allow resolving house parent scope (town) of unbuilt houses. (#12695)
Return unavailable variable result, instead of nullptr dereference.
2024-05-18 12:33:50 +01:00
Peter Nelson 3f5a354f37
Codechange: Use emplace with ICURun and UniscribeRun. (#12693) 2024-05-18 09:17:38 +01:00
Peter Nelson 856ec901ca
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.
2024-05-18 09:17:06 +01:00
translators 7fd2487c46 Update: Translations from eints
swedish: 6 changes by joeax910
chinese (simplified): 2 changes by WenSimEHRP
dutch: 27 changes by Afoklala
2024-05-18 04:40:26 +00:00
Peter Nelson 8d26d032e1
Fix #12497: [NewGRF] Increase vehicle motion counter for all parts. (#12561)
NewGRFs relied on the incorrectly motion counter that was 'fixed' in #12229, so always update v->motion_counter for all vehicle parts.
2024-05-17 20:50:04 +01:00
Peter Nelson c85481564f
Codechange: Use reusable temporary buffer in Win32FontCache. (#12666)
This avoids allocating and deleting a temporary buffer for every glyph that is rendered into a sprite.
2024-05-17 08:50:59 +01:00
Peter Nelson 4940b6ff0b
Codefix: Compile warning with newer C++ compiler on MinGW. (#12689)
> template-id not allowed for constructor in C++20
2024-05-16 12:09:19 +01:00
translators 26113e3622 Update: Translations from eints
english (au): 11 changes by krysclarke
swedish: 7 changes by joeax910
english (us): 11 changes by 2TallTyler
chinese (simplified): 11 changes by WenSimEHRP
russian: 11 changes by Ln-Wolf
catalan: 11 changes by J0anJosep
portuguese: 13 changes by azulcosta
portuguese (brazilian): 11 changes by pasantoro
2024-05-16 04:41:07 +00:00
Peter Nelson ca52da6c95
Fix: Unable to choose a font containing hyphen. (#12684)
FcNameParse may require some characters be escaped. Instead, pass name as FC_FAMILY.
2024-05-16 00:38:23 +01:00
Peter Nelson d1b7619822
Change: Ignore min/max years for manual house placer. (#12687) 2024-05-15 23:17:58 +01:00
translators 56ea002283 Update: Translations from eints
catalan: 16 changes by J0anJosep
latvian: 2 changes by lexuslatvia
2024-05-15 04:41:37 +00:00
Peter Nelson 980dcaac6e
Cleanup: Remove GetFontTable from FontCache. (#12677)
This interface is no longer used, so does not need to be implemented.

Removes manual memory management with malloc/free.
2024-05-14 21:13:26 +01:00
Peter Nelson ed67aedabf Feature: Allow manually placing town buildings in scenario editor.
House picker is accessed from the Landscaping toolbar as there is no town toolbar.

Once placed these houses behave like any other and can be removed by players and towns.

Uses the unified picker system, so also supports used/saved favourites. As town building don't have class labels, town zones are use to imitate them.
2024-05-14 21:11:48 +01:00
Peter Nelson 874cfe000b Codechange: Set underlying type for HouseSpec enums. 2024-05-14 21:11:48 +01:00
Peter Nelson b731ab0632 Change: Allow sprite resolver to evaluate non-existent houses.
This could previous be done but only with a town and tile in mind, but for drawing in the UI, neither of those exist yet.
2024-05-14 21:11:48 +01:00
Peter Nelson d99c1337a2 Add: Command to build an individual house on a specific tile. 2024-05-14 21:11:48 +01:00
Peter Nelson f901722066 Codechange: Rename BuildTownHouse to TryBuildTownHouse. 2024-05-14 21:11:48 +01:00
Tyler Trahan bb77d16e40
Add: Shade button to waypoint picker (#12682) 2024-05-14 14:43:56 -04:00
Muxy 486af1a6fc Fix: [Admin] #12411 Send Network Welcome Packet to admin port after game creation completed
WelcomeAll moved into NetworkOnGameStart

Signed-off-by: Muxy <muxy@goulp.net>
2024-05-14 19:24:31 +02:00
Peter Nelson 460fab920c
Fix #12418, 338def1b06: Filename extension taken from wrong string. (#12680) 2024-05-14 18:18:30 +01:00
Rubidium 00c4b232b3 Fix #12550: files were not saved in the right location when binary and configuration are in the same folder 2024-05-14 17:01:28 +02:00
translators 3f06aa441b Update: Translations from eints
english (us): 17 changes by 2TallTyler
greek: 147 changes by KyriakosMich
2024-05-14 04:40:19 +00:00
Tyler Trahan 9f63b9f65d
Fix #12594: Give descriptive error when company takeover fails due to vehicle limit (#12676) 2024-05-13 10:10:03 -04:00
translators 870149406a Update: Translations from eints
chinese (simplified): 23 changes by WenSimEHRP
russian: 17 changes by Ln-Wolf
portuguese (brazilian): 8 changes by pasantoro
2024-05-13 04:41:24 +00:00
Peter Nelson 18e56df5e1
Fix #12674: Non-NewGRF Build Station widgets may not fill window properly. (#12675)
Allow labels in Build Station window to fill width as needed.
2024-05-13 00:18:07 +00:00
Peter Nelson f2f7573c3f
Fix #12668: Crash opening picker window with filter when no results available. (#12669)
When first opening the picker window, we attempt to find a valid class and type to select. If the picker window was closed with filters enabled, there may not be anything list that is usable.

Resolve this by using callbacks to find the first usable type when no types are listed.
2024-05-12 20:14:29 +01:00
Rubidium 77c188e6da Codechange: use std::vector instead of malloced array 2024-05-12 12:55:52 +02:00
Rubidium 6cea49c117 Codechange: replace uint with size_t in binary heap 2024-05-12 12:55:52 +02:00
Rubidium 8349203038 Cleanup: remove unused Aystar variables 2024-05-12 10:46:03 +02:00
Peter Nelson 77a7113ba6
Cleanup: Remove unused parameters from FreeTypeFontCache::SetFontSize. (#12663) 2024-05-12 08:39:40 +01:00
Rubidium f939e81bf0 Fix #12655, 4f6d75f: inconsistent state in client list and potential crash after client leaves 2024-05-12 07:23:40 +02:00
translators 95a89e43b2 Update: Translations from eints
english (au): 16 changes by krysclarke
chinese (simplified): 16 changes by XiaoJi-Game
korean: 19 changes by telk5093
russian: 1 change by Ln-Wolf
finnish: 16 changes by hpiirai
lithuanian: 1 change by khamper
portuguese: 17 changes by azulcosta
portuguese (brazilian): 16 changes by pasantoro
2024-05-12 04:41:31 +00:00
Peter Nelson 34da94ffc8
Fix: Use widget resize step instead of window resize step. (#12659)
Build Picker class list filter could be drawn incorrectly depending on how the window can be resized.
2024-05-11 20:51:44 +01:00
Peter Nelson d78f39a9df
Cleanup: Remove GetUnitsPerEM and units_per_em. (#12656)
GetUnitsPerEM is never called.
2024-05-11 14:50:34 +01:00
translators 721cd2b8ad Update: Translations from eints
ukrainian: 1 change by Quantom2
dutch: 5 changes by Afoklala
lithuanian: 1 change by khamper
2024-05-11 04:41:26 +00:00
Peter Nelson b30fe0d7da Feature: Ctrl-click to toggle favourites in build-pickers.
This allows ctrl-click on a type in a build-picker window to remember it
as a favourite. An new filter button to show only favourites makes it
simpler to use these types.

Favourite types are saved locally in favs.cfg, so are remembered between
games.
2024-05-11 02:12:41 +01:00
Peter Nelson fde3b35a24 Feature: New filter to show only used types in build-pickers.
This filters the build-picker type lists to only show types that have
already been placed in the current game, making it simpler to get to
build matching features.
2024-05-11 02:12:41 +01:00
Peter Nelson b76517816e Feature: Add "All" filter to build-picker show types from all classes.
Toggling the "All" filter causes the class selection to be ignored, so
that items from all classes can be displayed together. The class text
filter is still applied.

This makes it easier to search amongst types for a feature.
2024-05-11 02:12:41 +01:00
Peter Nelson cdc356e7bf Change: Unify station/waypoint/roadstop/object build-picker window code.
These windows now share a common code base for choosing and display class and types.

An additional text filter is added to search types by name instead of just classes.
2024-05-11 02:12:41 +01:00
Peter Nelson d2c8b476b5 Codechange: Add functions to test if a station/roadstop class is a waypoint.
This is now checked by class label instead of by index.
2024-05-11 02:12:41 +01:00
Peter Nelson 9f8c9724be Codechange: Add station/roadstop class labels for DFLT/WAYP.
This avoids repeating the same multichar literal value.
2024-05-11 02:12:41 +01:00
Peter Nelson d5671030b1 Codechange: Add NewGRFSpecsBase class to hold class/index information.
Standardises how the class index is stored in the spec, instead of relying ot the Spec structs having the same members.

This allows retrieving class_index and index without searching or using pointer arithmetic.

'cls_id' is renamed to 'class_index' to make it clearer that it is an index rather than the multichar label of the class.
2024-05-11 02:12:41 +01:00
Peter Nelson 733284cc16 Codechange: Return std::vector from GetMusicCatEntryData.
Return std::vector instead of pointer to array with manual memory management.
2024-05-11 02:10:41 +01:00
Peter Nelson 31c306c6cd Codechange: Return std::string from GetMusicCatEntryName.
Return std::string instead of pointer to C-string with manual memory management.
2024-05-11 02:10:41 +01:00
frosch dc22edc556 Doc: [Script] Extend API documentation on calendar- vs economy-time 2024-05-10 13:17:19 +01:00
frosch 04cc0c8125 Codechange: [Script] Document relation between ScriptErrorType and ErrorMessages enums 2024-05-10 13:17:19 +01:00
frosch 40e6230900 Codechange: Add main page to script API documentation 2024-05-10 13:17:19 +01:00
frosch dfa2622153 Codechange: Unify naming of squirrel built-in types in Script API docs 2024-05-10 13:17:19 +01:00
frosch e436e2ef40 Codefix: broken links and syntax issues in script API documentation 2024-05-10 13:17:19 +01:00
frosch 64e1f1d4d9 Codefix: Script API documentation about IDs was incomplete 2024-05-10 13:17:19 +01:00
frosch 4bf2dc3148 Codefix: Script API did not link simple types correctly 2024-05-10 13:17:19 +01:00
frosch c1375cecf8 Codefix: [Script] script_types was excluded from API documentation 2024-05-10 13:17:19 +01:00
frosch ffe76a0133 Update: Doxyfiles to doxygen 1.9.4 2024-05-10 13:17:19 +01:00
merni-ns c3ee5e58a3 Cleanup: Move remaining NPF files into pathfinder directory 2024-05-10 10:38:44 +02:00
merni-ns 798ec4184b Cleanup: Remove unused function InvalidateShipPathCache
This was only used in the callback when changing the ship pathfinder setting.
2024-05-10 10:38:44 +02:00
merni-ns 55a7c59d13 Remove: NPF and pathfinder change settings 2024-05-10 10:38:44 +02:00
translators a5c2543efc Update: Translations from eints
chinese (simplified): 7 changes by WenSimEHRP, 4 changes by ahyangyi
2024-05-10 04:40:29 +00:00
Rubidium cef9417c9f Fix: always allow setting company settings, company/president name/face
There is a nice feature that synchronises the client settings upon setting up the company. Before
this, those commands would not be executed when no-actions-while-paused is set. This means that,
silently and depending on the server configuration, your wished for configuration might not be
there.

Similarly there is the president's face that's being set while creating a new company and setting
of the president/company name upon creation, when no-actions-while-paused is set.

So, just allow these operations also while paused to get a uniform experience when joining. To
keep the UI somewhat consistent, apply this "freedom" also to the other bits set from the company
UI; specifically company name and company colour.
2024-05-09 21:51:26 +02:00
Rubidium a313676189 Doc: reason for using ::SendNet over ::Post in few cases 2024-05-09 21:51:26 +02:00
Rubidium ed888c617b Codechange: just use ::Post over ::SendNet for creating new companies 2024-05-09 21:51:26 +02:00
Koen Bussemaker 59ac27f385 Fix #12643: _is_water_region_valid is not cleared/reset in AllocateWaterRegions 2024-05-09 20:18:04 +02:00
Peter Nelson ec61951512
Cleanup: Remove Windows 9x font locale workaround. (#12644) 2024-05-09 07:03:02 +01:00
Peter Nelson 5b35fbd6f5
Change: Use button aspect ratio for buttons that show vehicle icons. (#12636) 2024-05-09 07:01:56 +01:00
translators 132e226b27 Update: Translations from eints
greek: 169 changes by KyriakosMich
lithuanian: 21 changes by khamper
polish: 1 change by pAter-exe
2024-05-09 04:42:47 +00:00
ladysadie 00cfd572ff
Cleanup: Remove unneeded CheckMissingGlyphs call (#12640) 2024-05-08 21:42:02 +02:00
translators cb3f99859c Update: Translations from eints
english (au): 1 change by krysclarke
estonian: 25 changes by siimsoni
korean: 3 changes by telk5093
russian: 1 change by Ln-Wolf
finnish: 1 change by hpiirai
catalan: 5 changes by J0anJosep
latvian: 30 changes by lexuslatvia
lithuanian: 140 changes by khamper
portuguese: 1 change by azulcosta
portuguese (brazilian): 3 changes by pasantoro
2024-05-08 04:40:34 +00:00
Peter Nelson b74a7e749b
Fix: Console command scrolling did not take account of padding and cursor width. (#12642) 2024-05-08 01:52:30 +01:00
Peter Nelson 731d46beb5
Change: Don't include midi file processing in dedicated server build. (#12632) 2024-05-08 00:57:52 +01:00
Peter Nelson 9008d793ab
Change: Use per-company group numbers. (#12297)
This is used by the default group name, replacing the use of group index.
2024-05-07 19:01:28 +00:00
Jonathan G Rennison 8710e9b8c8 Fix #12608: SDL keycode to vkey mapping 2024-05-07 18:33:29 +02:00
Tyler Trahan 019f93a65f
Doc: Clarify how to update version numbers in release guide (#12634) 2024-05-07 11:58:03 -04:00
translators ab7e2a1883 Update: Translations from eints
english (au): 2 changes by krysclarke
english (us): 2 changes by 2TallTyler
greek: 4 changes by gh658804
russian: 2 changes by Ln-Wolf
finnish: 4 changes by hpiirai
danish: 2 changes by bscargo
lithuanian: 170 changes by khamper
french: 1 change by ben20471
portuguese: 2 changes by azulcosta
portuguese (brazilian): 2 changes by pasantoro
polish: 2 changes by pAter-exe
2024-05-07 04:41:01 +00:00
Rubidium 1a3cbaec56 Cleanup: remove warning about server administrators being able to read passwords 2024-05-07 00:03:15 +02:00
Rubidium 849d1fa1b3 Cleanup: remove UI for asking user for company password 2024-05-07 00:03:15 +02:00
Rubidium 457d51fc49 Cleanup: remove company password hashing and anything related to it 2024-05-07 00:03:15 +02:00
Rubidium a9318cf653 Cleanup: remove UI for changing the password 2024-05-07 00:03:15 +02:00
Rubidium 9dc1fdc385 Cleanup: remove client side password checks when moving to a different company 2024-05-07 00:03:15 +02:00
Rubidium 16639939e9 Cleanup: remove command line option for company password 2024-05-07 00:03:15 +02:00
Rubidium ca4bef1504 Cleanup: remove company password related network packets 2024-05-07 00:03:15 +02:00
Rubidium 71fc907584 Change: remove company passwords over client allow lists 2024-05-07 00:03:15 +02:00
Rubidium a002803d1c Remove: autoclean_unprotected settings; all companies will be protected 2024-05-07 00:03:15 +02:00
Rubidium 4f3db8eeaf Feature: authorize specific clients to join network company without password 2024-05-07 00:03:15 +02:00
Rubidium 66354ab9eb Codechange: introduce allow list infrastructure for companies 2024-05-07 00:03:15 +02:00
Rubidium 1250ce8fdc Codechange: support storing std::string vectors/deques in the savegame 2024-05-07 00:03:15 +02:00
translators 4e9a280ef8 Update: Translations from eints
swedish: 2 changes by sereneavatar
norwegian (bokmal): 2 changes by eriksorngard
welsh: 19 changes by Ansbaradigeidfran
english (us): 2 changes by 2TallTyler
czech: 1 change by JsSusenka
lithuanian: 97 changes by khamper
french: 2 changes by Lishouuu
portuguese (brazilian): 1 change by pasantoro
polish: 2 changes by pAter-exe
2024-05-06 04:41:07 +00:00
Rubidium b9c894b717 Fix: for GUI network servers, name the first company the same as any other company 2024-05-05 22:57:50 +02:00
Rubidium 455e202e03 Fix: server's client is shown incorrectly in some cases 2024-05-05 22:57:50 +02:00
Peter Nelson 4740eeaa43
Add: 'Get Content' buttons next to base set dropdowns in Game Options. (#12627)
This allows base set content to be downloaded more easily, filtered by type and next to where it is set up.
2024-05-05 16:15:35 +01:00
Koen Bussemaker d2f98440bb Codechange: Make assert in follow_track easier to understand and debug 2024-05-05 16:30:44 +02:00
Peter Nelson 84ebae0bf5
Codechange: Tweak layout of network client list. (#12624)
Use PIP spacing instead of spacers and more used of standard WidgetDimensions.
2024-05-05 14:57:17 +01:00
Peter Nelson cf94bd321d
Codechange: Remove redundant SetMinimalSize of preview buttons. (#12622)
These widgets are also sized in UpdateWidgetSize where the current bevel width is accounted for as well.
2024-05-05 12:38:00 +01:00
Peter Nelson 72b2840a97
Codechange: Use PIP spacing instead of spacers in tree picker window. (#12623) 2024-05-05 12:37:45 +01:00
translators 99f497cb08 Update: Translations from eints
english (au): 2 changes by krysclarke
korean: 2 changes by telk5093
russian: 2 changes by Ln-Wolf
finnish: 2 changes by hpiirai
danish: 2 changes by bscargo
lithuanian: 4 changes by dziugas1959
portuguese: 2 changes by azulcosta
portuguese (brazilian): 4 changes by pasantoro
2024-05-05 04:40:50 +00:00
Rubidium 9fe9e4d398 Codechange: use vector instead of manual memory management for decompressing text files 2024-05-04 17:43:02 +02:00
Peter Nelson d074ab909c
Codechange: Replace Array/FixedSizeArray with std::deque. (#12409)
Array/FixedSizeArray is actually a resizeable container that allocates space in chunks and allows resizing without invalidating pointers.

This is also a behaviour of std::deque, so use that instead.
2024-05-04 10:55:16 +01:00
Tyler Trahan cb26b0e92d
Doc: Re-order release instructions to not tell the world prematurely (#12620) 2024-05-04 05:38:59 -04:00
Peter Nelson f629d3c921
Codechange: Use vectors instead of CallocT/free for cache checks. (#12619)
Vectors are reused for each vehicle chain to save on reallocations.
2024-05-04 09:42:20 +01:00
Peter Nelson 115ac2629b
Cleanup: Remove TileMatrix that hasn't been used for 4+ years. (#12621)
This 'nice' structure was left around from #8258 just in case it might be used again.

Spoiler alert: it hasn't.

This removes manual memory management. And otherwise unused and untested code.
2024-05-04 09:41:58 +01:00
translators 60cf37e0d1 Update: Translations from eints 2024-05-04 04:41:06 +00:00
Peter Nelson 9a7c30a109 Codechange: Let ClickSliderWidget handle rounding to nearest mark. 2024-05-03 11:48:36 +01:00
Peter Nelson 9d2efd4c96 Codechange: Use callback function to set labels of slider widget marks.
Slider widgets can only use a predefined list of values and strings to draw labels. This makes it difficult to vary the display by context.

Instead of providing a predefined list as a std::map, use a callback function instead. This function can decide what text to display, and can call SetDParam to dynamically set up strings.
2024-05-03 11:48:36 +01:00
Rubidium 8b6661d486 Codefix 90029be: build failure for SDL 1.2 2024-05-03 10:45:34 +02:00
Rubidium 0b50834f81 Fix 2955ff3: CMake atomic check fails due to chosen compiler 2024-05-03 07:32:32 +02:00
translators e0048d798f Update: Translations from eints
hungarian: 5 changes by egri-nagy
2024-05-03 04:41:54 +00:00
Peter Nelson 90029beb49
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.
2024-05-02 23:19:08 +01:00
James Addison c17fa6032b
Doc: Add Apache 2.0 licensing info for CheckAtomic.cmake (#12603) 2024-05-02 15:13:00 +02:00
Koen Bussemaker ef99aa81a3 Codechange: Store validity of water regions in separate vector 2024-05-02 15:03:48 +02:00
Peter Nelson cf96d49ced
Codechange: Use vector for airport tile layouts. (#12607)
Simplify AirportSpec data by storing layout information together in a vector, instead of separate arrays.

This removes manual memory management and separate count members.

The default layouts will be copied instead of always referring to the originals.
2024-05-02 11:37:54 +00:00
translators 65c9df49d9 Update: Translations from eints
chinese (simplified): 8 changes by XiaoJi-Game
catalan: 3 changes by J0anJosep
2024-05-02 04:41:51 +00:00
Fen 2559bdfa6f
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
2024-05-01 23:10:01 +02:00
Jonathan G Rennison 9647fe1d05 Change: [Linkgraph] Improve distance scaling algorithm in demand scaler
Improve scaling at values other than 0% and 100%
Fix erratic scaling and increase effect size at large setting values
2024-05-01 22:40:17 +02:00
Peter Nelson f146680121
Codechange: Use vector for industry random sounds. (#12606)
Use a vector to store the list of random sounds played for an industry.

The removes manual memory allocation, flags to control memory management, a separate count member, and a try/catch block.
2024-05-01 19:55:00 +00:00
Peter Nelson 7147fe9e7a
Codechange: Use range-for when loading NewGRF deterministic sprite groups. (#12605) 2024-05-01 18:59:46 +00:00
Peter Nelson 532ce1a907
Codechange: Use Recv/Send_bytes for md5sum. (#12602)
Use existing functions to handle serialisation of arrays instead of indexed for-loop.
2024-05-01 18:55:54 +01:00
Peter Nelson 1424a184d8
Codechange: Use vector/span when loading wagon overrides. (#12604)
Replaces manual memory allocation and passing pointer with size.
2024-05-01 18:23:27 +01:00
translators 96d82b4363 Update: Translations from eints
chinese (simplified): 1 change by WenSimEHRP
greek: 52 changes by KyriakosMich
german: 3 changes by Wuzzy2
basque: 36 changes by Porrumentzio
danish: 3 changes by bscargo
2024-05-01 04:41:08 +00:00
translators 4df44fea38 Update: Translations from eints
swedish: 3 changes by joeax910
galician: 63 changes by pvillaverde
2024-04-30 04:40:35 +00:00
Peter Nelson cc6e4768a9
Fix: Out-of-order window set up due to deferred window resize. (#12592)
Deferred window resize was being applied to the initial window resize event, resulting in some window state (e.g. scroll bar capacity) not being initialised when expected.
2024-04-29 17:05:35 +01:00
translators b852a3f408 Update: Translations from eints
english (us): 3 changes by 2TallTyler
korean: 3 changes by telk5093
hungarian: 2 changes by meskobalazs
2024-04-29 04:40:19 +00:00
rubidium42 fd4cf699e5
Codefix 37a03b5: the return value of maxdim should always be assigned (#12590) 2024-04-28 17:42:58 +00:00
Rubidium 98d37338df Codechange: use ranged for loop instead of one with lengthof 2024-04-28 19:42:44 +02:00
Rubidium 24b6ec80a9 Codechange: use ranged for loop and vector to determine the disaster to deploy 2024-04-28 19:42:44 +02:00
Rubidium 87dbd4a833 Codechange: use ranged for loop to determine widest title 2024-04-28 19:42:44 +02:00
Rubidium d183d8e587 Codechange: remove INVALID_STRING_ID now drop down uses spans 2024-04-28 18:47:31 +02:00
Rubidium 37a03b513f Codechange: refactor string list dimension finding into a separate function 2024-04-28 18:47:31 +02:00
Rubidium 546a996d95 Codechange: pass options to ShowDropDownMenu using a span 2024-04-28 18:47:31 +02:00
Rubidium ad50c4f298 Codechange: inline sorter name definitions and use proper static accessor instead of (implying) this-> 2024-04-28 18:47:31 +02:00
Peter Nelson ef55cc7979
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.
2024-04-28 15:18:24 +01:00
Loïc Guilloux 99b74c1064
Fix #12584: Improved error handling during tar scan (#12586) 2024-04-28 16:08:32 +02:00
Rubidium 826deaee57 Codechange: refactor CalcHeightdiff to remove some magic numbers 2024-04-28 16:05:21 +02:00
Rubidium 97a34bf06e Codechange: use C++ containers for the colour schemes 2024-04-28 16:04:54 +02:00
translators ee9895a970 Update: Translations from eints
norwegian (bokmal): 3 changes by eriksorngard
french: 3 changes by ottdfevr
portuguese: 3 changes by azulcosta
2024-04-28 04:41:11 +00:00
Peter Nelson 440a633fcc Codechange: Remove shrink_to_fit for more lists.
A comment about "will actually do nothing" is out of date as that is not the case with std::vector.

These lists are always short lived (either within a command handler or in a window) so don't shrink_to_fit.
2024-04-27 19:25:34 +01:00
Peter Nelson 33aedc43a5 Codechange: Shrink GUIList vectors less often, reserve before use.
After sorting and filter lists for GUI, we often shirnk them to reduce size. However this has very little benefit:

1) The memory has already been allocated, so it doesn't prevent that memory being required.
2) It causes a new allocation and copy when the vector is shrunk, actually using more memory.
3) The list is in window state, so the lifetime is only while the window is open.
4) When a filter is clearer, the original size will be needed again, which will cause another allocation.

In fact it is beneficial to reserve to the known maximum in most cases, so do that instead.
2024-04-27 19:25:34 +01:00
translators 8308998388 Update: Translations from eints
english (au): 3 changes by krysclarke
russian: 3 changes by Ln-Wolf
finnish: 6 changes by hpiirai
dutch: 6 changes by Afoklala
portuguese (brazilian): 4 changes by pasantoro
polish: 3 changes by pAter-exe
2024-04-27 04:40:44 +00:00
Peter Nelson bf8de188ec
Codechange: Use member initialization of GRFFilePropsBase. (#12581)
Don't blame compilers for our sloppy initialisation.

Removes memset, and lengthof.
2024-04-26 22:58:54 +01:00
Peter Nelson 72c55128d2
Codechange: Remove write-only spec_id from RoadStopSpec. (#12582)
Comment is incorrect about its value too.
2024-04-26 21:56:30 +01:00
Peter Nelson a6d401debf
Fix: Properly test for presence of waypoint in NewGRF resolver. (#12579)
Test whether the BaseStation itself a Station or Waypoint, instead of by the station class ID assigned to it.
2024-04-26 17:47:53 +01:00
translators a60a81f34e Update: Translations from eints
swedish: 7 changes by joeax910
vietnamese: 15 changes by anmatngu
greek: 31 changes by gh658804, 2 changes by KyriakosMich
hungarian: 2 changes by egri-nagy
portuguese (brazilian): 2 changes by pasantoro
2024-04-26 04:41:25 +00:00
Rubidium 0fdabca605 Codechange: use std::span instead of custom span in TGP 2024-04-26 06:15:29 +02:00
Peter Nelson f44d8fa2e4
Codechange: Remove CDECL from filter functions. (#12578)
These functions are not passed to qsort()...
2024-04-25 22:13:23 +01:00
Peter Nelson 0075a95278
Codefix: Make three _filter_funcs definitions distinct. (#12573)
Rename the GUIList function lists defined as the same symbol.
2024-04-25 21:01:15 +01:00
Peter Nelson 5bc9854be2
Codechange: Make sort list function lists safer. (#12574)
GUIList has a pointer only to the start of each sort/filter func list, which has the potential for UB as it is unable to validate that the selected sort or filter type is in range.

Use a std::span instead and check if the selected type is in range before using it.
2024-04-25 21:00:49 +01:00
Jonathan G Rennison 9b747a173d Fix #12509: Maintain timer sort invariants when changing period 2024-04-25 20:08:24 +02:00
Jonathan G Rennison 11ec156b64 Codechange: 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.
See: #12509
2024-04-25 20:08:24 +02:00
André Cheng 57f5d27427 Doc: Fix documentation of GetDefaultValueCallback 2024-04-25 20:07:54 +02:00
André Cheng ceb0053dd9 Codechange: Correct return type of GetDefaultValueCallback 2024-04-25 20:07:54 +02:00
André Cheng 339b0ea0ff Change: Show correct default value and unit for vehicle service interval setting 2024-04-25 20:07:54 +02:00
André Cheng fd80a1ec66 Fix #11345: Use correct default button value for vehicle service interval setting 2024-04-25 20:07:54 +02:00
André Cheng a4071b78d7 Codechange: Add callback to IntSettingDesc to support more default values 2024-04-25 20:07:54 +02:00
translators e8d25d68b9 Update: Translations from eints
russian: 2 changes by George-VB
2024-04-25 04:42:18 +00:00
Peter Nelson e8249e9075
Codechange: Pass buffers for TarFile's ExtractString as span. (#12567)
ExtractString does not need to find a string terminator as StrMakeValid already does this, so simply pass the full bounds of the buffer.

Removes lengthof, array indices, and needs only the buffer as a parameter.
2024-04-24 21:34:21 +01:00
Peter Nelson 5159aa81d4
Codechange: Use iterators when enabling industries. (#12569)
Removes lengthof and array indices.
2024-04-24 21:33:49 +01:00
Peter Nelson 26bb87ebf1
Codechange: Replace SaveLoad var length arrays with switch block and sizeof. (#12570)
SlCalcConvMemLen(), SlCalcConfFileLen() and CalcOldVarLen() follow a pattern of looking up part of a value in an array.

These function returns the size of bytes of a variable type, but is not very clear. Replace with a switch block instead.

Removes lengthof, array indices, and magic numbers.
2024-04-24 21:33:29 +01:00
Peter Nelson 1dc94d0670
Codechange: Construct string_view with first+last. (#12568)
Avoids needing to calculate size when we already have last.
2024-04-24 21:29:33 +01:00
Peter Nelson 6a3f50aa72
Codechange: Replace separate EffectVehicle arrays. (#12565)
Combine 3 separate arrays into a single struct. This keeps related data together, and avoids needing to check that each array is same length.

Use of constexpr construct ensures data in the array is not default-initialised.

Removes lengthof.
2024-04-24 21:29:12 +01:00
Peter Nelson e20f48799e
Codechange: Make StringToContentType() clearer. (#12566)
Decouples string to ContentType mapping from position within enum.

Slightly less efficient, but removes lengthof, array indices, and casting.
2024-04-24 21:26:31 +01:00
Peter Nelson 5e689ce25e
Codechange: Store cursor sprites in vector. (#12564)
Combine two separate fixed length arrays to allow simpler iteration.

No need to check that arrays are all the same length.
No need to separately store the number of sprites to draw.
Removes the upper limit of the number of sprites that can be drawn.

Removes lengthof and array indices.
2024-04-24 21:26:07 +01:00
translators 9121770582 Update: Translations from eints
korean: 3 changes by telk5093
catalan: 3 changes by J0anJosep
french: 7 changes by ottdfevr
polish: 7 changes by pAter-exe
2024-04-24 04:40:54 +00:00
Peter Nelson ac6a945e26
Revert 2408a68910: Remove work around for an MSVC bug from 17 years ago. (#12557) 2024-04-23 17:05:08 +01:00
Koen Bussemaker bef11941c6 Change: Allow rail and road depot overbuilding in current orientation in order to connect to rail or road 2024-04-23 13:11:31 +02:00
translators 95de90dd4e Update: Translations from eints
norwegian (bokmal): 7 changes by eriksorngard
danish: 7 changes by bscargo
portuguese (brazilian): 4 changes by pasantoro
2024-04-23 04:40:32 +00:00
Peter Nelson 3814adaba8
Codechange: Simplify GetScrolledItemFromWidget() (#12556)
Return `auto`, which allows working with const containers, and use std::next instead of std::advance.
2024-04-22 19:00:14 +00:00
translators c82a2575d7 Update: Translations from eints
english (au): 3 changes by krysclarke
english (us): 3 changes by 2TallTyler
greek: 3 changes by gh658804
russian: 3 changes by Ln-Wolf
finnish: 5 changes by hpiirai
turkish: 7 changes by BeratSJ
portuguese: 3 changes by azulcosta
portuguese (brazilian): 3 changes by pasantoro
2024-04-22 04:40:33 +00:00
Rubidium ded4d63db2 Codechange: simplify access to the current screenshot format 2024-04-21 21:07:05 +02:00
Peter Nelson d465257dd0
Fix 952d111: Houses and industry tiles could accept incorrect cargo. (#12547)
Default cargo label was not cleared (set to CT_INVALID) when using older 3-slot acceptance properties for house and industry tiles.

Missed in #12053 and #12062.
2024-04-21 19:46:05 +01:00
Peter Nelson 3b01d31280
Fix 8746be8: Reinstate current order test when removing road stop. (#12552)
#12144 replaced pool iteration with FindVehiclesWithOrder, however the test for current_order being OT_GOTO_STATION was erroneously removed.
2024-04-21 19:41:25 +01:00
translators c073165e34 Update: Translations from eints
greek: 5 changes by gh658804
finnish: 2 changes by hpiirai
catalan: 4 changes by J0anJosep
2024-04-21 04:42:00 +00:00
Rubidium aa895535e6 Fix 5008706: improved scenario editor tooltips in map generation stages are out of place 2024-04-20 21:56:27 +02:00
Peter Nelson 959ced71bb
Codechange: Add constants for original input/output cargo counts. (#12548)
This replaces some magic 3s and 2s.
2024-04-20 20:50:48 +01:00
Peter Nelson b4e00fa738
Codechange: Replace C-casts in pool functions. (#12541) 2024-04-20 16:50:13 +01:00
Loïc Guilloux c5ef47ee09
Codechange: [Script] Use std::unique_ptr for Company::ai_instance (#12544) 2024-04-20 16:58:46 +02:00
Rubidium 1dfd0c19f4 Fix: allow only 255 league tables, as 255 is the invalid id sentinel 2024-04-20 16:53:04 +02:00
Rubidium c377c4740d Codechange: replace cpp_lengthof with safe alternatives 2024-04-20 13:36:19 +02:00
Peter Nelson a1a01e21cf
Change: Use std::make_unique instead of passing new() (#12539) 2024-04-20 11:20:49 +01:00
Rubidium fc7f184dbd Codechange: move knowledge about 'packed' orders to the saveload code 2024-04-20 11:58:07 +02:00
Rubidium 1691b41b54 Codechange: use C++ containers for parsing the settings int lists 2024-04-20 11:57:45 +02:00
Rubidium 434c49a1f8 Codechange: remove now unused endof macro 2024-04-20 11:30:46 +02:00
Rubidium 8fe5fdf122 Codechange: use std::none_of to express clearer what the code does 2024-04-20 11:30:46 +02:00
Rubidium 8986fb0385 Codechange: replace C-style array-pointer methods with the appropriate C++ methods 2024-04-20 11:30:46 +02:00
Peter Nelson 2114888485
Change: De-template BaseSetTextfileWindow. (#12536)
The BaseSet type is not needed after the window is constructed, only the filename and name are required, which can be passed as parameters from `ShowBaseSetTextfileWindow()` instead.

This avoids compiling three instances of `BaseSetTextfileWindow`.
2024-04-20 10:30:29 +01:00
Rubidium e441033d68 Codechange: use std::array instead of C-style array for produced/accepts cargo 2024-04-20 11:29:55 +02:00
Peter Nelson 40fa45a76a Codechange: Emplace std::pair into vectors.
This creates the pair in the vector, instead of creating it then copying it in.
2024-04-20 10:25:20 +01:00
Peter Nelson ed2db80990 Codechange: Use map.emplace() instead of map.insert(std::pair).
This avoids a copy of the pair into the map.
2024-04-20 10:25:20 +01:00
Peter Nelson 57d7359b1a
Codechange: Remove old group liveries savegame conversion. (#12537)
Conversion to set default group livery is in the wrong place (not in `AfterLoadGame()`), however it is not necessary any more as `AfterLoadGame()` always calls the function `UpdateCompanyLiveries()` which will do the same thing.
2024-04-20 10:25:04 +01:00
Peter Nelson 699c7e4c9d
Fix 3de8853e29: Industries accept/produce no cargo for pre-SLV_78 saves. (#12508)
Industry accepted/produced was trimmed too early for original and pre-SLV_78 saves, as cargo type was not stored per slot so all slots look invalid to the trim function.
2024-04-20 10:24:35 +01:00
Peter Nelson 1c31e4b68c
Change: Disallow using Action A to load sprites above the baseset unless reserved. (#12435)
Using Action A above the baseset is error prone as the sprites are not fixed and can be moved around.

Any NewGRF doing so is likely to break in the future, so force it to break instead.
2024-04-20 10:23:36 +01:00
Peter Nelson e028c15555
Codechange: Use std::accumulate to get infrastructure total rail/road pieces. (#12442) 2024-04-20 10:22:19 +01:00
translators 08140fdca3 Update: Translations from eints
dutch: 4 changes by Afoklala
2024-04-20 04:41:21 +00:00
Peter Nelson 6cbb8d02cf Change: Use aspect ratio for shared order list button. 2024-04-19 22:11:16 +01:00
Peter Nelson 5df5e3f45c Change: Use aspect ratio for file home button. 2024-04-19 22:11:16 +01:00
Peter Nelson 2a833a8968 Change: Use aspect ratio for rail station platforms/tracks buttons. 2024-04-19 22:11:16 +01:00
Peter Nelson 7e049aa2b1 Change: Use aspect ratio for common left/right buttons. 2024-04-19 22:11:16 +01:00
Peter Nelson 16eb17418b Change: Use aspect ratios for some common widgets. 2024-04-19 22:11:16 +01:00
Peter Nelson 61c6ebaacc Change: Automatically set aspect ratio of common window decorations. 2024-04-19 22:11:16 +01:00
Peter Nelson d43ff8dc49 Change: Ability to set aspect ratio of a widget.
This allows setting the shape of a widget without dealing with absolute pixel sizes.
2024-04-19 22:11:16 +01:00
Peter Nelson f267b37a33
Codechange: Use std::initializer_list/array in framerate window. (#12441) 2024-04-19 22:07:56 +01:00
Peter Nelson a28ab8cac2
Codechange: Replace C-style casts to size_t with static_cast. (#12455)
* Codechange: Replace C-style casts to size_t with static_cast.

This touches only simple value-type casts.

* Codechange: Replace static_cast<size_t>(-1) with SIZE_MAX

Co-authored-by: Rubidium <rubidium@openttd.org>
2024-04-19 20:34:36 +01:00
Peter Nelson 6ee31a2a22
Codechange: Use string_view in IniItem/IniGroup/IniFile. (#12535)
This avoids making extra copies of strings.
2024-04-19 13:54:22 +01:00
Peter Nelson 3b80a8255f
Fix #12433: Width of unit number display was too narrow. (#12534)
Digit width was counted, but ignored the thousands separator.
2024-04-19 08:19:31 +01:00
translators 7848e80f71 Update: Translations from eints
english (us): 4 changes by 2TallTyler
korean: 11 changes by telk5093
2024-04-19 04:40:34 +00:00
dP 0d1fc47edb
Cleanup: Remove redundant break statement (#12527) 2024-04-18 20:54:20 -04:00
Peter Nelson 774f811217
Codechange: Use std::optional for town parent scope resolver. (#12530)
When resolving NewGRF, the parent town_scope is lazily initialised as it does not always need to be used.

Replace the manually managed pointer with std::optional to simplify. Using std::optional avoids extra memory allocation.
2024-04-18 22:14:16 +01:00
Peter Nelson 3b75d8bbf8 Fix: Use modern comparisons instead of memcmp in cache check.
This uses C++20 default operator<=> to provide comparisons of some objects.

This works properly with caches that containers.
2024-04-18 22:13:55 +01:00
Peter Nelson 21d11ee361 Codechange: Move cache check function to own file. 2024-04-18 22:13:55 +01:00
Peter Nelson db56499c01 Codechange: Use std::array for company infrastructure arrays. 2024-04-18 22:13:55 +01:00
Peter Nelson fe7bd3a266 Codechange: Use std::array for cached town zone radius. 2024-04-18 22:13:55 +01:00
Peter Nelson d57bf84196
Codechange: Remove some unnecessary c_str() when passing std::strings. (#12532)
Functions have been updated from `char *` to `std::string` since without removing `c_str()`.
2024-04-18 22:13:13 +01:00
Peter Nelson 45886e50b2
Codechange: Unify where rail station tile flags are set. (#12531)
This avoids repeating the logic in three places.
2024-04-18 18:54:10 +01:00
Patric Stout 04a3bf76e8
Codechange: upgrade Emscripten to 3.1.57 (#12526)
This also upgrades liblzma to 5.4.6, and uses the new ports.contrib
system Emscripten 3.1.56 introduced.
2024-04-18 19:37:33 +02:00
Patric Stout 08d05bf4c0
Doc: update release documentation with the latest (#12525) 2024-04-18 17:12:52 +00:00
Peter Nelson 4170c9923a
Fix: Inconsistent space between console history and current line. (#12528) 2024-04-18 17:45:41 +01:00
Tyler Trahan 78b83190cc
Fix: Mark vehicle status bars dirty when a vehicle leaves unbunching depot (#12516) 2024-04-18 12:45:00 -04:00
Patric Stout 715f8c0218
Codefix: cast to "CommandCallback *" in a way cast-function-type-mismatch doesn't mind (#12529) 2024-04-18 16:41:36 +00:00
translators c355e98c58 Update: Translations from eints
english (au): 4 changes by krysclarke
russian: 4 changes by Ln-Wolf
finnish: 7 changes by hpiirai
portuguese: 4 changes by azulcosta
portuguese (brazilian): 5 changes by pasantoro
polish: 4 changes by pAter-exe
2024-04-18 04:40:27 +00:00
Peter Nelson 63ce81570c Remove: Custom opendir implementation for Windows no longer needed.
std::filesystem::directory_iterator is now used instead.
2024-04-18 01:41:14 +01:00
Peter Nelson 42523379d9 Codechange: Use directory_iterator in ScanPath.
Replaces use of custom ttd_opendir.
2024-04-18 01:41:14 +01:00
Peter Nelson d7c547d0db Codechange: Use directory_iterator to list directories in file list windows.
This replaces use of custom ttd_opendir. Files are listed separately using ScanPath as that handles downloaded content.
2024-04-18 01:41:14 +01:00
Peter Nelson 5a523cf212 Codechange: Simplify FioCreateDirectory.
`std::filesystem` provides `create_directories()` as a cross-platform way to create a directory tree.
2024-04-18 01:41:14 +01:00
Peter Nelson 6458980413
Change: Draw group hierarchy tree lines. (#12522) 2024-04-17 21:55:19 +01:00
Jonathan G Rennison 83d99ec11d
Fix #12506: Update station/industry nearby lists in BuildOilRig (#12511) 2024-04-17 22:38:11 +02:00
Patric Stout f7bd080015
Codechange: improve desync documentation (#12521) 2024-04-17 20:36:08 +00:00
Patric Stout 07b162ffc4
Codechange: skip all commands of the past during desync replay (#12520) 2024-04-17 20:05:45 +00:00
Patric Stout a0636d8200
Codechange: use infinite-fast-forward when rerunning command-log (#12519) 2024-04-17 20:01:58 +00:00
Patric Stout a09749f6a6
Codefix: don't send desync=0 log messages to commands.log (#12517)
They are only used during replay, and you want to see those in
the console; not in the log.
2024-04-17 19:51:36 +00:00
Patric Stout 1005c86c62
Codechange: record cache warnings with a "warning" prefix (#12518) 2024-04-17 19:49:55 +00:00
Tyler Trahan a02da5476e
Fix: Don't show train waiting for unbunching as waiting for free path (#12515) 2024-04-17 15:04:16 -04:00
Tyler Trahan 5878d09ef2
Fix: Smooth outliers in unbunching round trip calculations (#12513) 2024-04-17 15:03:53 -04:00
Tyler Trahan 824687d1f0
Codefix: Don't mix signed and unsigned ints in unbunching calculations (#12514) 2024-04-17 14:42:49 -04:00
Jonathan G Rennison 0b9029b69c Fix: Station/industry nearby list checks in CheckCaches 2024-04-17 20:33:49 +02:00
Peter Nelson ef8eb66a2b
Fix c38df2d58: Use VehicleID instead of pointer in map of vehicles to replace. (#12512)
This affects the sort order, VehicleID is deterministic, Vehicle * is not.
2024-04-17 18:54:50 +01:00
Paco Esteban b477a8458c Codechange: Use arc4random_buf on random_func.cpp for OpenBSD 2024-04-17 19:29:26 +02:00
translators 018326321c Update: Translations from eints
english (us): 5 changes by 2TallTyler
latvian: 1 change by lexuslatvia
2024-04-17 04:40:56 +00:00
Koen Bussemaker 257d312a58 Fix #12228, Fix #12231: CheckShipReverse only restricts path when it has to 2024-04-16 20:21:18 +02:00
Rubidium b2218e75d4 Codefix: missing space between close parenthesis and open curly brace 2024-04-16 19:28:09 +02:00
Peter Nelson 48eb9b8bc9
Add: Check that towns can build roads before generating map. (#12503) 2024-04-16 15:25:07 +00:00
translators 8e2ccddd77 Update: Translations from eints
portuguese (brazilian): 2 changes by pasantoro
2024-04-16 04:40:57 +00:00
Peter Nelson 3ad143c43a
Codechange: Use `x = y` instead of `x{y}` for value-type member initialisation. (#12501)
This is easier to read and less likely to look like an array definition.
2024-04-15 23:07:36 +01:00
Koen Bussemaker 672aa014d8 Doc: Updated Visual Studio, cpp standard and Cmake version 2024-04-15 23:06:23 +02:00
ladysadie 727392e0b3
Codechange: Remove per font AA settings. (#12413)
OpenTTD will use the global AA font setting for all fonts from now on.
2024-04-15 21:44:33 +02:00
Peter Nelson a1b03ee69e
Codechange: Replace platform-specific calls with std::filesystem::last_write_time. (#12487) 2024-04-15 18:10:19 +00:00
dP f5a50a874f
Codechange: Update doxygen comment to reflect removed parameter (#12499) 2024-04-15 12:40:50 +02:00
translators cd108fd9e4 Update: Translations from eints
greek: 10 changes by gh658804
2024-04-15 04:44:34 +00:00
Peter Nelson 839f486074
Codechange: Use directory_iterator to find language files. (#12495)
This avoids using custom ttd_opendir, along with C-style string comparisons against file names.
2024-04-14 23:57:26 +01:00
Peter Nelson 4eaeccdaeb
Codechange: Introduce FioRemove() to remove files. (#12491)
New function FioRemove() handles OTTD2FS conversion, and uses std::filesystem::remove instead of unlink, all in one location.
2024-04-14 23:43:50 +01:00
translators 29e932e087 Update: Translations from eints
ukrainian: 13 changes by imlystyi
lithuanian: 19 changes by dziugas1959
french: 7 changes by ottdfevr
portuguese (brazilian): 14 changes by pasantoro
2024-04-14 05:02:47 +00:00
translators 090c3b3abf Update: Translations from eints
danish: 5 changes by bscargo
dutch: 5 changes by Afoklala
portuguese (brazilian): 7 changes by pasantoro
2024-04-13 04:40:27 +00:00
Peter Nelson e83e2df023
Fix: Build industry window did not take width of count into account. (#12476) 2024-04-12 23:07:31 +01:00
Peter Nelson 12125bad82
Fix 3de8853e: Industry cargo types callback no longer functioned due to container change. (#12489)
Use defined INDUSTRY_NUM_INPUTS/INDUSTRY_NUM_OUTPUTS values instead of container size, which is now empty at this point.
2024-04-12 23:07:07 +01:00
Peter Nelson c1520cf682
Fix 25aeb1c: Driver parameter documentation was not updated. (#12486) 2024-04-12 17:01:40 +00:00
Peter Nelson ca73f03334
Codechange: Use std::filesystem::remove/rename in settingsgen. (#12483) 2024-04-12 14:32:35 +01:00
Peter Nelson 44b8210037
Codechange: settingsgen's CopyFile actually appends. (#12485) 2024-04-12 13:01:16 +01:00
Peter Nelson 003906becb
Codechange: std::filesystem::rename does not need remove first. (#12484) 2024-04-12 12:51:42 +01:00
translators bb9b8b90c7 Update: Translations from eints
swedish: 6 changes by sereneavatar
portuguese (brazilian): 11 changes by pasantoro
2024-04-12 04:41:30 +00:00
Peter Nelson 9915c1f032
Fix #12477: Use std::filesystem::rename instead of Windows Shell API call. (#12478) 2024-04-11 21:35:40 +01:00
Rubidium eda10abc8c Codechange: pass command line arguments as std::span to openttd_main 2024-04-11 21:57:53 +02:00
Peter Nelson 3316b27496
Fix: Signature validation did not close its file. (#12479) 2024-04-11 13:37:29 +00:00
Rubidium afd7878de0 Codechange: internally use a span of arguments for GetOptData 2024-04-11 12:00:36 +02:00
Rubidium 5592b4409b Codechange: use ranged for loop and separate function instead of goto 2024-04-11 12:00:36 +02:00
Rubidium e8a56db21d Codechange: use designated initializers for OptionData and pass as span 2024-04-11 12:00:36 +02:00
Rubidium 4f2412a272 Codechange: range based for loops instead of C-style for loops 2024-04-11 07:05:04 +02:00
Rubidium 2587a21400 Codechange: use zero-initialization instead of C-style loop 2024-04-11 07:05:04 +02:00
Rubidium ff27b9e76a Codechange: use std::any_of instead of custom loop 2024-04-11 07:05:04 +02:00
translators 6cade18053 Update: Translations from eints
portuguese (brazilian): 1 change by pasantoro
polish: 1 change by pAter-exe
2024-04-11 04:41:57 +00:00
rubidium42 442daf58da Codechange: replace lengthof with std::size in Windows specific code 2024-04-10 23:17:13 +02:00
Peter Nelson 6bc4a62c27 Codechange: Pass std::string_view from blitters instead of char *. 2024-04-10 22:02:04 +01:00
Peter Nelson 332cbca36e Codechange: Pass std::string_view from drivers instead of char *. 2024-04-10 22:02:04 +01:00
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.
2024-04-10 21:32:21 +01:00
Peter Nelson 144bcbbaf1
Fix: Use clear() to clear std::string. (#12471) 2024-04-10 17:27:30 +00:00
Rubidium 21b640b5ff Codechange: simplify president name generation 2024-04-10 18:57:53 +02:00
Patric Stout 1b4bb1d38a
Codefix: [CMake] use the UTC0 date for our ISODATE (#12470) 2024-04-10 08:50:44 +00:00
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
2024-04-10 04:40:30 +00:00
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.
2024-04-09 23:16:20 +01:00
Rubidium df8eeb1b10 Codechange: use C++ algorithms to determine the SaveLoadFormat 2024-04-09 23:36:39 +02:00
Peter Nelson 77f27e0804 Change: Expose NewGRF classes and specs as spans and simplify iteration.
This replaces some index-based loops with range loops.
2024-04-09 21:46:59 +01:00
Peter Nelson 052f421327 Change: Use vector/iterators/algorithms instead of C-array/loops for NewGRF classes. 2024-04-09 21:46:59 +01:00
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.
2024-04-09 21:46:59 +01:00
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.
2024-04-09 21:46:29 +01:00
Peter Nelson 2976a46d06
Fix 54be756: Terminating NUL byte was not skipped in ReadString(). (#12462) 2024-04-09 15:15:09 +01:00
Rubidium 883d3e7a9f Codechange: use std::span instead of pointer + length 2024-04-09 10:11:50 +02:00
Peter Nelson 54be756aae
Codechange: Pass NewGRF strings as std::string_view instead of char *. (#12461) 2024-04-09 08:40:27 +01:00
Peter Nelson dc7c2bb30d
Fix: Draw continuation lines for engine variant hierarchy tree. (#12434) 2024-04-09 08:35:12 +01:00
Peter Nelson de4e00c93f
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
2024-04-09 08:34:45 +01:00
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
2024-04-09 04:40:33 +00:00
Peter Nelson 1b127628cb
Codechange: Use dynamic_cast with FindWindowById. (#12458)
Missed from 74e09ab.
2024-04-08 22:32:57 +01:00
Peter Nelson 7e28605830 Fix: Use reinterpret_cast instead of C-style cast to align pointers. 2024-04-08 18:21:42 +01:00
Peter Nelson 4daf95b878 Fix: Use static_cast instead of C-cast to avoid hidden errors. 2024-04-08 18:21:42 +01:00
Peter Nelson cdfffb551c Fix: sym->sym accidentally changed to sym prevented keys working with SDL. 2024-04-08 18:21:42 +01:00
Peter Nelson 74e09abf76
Codechange: Use dynamic_cast instead of C-cast after FindWindowById. (#12448)
dynamic_cast was used in most places, but not all.
2024-04-08 13:26:19 +01:00
Rubidium 4e6d4fcf32 Codechange: replace for loops with endof with range-based for loops 2024-04-08 07:00:55 +02:00
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
2024-04-08 04:41:24 +00:00
Rubidium 62f5c595f3 Codechange: use range-based for loops and let count be correct count 2024-04-07 23:08:33 +02:00
rubidium42 4718971ccc Codechange: use std::size instead of lengthof for town names 2024-04-07 23:08:07 +02:00
Peter Nelson 995fca58a2
Codechange: Use begin/end instead of endof for some industry arrays. (#12447) 2024-04-07 22:01:46 +01:00
Rubidium d7fa614a9d Codechange: use range-based for loop for debug levels and fix global variable naming 2024-04-07 22:17:57 +02:00
Rubidium 1fcf1a136d Codechange: use single function returning std::span over two functions that return size and begin 2024-04-07 22:02:16 +02:00
translators 0f6bf90731 Update: Translations from eints 2024-04-07 04:41:19 +00:00
Peter Nelson eb094a953c
Codefix: Social Plugins widget parts were not constexpr. (#12443)
Widget lists were made constexpr except these.
2024-04-06 22:32:26 +00:00
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.
2024-04-06 21:16:02 +01:00
Peter Nelson fbdf26800b
Codechange: Use std::initializer_list and range-for for credits window. (#12431)
Replaces C-style array, indexed looping, and char * strings.
2024-04-06 19:30:23 +01:00
Peter Nelson a4c2f0778a
Codechange: Use range-for to iterate keycode-to-name lookups. (#12429)
Replaces C-style looping.
2024-04-06 19:30:01 +01:00
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.
2024-04-06 19:29:41 +01:00
Peter Nelson 830c9e2de8 Codechange: Simplify iteration of framerate performance elements. 2024-04-06 19:28:51 +01:00
Rubidium 97bea563d7 Codechange: let lengthof fail when anything that isn't a C-style array is passed 2024-04-06 07:21:31 +02:00
Rubidium c544a2be0a Fix: do not use lengthof() for non C-style arrays 2024-04-06 07:21:31 +02:00
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
2024-04-06 04:41:24 +00:00
Peter Nelson 8e881471c1 Codechange: Pass replacement blitter name as string_view instead char *. 2024-04-05 23:23:33 +01:00
Peter Nelson 6771dbe62b Codechange: Use range-for to find replacement blitter. 2024-04-05 23:23:33 +01:00
Peter Nelson a866166673
Codechange: Use initializer_list and range-for for OpenTTD title. (#12430)
Replaces C-style array and looping.
2024-04-05 21:52:50 +01:00
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.
2024-04-05 21:51:36 +01:00
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.
2024-04-05 19:16:22 +01:00
Peter Nelson e8c78df39e
Fix #12233: Mini order list overlaps vehicle group name. (#12423)
Move mini order list down one line to make room.
2024-04-05 08:18:12 +01:00
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.
2024-04-05 08:17:42 +01:00
translators df3e5ade11 Update: Translations from eints
korean: 2 changes by telk5093
portuguese (brazilian): 1 change by pasantoro
2024-04-05 04:43:25 +00:00
Peter Nelson 7572cfd103 Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
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.
2024-04-04 22:27:03 +01:00
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.
2024-04-04 22:27:03 +01:00
Peter Nelson 7c322ebcf1 Codechange: Define a ZOOM_LVL for minimum text effect visibility. 2024-04-04 22:27:03 +01:00
Peter Nelson 197fb00d31
Fix #12395: Ensure president name widget is tall enough. (#12419) 2024-04-04 17:56:16 +01:00
Peter Nelson 338def1b06
Fix: Segfault when using -q without providing a . character. (#12418)
Use std::filesystem::path to find extension instead of strrchr.
2024-04-04 14:39:15 +01:00
Peter Nelson f6a88e40a4
Codechange: Use std::list for News Items. (#12338) 2024-04-04 07:53:14 +01:00
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
2024-04-04 04:41:30 +00:00
Loïc Guilloux 243c6bead3
Fix #12415, 9c49a61, df400ef: Aircraft::tile is valid only for front vehicle (#12416) 2024-04-03 23:16:36 +02:00
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
2024-04-03 04:40:31 +00:00
Peter Nelson 9750826590
Fix a29766d: Wrong scrolling dropdown list position with RTL. (#12412) 2024-04-02 13:29:15 +01:00
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
2024-04-02 04:41:36 +00:00
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.
2024-04-01 22:33:16 +01:00
Peter Nelson 56cac21086 Codechange: Use functions to create common drop down list items. 2024-04-01 22:33:16 +01:00
Loïc Guilloux 11aa3694fa
Fix: [Win32] Force font mapper to only use TrueType fonts (#12406) 2024-04-01 22:59:13 +02:00
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.
2024-04-01 21:35:20 +01:00
Peter Nelson 00e0021e3a Codechange: Don't assume accepted/produced slot exists. 2024-04-01 21:35:20 +01:00
Peter Nelson 295508fc53 Codechange: Avoid lengthof() on std::array. 2024-04-01 21:35:20 +01:00
Peter Nelson f79ec7955a Codechange: Explicitly reset old industry data before loading games. 2024-04-01 21:35:20 +01:00
Peter Nelson bd2a92331b Codechange: Use inline and std::array for old industry structures.
This avoids separate declaration/definition, and less C-style arrays.
2024-04-01 21:35:20 +01:00
Peter Nelson f6b38e8e06 Codechange: Remove optional MakeCargo() parameters that are never changed.
Default values are always used, so don't need to be parameters.
2024-04-01 18:46:29 +01:00
Peter Nelson e4fc8ef595 Codechange: Use std::span for industry cargo window instead of pointer + length. 2024-04-01 18:46:29 +01:00
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.
2024-04-01 17:57:03 +01:00
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.
2024-04-01 17:55:44 +01:00
Peter Nelson d68e5159e1
Feature: Allow base sounds set to be changed mid-game. (#12399) 2024-04-01 17:54:42 +01:00
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
2024-04-01 04:40:15 +00:00
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.
2024-03-31 19:37:16 +01:00
Rubidium d5e28a904d Fix fb9d4af: use different nonces for key exchange and stream encryption 2024-03-31 15:14:16 +02:00
translators 9954187680 Update: Translations from eints
greek: 172 changes by gh658804
ukrainian: 18 changes by StepanIvasyn
portuguese (brazilian): 9 changes by pasantoro
2024-03-31 04:41:01 +00:00
Patric Stout 77f02faf15
Codefix 977aba73be: also update comment about removal of is_random (#12400) 2024-03-30 13:29:51 +01:00
translators 340c2802da Update: Translations from eints
ukrainian: 14 changes by StepanIvasyn
dutch: 3 changes by Afoklala
portuguese (brazilian): 34 changes by pasantoro
2024-03-30 04:40:28 +00:00
Patric Stout e866ca8adc
Cleanup 69d5b9d3: actually clean up all remnants of "no-thread" builds (#12398) 2024-03-29 23:26:32 +01:00
Patric Stout c0308acb03
Fix: "-q" displays NewGRF IDs in the wrong byte-order (#12397) 2024-03-29 23:26:24 +01:00
Peter Nelson 8d312b305b
Codechange: Replace currency macros with functions. (#12396) 2024-03-29 14:49:48 +00:00
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
2024-03-29 04:41:18 +00:00
Peter Nelson e16b982b6a Codechange: Use iteration when dealing with all HouseSpecs. 2024-03-28 23:23:00 +01:00
Peter Nelson 3e83dcedfd Codechange: Allocate houses dynamically instead of from a fixed array.
This uses vectors for HouseSpecs and global/town building counts.
2024-03-28 23:23:00 +01:00
Peter Nelson 8746be8bf2
Codechange: Use FindVehiclesWithOrder when removing a road stop. (#12144) 2024-03-28 23:22:37 +01:00
frosch 907cb4fc53
Fix: [Script] ScriptSubsidy::GetExpireDate should return an economy-date (#12372) 2024-03-28 23:21:20 +01:00
Michael Lutz 8fb7d74dfe Fix eabb9db: Drag building of road stops should not allow mixing z levels. 2024-03-28 22:28:48 +01:00
Michael Lutz 69acc132ca Fix #12387, eabb9db: [NewGRF] Wrong tile offset passed to rail station CB 149 (slope check) 2024-03-28 22:28:48 +01:00
Loïc Guilloux 71087bb6d3
Change: [CI] Always use latest stable Xcode (#12390) 2024-03-28 21:22:20 +01:00
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
2024-03-28 04:40:56 +00:00
Jonathan G Rennison 433484cda3
Fix #12388: Vehicle::CopyVehicleConfigAndStatistics not releasing unit number (#12389) 2024-03-27 21:20:27 +01:00
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
2024-03-27 04:43:49 +00:00
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
2024-03-26 04:40:35 +00:00
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.
2024-03-25 22:50:05 +01:00
Peter Nelson 4751179dc5
Codefix: Remove unused class member and extraneous spaces. (#12378) 2024-03-25 21:35:31 +00:00
Rubidium 9aa6669266 Fix: inconsistent check for client authorized status 2024-03-25 22:32:23 +01:00
Rubidium 84bbe235e4 Fix: do not send chat to clients that have not authorized yet 2024-03-25 22:32:23 +01:00
Tyler Trahan f71ada4f30
Fix #12268: Capitalize "Wait to unbunch" order string (#12375) 2024-03-25 13:46:03 -04:00
SamuXarick f845b4bbc3
Fix: Changing NPF max search nodes while in-game had no effect (#12194) 2024-03-25 17:28:16 +01:00
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
2024-03-25 04:40:35 +00:00
Peter Nelson 97c1738541
Fix #12368: Incorrect offset for click position within industry chain window. (#12370) 2024-03-24 18:35:33 +00:00
Peter Nelson eebfb83aa2
Fix 2fd9096: Label for fruit incorrectly changed to `FRUI` from `FRUT`. (#12367) 2024-03-24 15:53:26 +00:00
Tyler Trahan 8928f4979a
Change: Add dividers in vehicle group action dropdown (#12284) 2024-03-24 07:44:25 -04:00
Rubidium caa7c44052 Cleanup: remove checks for old MSVC versions 2024-03-24 10:09:15 +01:00
Rubidium d09b5aaeba Codechange: use int32_t instead of uint16_t for scroll bar position/size/capacity 2024-03-24 08:30:38 +01:00
Rubidium c01bf06ee1 Codefix: some minor errors in tcp-game protocol documentation 2024-03-24 06:40:38 +01:00
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
2024-03-24 04:41:07 +00:00
Peter Nelson 668186ca5b
Codechange: Remove macros involved with NewGRFClass. (#12363)
Use direct class instantiation instead.
2024-03-23 21:55:50 +00:00
Peter Nelson ff35288ddf
Fix: Don't let CT_INVALID map to valid cargo type. (#12364) 2024-03-23 20:18:31 +00:00
glx22 02c00f3e3e Change: [Script] Use economy time for ScriptDate 2024-03-23 21:17:40 +01:00
glx22 704e871a0e Revert bbdbf9a: ScriptTimeMode was not the best solution for economy/calendar support 2024-03-23 21:17:40 +01:00
frosch 603154899a
Add: [SDL2] Driver parameter 'no_mouse_capture' to ease interactive debugging (#12336) 2024-03-23 20:48:26 +01:00
Rubidium 0f25eaa271 Fix: crash to desktop when attempting to join a company while not joined (yet) 2024-03-23 13:33:41 +01:00
Jonathan G Rennison 515303b8be Fix #12092: Incorrect x-axis in cargo payment graph window 2024-03-23 13:33:29 +01:00
Tyler Trahan 2732b3d6c6
Change: Show unbunching action in timetable window (#12351) 2024-03-23 08:23:13 -04:00
Peter Nelson ea74ca0a76
Fix #12347: Crash attempting to find catchment tiles of a station with no catchment area. (#12348) 2024-03-23 13:03:59 +01:00
Rubidium f599108c16 Codechange: move 'months_empty' to CompanyProperties 2024-03-23 11:59:34 +01:00
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
2024-03-23 04:41:01 +00:00
Peter Nelson df2ee7b06c
Cleanup: Remove old SaveLoad workarounds for MS VS 2017. (#12355) 2024-03-23 00:12:35 +00:00
Rubidium e904122441 Codefix: follow coding style 2024-03-22 22:24:17 +01:00
merni-ns 7457f8d0ff
Codefix: Incorrect pluralisation in last service/service interval texts (#12352) 2024-03-22 19:19:29 +00:00
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>
2024-03-22 09:33:16 -04:00
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
2024-03-22 04:41:18 +00:00
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
2024-03-21 21:14:30 +01:00
Jonathan G Rennison e42aec5a89 Fix #12305: Crash with large positive sprite x offset in engine preview window 2024-03-21 21:05:27 +01:00
translators 0eaeeaabb6 Update: Translations from eints
russian: 2 changes by Ln-Wolf
catalan: 2 changes by J0anJosep
portuguese (brazilian): 23 changes by pasantoro
2024-03-21 04:40:53 +00:00
Tyler Trahan 704d3b8a9b
Fix #12342: Add missing ellipsis to town generation error string (#12343) 2024-03-20 20:32:38 +00:00
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
2024-03-20 04:40:30 +00:00
Owen Rudge d4a6ee9554 Change: [CI] Use Azure Code Signing for Windows build 2024-03-19 23:12:36 +00:00
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
2024-03-19 04:41:12 +00:00
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.
2024-03-18 23:39:42 +00:00
Rubidium 7580eac2d5 Codechange: create helper class for useful NetworkAuthorizedKeys functions 2024-03-18 22:56:58 +01:00
Peter Nelson 2485de9462
Codefix: Widget should be passed as WidgetID type. (#12332) 2024-03-18 20:32:38 +00:00
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.
2024-03-18 17:49:51 +00:00
translators ec3c8d3462 Update: Translations from eints
ukrainian: 12 changes by StepanIvasyn
portuguese (brazilian): 21 changes by pasantoro
polish: 52 changes by pAter-exe
2024-03-18 04:40:36 +00:00
Rubidium 4af089b9be Feature: console command to change authorized keys 2024-03-17 21:21:33 +01:00
Rubidium b7dfa3eb90 Feature: authorized key authentication for rcon 2024-03-17 20:36:25 +01:00
Rubidium 1cf8799810 Feature: encrypt the connection between game server and client 2024-03-17 19:48:34 +01:00
Rubidium d26629c15b Codechange: make encoded length of packet size and type more explicit 2024-03-17 19:48:34 +01:00
Rubidium 5706801ea7 Feature: authenticate to the server without sending the password
Either using password-authentication key exchange or via authorized keys
2024-03-17 19:09:22 +01:00
Rubidium dd532cbc77 Codechange: add setting for authorized/secret/public keys 2024-03-17 19:09:22 +01:00
Rubidium fb9d4afa5c Codechange: add set of classes providing authentication and encryption 2024-03-17 18:33:53 +01:00
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.
2024-03-17 16:23:14 +00:00
Peter Nelson 322ca6ef54 Codechange: Shuffle members of Vehicle to reduce size.
This reduces space wasted due to member alignment.
2024-03-17 16:22:38 +00:00
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.
2024-03-17 16:22:38 +00:00
Patric Stout f08da1d373
Codechange: the "no revision detected" string is with four zeros (norev0000) (#12328) 2024-03-17 13:17:35 +00:00
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.
2024-03-17 09:34:28 +00:00
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
2024-03-17 04:40:30 +00:00
frosch a886bd9666
Fix #12319, 3a676a5: Some SSE blitters were broken due to ODR violations (#12322) 2024-03-16 23:42:38 +00:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Loïc Guilloux bd7120bae4
Fix #12316, 268e512: Support for enum storage type in GenerateWidget.cmake (#12321) 2024-03-16 23:43:20 +01:00
merni-ns af1bd43b30
Codefix 4c0dca1: [CI] Fix typo in workflow file (#12318) 2024-03-16 19:48:12 +00:00
Peter Nelson 0058ebe472
Codechange: Check cheap station-facility-filter before expensive in-use-filter. (#12317) 2024-03-16 19:37:32 +00:00
Loïc Guilloux 818a57c9af
Codechange: Actually use LIT_NONE (#12314) 2024-03-16 16:41:58 +00:00
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.
2024-03-16 17:02:19 +01:00
Patric Stout 7f49b6f25a
Codefix: allow preview label on PRs against release branches too (#12310) 2024-03-16 16:49:03 +01:00
Patric Stout 5f4f9334ce
Codefix f1e999ec: use RandomRange(l) instead of _random.Next(l) (#12274) 2024-03-16 14:39:57 +00:00
merni-ns 4c0dca1411
Codechange: [CI] Move Release CI build to MacOS runner (#12309) 2024-03-16 15:11:23 +01:00
Rubidium fe12d38024 Codechange: split initiating of joining and identification of the client 2024-03-16 13:35:41 +01:00
Rubidium 15d02f51ed Codechange: use span to send bytes to Packet and add span recv function 2024-03-16 12:27:06 +01:00
Rubidium b6c75dec3a Codechange: explicitly allow only one state in initial handshake/authorization 2024-03-16 11:35:44 +01:00
Rubidium 26d1d5d6e7 Codechange: move decision whether to check NewGRFs to SendNewGRFCheck, just like for sending game/company passwords 2024-03-16 11:35:44 +01:00
Rubidium 6eff879e49 Codechange: pass the socket handler that is going to send the packet into the packet 2024-03-16 10:39:22 +01:00
Rubidium 3c488e1eb8 Codechange: don't check things outside the lock, that could change while waiting on the lock 2024-03-16 10:39:22 +01:00
Rubidium ec4104ec6c Codechange: do not pass the socket when the receiver already knows it 2024-03-16 10:39:22 +01:00
Patric Stout 3e625b5b1a
Add: track savegame size to report with survey (#12304) 2024-03-16 08:58:56 +01:00
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
2024-03-16 04:41:24 +00:00
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.
2024-03-15 08:04:08 +01:00
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
2024-03-15 04:41:43 +00:00
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
2024-03-14 04:41:11 +00:00
Ivan Fefer 23d733be95
Add: Basic autocompletion on tab for console commands (#12163) 2024-03-13 21:43:08 +01:00
Rubidium 24efdf6ac5 Codefix 363e251: incorrect trace debug message 2024-03-13 20:42:27 +01:00
SamuXarick 14d95ef1c9
Fix #12279: Update random path each step (#12286) 2024-03-13 11:22:52 -04:00
Loïc Guilloux 100c043599
Codechange: [Win32] Disable assert message box when no GUI (#12291) 2024-03-13 15:49:24 +01:00
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
2024-03-13 04:41:24 +00:00
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
2024-03-12 04:41:20 +00:00
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.
2024-03-11 22:36:37 +01:00
Rubidium a06814c173 Codechange: use std::source_location over __FILE__ and __LINE__ for Random 2024-03-11 20:30:33 +01:00
Koen Bussemaker 984202b101 Codechange: Remove outdated YAPF example code 2024-03-11 20:25:48 +01:00
Patric Stout d7b99cbe26
Codefix: [CI] Store vcpkg outside the repository folder (#12271)
Otherwise tools like CodeQL can pick up on vcpkg files.
2024-03-11 18:53:09 +00:00
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.
2024-03-11 15:44:30 +01:00
Patric Stout ee22fa34d7 Codechange: [CI] Split the ci-build into smaller components 2024-03-11 15:44:30 +01:00
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.
2024-03-11 15:42:44 +01:00
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.
2024-03-11 14:19:01 +00:00
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.
2024-03-11 08:09:44 +00:00
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
2024-03-11 04:42:14 +00:00
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.
2024-03-10 17:15:34 +00:00
Rubidium 2f0fe22d63 Fix #12255: inconsistent punctuation in English 2024-03-10 16:51:21 +01:00
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.
2024-03-10 14:53:41 +00:00
Rubidium ecf534522c Codechange: replace macro with function for TileAdd(XY) 2024-03-10 15:50:24 +01:00
Rubidium 27eadc13ec Codechange: rename TILE_ADD(XY) to TileAdd(XY) 2024-03-10 15:50:24 +01:00
Rubidium df461b0329 Codechange: simplify TileAdd by using simple asserts 2024-03-10 15:50:24 +01:00
Kuhnovic 005892bfdb
Fix #12250: YAPF Trivial rail pathfinding crashes due to #12217 (#12258) 2024-03-10 14:37:56 +00:00
Patric Stout cca9dcdd57
Codechange: [DorpsGek] announce failures in nightlies to IRC / Discord (#12256) 2024-03-10 13:22:15 +00:00
Patric Stout 9c95fbdb07
Remove: official support for MSVC 2019 (#12254) 2024-03-10 13:26:07 +01:00
Rubidium 86cb184eb4 Codechange: use std::source_location over __FILE__ and __LINE__ for WindowDesc 2024-03-10 10:14:20 +01:00
Rubidium e4b3f3f495 Codechange: use std::source_location over __FILE__ and __LINE__ for NOT_REACHED 2024-03-10 10:14:20 +01:00
Rubidium bab5a8a787 Codechange: use std::source_location over __FILE__ and __LINE__ for Backup 2024-03-10 10:14:20 +01:00
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.
2024-03-10 09:33:47 +01:00
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
2024-03-10 04:40:37 +00:00
Peter Nelson 55a328c586
Codechange: Replace type-punning with `std::bit_cast` in squirrel. (#12224) 2024-03-09 17:13:17 +00:00
Peter Nelson de8a840db5
Codefix: Fully initialise `MidiFile::DataBlock` to avoid gcc warning. (#12240) 2024-03-09 17:01:39 +00:00
Loïc Guilloux 82430a1086
Fix ab315d0: Don't show "insert order" errors in the console (#12245) 2024-03-09 16:33:44 +00:00
rubidium42 e0e0d5f8fb Revert #11606: Don't auto-build past tunnelbridge ends
This reverts commit 59f6c199bf.
2024-03-09 15:54:50 +01:00
Patric Stout ebd258b404
Change: [CI] switch MacOS to the macos-14 runner (#12237)
This runner contains a newer XCode, with better C++20 support.
2024-03-09 14:41:34 +00:00
Tyler Trahan 32b0fb9f6e
Fix #12010: Use economy timer for vehicle stats minimum age, not calendar (#12142) 2024-03-09 09:38:52 -05:00
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.
2024-03-09 14:01:18 +00:00
Tyler Trahan ab315d0dc9
Fix #12118: When adding an unbunching order, properly check for unsafe conditions (#12136) 2024-03-09 08:28:05 -05:00
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.
2024-03-09 11:42:09 +00:00
glx22 3a71f36393 Change: [Script] Match FormatString behaviour more closely 2024-03-09 12:15:03 +01:00
glx22 ae27ce12a7 Fix 0858377: [Script] Don't output parameters more than once 2024-03-09 12:15:03 +01:00
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
2024-03-09 04:41:18 +00:00
Kuhnovic 08ff1ab93e
Fix #12236: Ship pathfinder causes crash when ship is already at destination (#12238) 2024-03-08 23:46:13 +01:00
Kuhnovic ab353f8ad5
Update: Developer credits (#12235) (#12235) 2024-03-08 18:31:58 +01:00
Michael Lutz 8b9f59d320 Codechange: Use references for non-optional in/out values of slope functions 2024-03-08 18:08:55 +01:00
Michael Lutz 8dda387f82 Codechange: Use std::tuple for slope functions with two return values 2024-03-08 18:08:55 +01:00
Tyler Trahan 5806c2aba4
Fix #12203: When unbunching at a depot, don't overlook implicit orders (#12220) 2024-03-08 10:19:50 -05:00
SamuXarick 0c432bdc4d Fix 3947453: GetNextDecisionNode ignored go to nearest depot when combined with stop at depot 2024-03-08 14:31:35 +01:00
SamuXarick ab52f7eecf Fix ccb4c37: Aircraft could route to hangars outside their range when stopping at them 2024-03-08 14:31:35 +01:00
merni-ns b8b80cb42e
Fix #12134: Use correct error messages if clearing drive-through road stops fails (#12139) 2024-03-08 14:29:04 +01:00
rubidium42 aef8a345b2
Codefix #12162, 3105d0b: Textbuf::Assign read beyond std::string_view (#12177) 2024-03-08 14:26:14 +01:00
jcteotonio 63b9284a7e
Add: Portuguese Escudo currency (#12108) 2024-03-08 14:25:01 +01:00
Peter Nelson a9de766fa6
Fix: Train running sounds should only be produced for engine parts. (#12229) 2024-03-08 14:23:48 +01:00
Kuhnovic 30e1a61c04
Fix: YAPF doesn't check destination for start nodes (#12217) 2024-03-08 14:23:33 +01:00
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
2024-03-08 04:40:35 +00:00
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.
2024-03-07 23:19:59 +00:00
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
2024-03-07 04:40:51 +00:00
Loïc Guilloux ef40c5e240
Fix #12225, 977aba7: [Script] Missing AI:ResetConfig support for running AI config (#12226) 2024-03-06 21:16:07 +01:00
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
2024-03-06 04:40:32 +00:00
Kuhnovic 1a2b54498b
Change: Show tile index as decimal number in land info window (#12104) 2024-03-05 21:32:29 +01:00
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.
2024-03-05 18:33:58 +00:00
Peter Nelson 00b442d6f9
Fix: Maximum permitted sound volume from NewGRF is 128. (#12222) 2024-03-05 18:31:04 +00:00
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.
2024-03-05 18:30:25 +00:00
Loïc Guilloux 845b894fd8
Remove: [Script] random_deviation from setting description table (#12221) 2024-03-05 12:41:04 +01:00
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
2024-03-04 18:35:39 +00:00
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
2024-03-03 18:34:58 +00:00
Peter Nelson 8172e25273
Codechange: Use range-for when iterating station speclists. (#12212)
This replaces indexed access.
2024-03-03 16:41:02 +00:00
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.
2024-03-03 09:31:04 +00:00
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.
2024-03-02 21:16:15 +00:00
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.
2024-03-02 21:16:15 +00:00
Peter Nelson 278c3a7db1 Codechange: Use reference instead of copy of NewGRF speclist item. 2024-03-02 21:16:15 +00:00
Kuhnovic c5afc9173c
Fix #12176: Ships are circling in one place (#12181) 2024-03-02 21:45:54 +01:00
Jonathan G Rennison f180262aee
Fix #12154: Incorrect calendar day lengths with minutes per year setting (#12158) 2024-03-02 21:45:30 +01:00
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
2024-03-02 18:34:44 +00:00
Patric Stout 8f22066b9a
Fix #12147: reset all saved settings to their default before loading a game (#12210) 2024-03-02 16:05:43 +01:00
Rubidium aff09306de Fix #12076: Do not allow 'join' command on dedicated servers 2024-03-02 14:35:26 +01:00
Loïc Guilloux 253ba0d354
Fix #12195: Reset cursor when no Object is selected (#12207) 2024-03-02 13:02:56 +01:00
Loïc Guilloux b53d79b1d2
Codechange: Don't use NOT_REACHED() when catching unhandled thread exceptions (#12199) 2024-03-02 00:07:43 +01:00
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.
2024-03-01 22:08:18 +00:00
Tyler Trahan 3fd5c33ae6
Fix f6dd505: Only reset unbunching departure data in the correct depot (#12155) 2024-03-01 21:29:55 +00:00
Patric Stout 7824ae5b59 Fix #12196: disable "select upgrade" button when filtering 2024-03-01 22:17:33 +01:00
Patric Stout b307541099 Fix #12196: always show selected content, even when filtering 2024-03-01 22:17:33 +01:00
Tyler Trahan 890040ceea
Update: Developer credits (#12173) 2024-03-01 15:47:10 -05:00
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
2024-03-01 18:35:36 +00:00
Peter Nelson f0a891c4f7
Cleanup: Remove unused last_num_specs from SlRoadStopTileData. (#12198)
Inadvertently copy & pasted from another Sl handler.
2024-03-01 02:00:13 +00:00
translators c0b5510a94 Update: Translations from eints
portuguese (brazilian): 157 changes by pasantoro
polish: 5 changes by pAter-exe
2024-02-29 18:35:53 +00:00
translators c4f9479507 Update: Translations from eints
chinese (simplified): 19 changes by WenSimEHRP
ukrainian: 9 changes by StepanIvasyn
portuguese (brazilian): 43 changes by pasantoro
2024-02-28 18:35:37 +00:00
Loïc Guilloux fad77261ea
Fix f6dd505: Missing savegame conversion for current_order (#12188) 2024-02-27 21:25:49 +01:00
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.
2024-02-27 20:10:06 +00:00
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
2024-02-27 18:35:58 +00:00
Peter Nelson e93d081a4a
Codechange: Use range-for instead of indexed loop. (#12191) 2024-02-27 18:18:57 +00:00
Peter Nelson 59420d57ec
Codechange: Use vehicle tile hash to build depot vehicle list. (#12186)
This avoids iterating the entire vehicle pool.
2024-02-27 17:19:17 +00:00
Peter Nelson a61311fcb0 Codefix: DrawEngineList does not accept EngineID.
Replace min/max parameters of DrawEngineList with scrollbar reference, and use iterators instead of indices.
2024-02-27 17:18:53 +00:00
Peter Nelson bf865dc536 Codechange: Add `GetVisibleRangeIterators()` to `Scrollbar`. 2024-02-27 17:18:53 +00:00
Loïc Guilloux f612bc6ee2
Fix bf4b6696: [Script] Broken ScriptText circular reference detection (#12187) 2024-02-27 18:16:21 +01:00
Kuhnovic 2fb1593550
Fix e38c3c5: Added missing return statement (#12185) 2024-02-27 12:55:42 +01:00
Patric Stout e775ef2b70
Fix: initialize _switch_mode_time so crash-logs before first game have a realistic time (#12184) 2024-02-27 02:41:59 +01:00
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
2024-02-26 18:45:02 +00:00
Patric Stout e939f59cbb
Codechange: replace "byte" with "uint8_t" in settings (#12179) 2024-02-26 07:49:26 -05:00
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
2024-02-25 18:35:26 +00:00
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.
2024-02-25 12:38:07 +00:00
Peter Nelson 912d7bd80e Codechange: Give ColourShade values names instead of numbers. 2024-02-25 12:38:07 +00:00
Peter Nelson ae3390fe48 Codechange: Add ColourShade enum. 2024-02-25 12:38:07 +00:00
Peter Nelson 0463d4c198 Codechange: Remove direct access to _colour_gradient.
Access is now through GetColourGradient, which ensures parameters are in range.
2024-02-25 12:38:07 +00:00
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.
2024-02-25 12:36:13 +00:00
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.
2024-02-25 08:35:57 +00:00
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
2024-02-24 18:35:08 +00:00
Tyler Trahan 677ec70b0e
Fix fd9e72a: Helptext for timekeeping unit setting erroneously refers to vehicle movement (#12172) 2024-02-24 16:09:16 +00:00
Richard Wheeler c25d9f5c81
Fix: Make link graph node borders scale with GUI (#12167) 2024-02-23 19:04:34 -05:00
Jonathan G Rennison 222832f1d4
Fix #12166: Crash when opening tram road stop build window (#12168) 2024-02-23 15:02:59 -05:00
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
2024-02-23 18:35:31 +00:00
SamuXarick b22fb43cea
Fix #10490: Allow ships to exit depots if another is not moving at the exit point (#12161) 2024-02-23 08:08:16 -05:00
Peter Nelson 2b79e7cdf5
Fix b7630b0: Incorrect padding for text purchase list. (#12160)
Restore to original (and more normal) framerect padding.
2024-02-22 22:23:29 +00:00
frosch bb86023d50
Fix #12127, 555a379: Truncation ellipses rendered shadows even for black font without shadows (#12132) 2024-02-22 22:22:35 +00:00
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
2024-02-22 20:40:12 +01:00
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
2024-02-22 18:36:05 +00:00
Rubidium 5d2e6e4efa Fix #12148, fca8166: Do not draw decimals when number of digits is 0 2024-02-21 19:32:53 +01:00
Jonathan G Rennison ca146c8ddd Fix #12145: Incorrect date handling in date cheat in wallclock time-keeping mode 2024-02-21 18:43:05 +01:00
Jonathan G Rennison 409c073eca Codefix: Off by one in TimerGameEconomy::ConvertDateToYMD wallclock mode 2024-02-21 18:40:02 +01:00
merni-ns 7bab2c1cc3 Fix #12119: Remove red warning text when maximum loan is zero 2024-02-21 18:38:53 +01:00
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
2024-02-20 15:51:35 -05:00
merni-ns ad9080338c
Codefix: Correct coding style on fall through (#12140) 2024-02-20 15:50:08 -05:00
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
2024-02-20 18:35:58 +00:00
Loïc Guilloux 25d1238907
Fix #12133: [Script] Don't crash when emergency saving (#12138) 2024-02-20 18:55:18 +01:00
Loïc Guilloux 2d7ad9f717
Fix: [Script] Only show debug script window at the end of savegame loading (#12135) 2024-02-20 16:08:26 +00:00
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
2024-02-19 18:35:28 +00:00
Rubidium a4d4301a0c Codechange: We are heading to 15 2024-02-18 21:48:54 +01:00
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
2024-02-18 18:35:02 +00:00
Rubidium 15be383b93 Fix a253205: remove (now) unused currency separator 2024-02-18 16:56:52 +01:00
Tyler Trahan 4f1bc39bf7
Change: Show speed before destination in vehicle status bar (#11932) 2024-02-18 10:44:11 -05:00
Tyler Trahan 87a80c7ff2
Change: When adding orders, Ctrl+Click on a depot to unbunch, instead of service if required (#12023) 2024-02-18 10:43:44 -05:00
frosch 555a37930b
Fix: Shadows of individual character glyphs could be drawn over other characters (#12115) 2024-02-18 16:30:54 +01:00
Damian Laczak 49c3215751 Fix #10983: [AdminPort] Correct order of messages 2024-02-18 15:11:00 +01:00
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.
2024-02-18 12:20:11 +00:00
Koen Bussemaker 8a1cea2ab6 Codechange: Skip non-water water region patches in neigbor search 2024-02-18 11:46:34 +01:00
Rubidium 360fe8b0b6 Fix a253205: division by zero when attempting to format some short currencies 2024-02-17 22:45:48 +01:00
translators 03e3553230 Update: Translations from eints
estonian: 15 changes by RM87
portuguese (brazilian): 42 changes by pasantoro
polish: 30 changes by pAter-exe
2024-02-17 18:35:04 +00:00
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.
2024-02-17 18:29:21 +00:00
Rubidium 1aa9a5c0ab Update: Use proper number formats and abbreviations for Chinese, Japanese, Korean and German 2024-02-17 14:33:16 +01:00
Rubidium 59f56941e5 Update: Number format configuration based on old digitsep and STR_CURRENCY_SHORT_* values 2024-02-17 14:33:16 +01:00
Rubidium 7e2eefb91f Cleanup: Remove digit group separators from strgen and languages 2024-02-17 14:33:16 +01:00
Rubidium b741b2ba6f Feature: Fully user configurable number format and abbreviations 2024-02-17 14:33:16 +01:00
Rubidium 609d0071d5 Change: Remove saving of digit group and decimal separator configurations from the savegame 2024-02-17 14:33:16 +01:00
Rubidium e67fc33172 Codechange: Add support for NULL strings in SaveLoadCompat 2024-02-17 14:33:16 +01:00
Rubidium 9f8fd80112 Feature: Fully customisable number abbreviations per translation 2024-02-17 14:33:16 +01:00
Rubidium a253205b93 Feature: Fully customisable number format per translation 2024-02-17 14:33:16 +01:00
Rubidium 819c6c756e Codechange: Add support for number format and abbreviations pragmas/attributes to strgen 2024-02-17 14:33:16 +01:00
Rubidium fca8166087 Codechange: Simplify FormatNumber by moving out zero fill and decimal support 2024-02-17 14:33:16 +01:00
Rubidium a44bd81280 Codechange: Move determining the decimal separator to a separate function 2024-02-17 14:33:16 +01:00
Rubidium f0c50ad529 Codechange: Add function to get the power of ten for a given number 2024-02-17 14:33:16 +01:00
rubidium42 8bccb5805a
Fix 0ca4b4e: Ctrl+Click style inconsistency in base language (#12099) 2024-02-17 06:26:09 +00:00
translators bb2446c058 Update: Translations from eints
welsh: 5 changes by Ansbaradigeidfran
estonian: 108 changes by siimsoni, 50 changes by RM87
luxembourgish: 276 changes by phreeze83
hungarian: 81 changes by PstasDev
indonesian: 6 changes by tsaqibfs
italian: 191 changes by AlphaJack
bulgarian: 118 changes by lamarin1
ukrainian: 16 changes by StepanIvasyn
tamil: 408 changes by Aswn
turkish: 43 changes by metsysma
esperanto: 103 changes by JadedCtrl
portuguese (brazilian): 57 changes by pasantoro
polish: 61 changes by pAter-exe
2024-02-16 18:35:10 +00:00
Peter Nelson adb796a21a Change: Show 6 or 2 orientation buttons in NewGRF road stop picker as appropriate.
This replaces the normal method of masking unusable buttons.
2024-02-15 22:28:58 +00:00
Peter Nelson 8c22690ce1 Codechange: Update window's widget lookup map when switching displayed plane. 2024-02-15 22:28:58 +00:00
translators 3d591c2094 Update: Translations from eints
swedish: 1 change by SpamixOfficial
welsh: 280 changes by Ansbaradigeidfran
vietnamese: 245 changes by myquartz
estonian: 1 change by siimsoni
czech: 64 changes by LubosKolouch, 29 changes by adamek0202
arabic (egypt): 17 changes by AviationGamerX
luxembourgish: 247 changes by phreeze83
hungarian: 9 changes by nemesbala
indonesian: 21 changes by tsaqibfs, 19 changes by K4smun1
italian: 13 changes by AlphaJack
hebrew: 20 changes by Boltyansky
bulgarian: 107 changes by lamarin1
finnish: 4 changes by lanurmi
ukrainian: 18 changes by StepanIvasyn
catalan: 1 change by arnaullv
turkish: 120 changes by metsysma, 43 changes by EndChapter
danish: 23 changes by mamure, 23 changes by bscargo
dutch: 1 change by Jaws3rd
french: 1 change by Lishouuu
portuguese (brazilian): 362 changes by pasantoro
polish: 60 changes by pAter-exe
2024-02-15 18:34:46 +00:00
SamuXarick 8584d1b5bb
Add: [Script] GetAirportNumHelipads (#12085)
Adds a function for Scripts to get the number of helipads of an airport type.
2024-02-14 21:38:32 +01:00
Peter Nelson a64ca2e0c5
Cleanup: Remove declaration of non-existent function. (#12091) 2024-02-14 20:28:03 +00:00
Peter Nelson 4ffe1da540
Fix: NewGRF roadstops were ignored if only in default class. (#12089)
If a NewGRF defines roadstops in the default class and no other classes are defined, they would be ignored and not selectable.
2024-02-14 19:21:13 +00:00
translators ac5eaecd15 Update: Translations from eints
english (au): 1 change by krysclarke
english (us): 1 change by 2TallTyler
czech: 74 changes by adamek0202
chinese (simplified): 3 changes by WenSimEHRP
luxembourgish: 42 changes by phreeze83
korean: 1 change by telk5093
german: 1 change by Wuzzy2
romanian: 19 changes by ALEX11BR
russian: 1 change by Ln-Wolf
finnish: 6 changes by lanurmi
ukrainian: 13 changes by StepanIvasyn
turkish: 26 changes by metsysma
danish: 18 changes by bscargo
latvian: 3 changes by lexuslatvia
portuguese: 1 change by azulcosta
portuguese (brazilian): 273 changes by pasantoro
2024-02-14 18:37:05 +00:00
Peter Nelson 1e82d75fa2
Fix f1144de: "knots" missing from settings units list. (#12082)
Knots were added as a setting but not included in the settings list so were saved as a number instead of string.
2024-02-13 20:19:45 +00:00
translators 4cea9a61ce Update: Translations from eints
swedish: 132 changes by sereneavatar
spanish (mexican): 31 changes by absay
english (us): 2 changes by 2TallTyler
czech: 6 changes by Caesar008
arabic (egypt): 76 changes by AviationGamerX
turkish: 91 changes by metsysma
danish: 9 changes by mamure
portuguese: 9 changes by azulcosta
portuguese (brazilian): 253 changes by pasantoro
polish: 14 changes by pAter-exe
2024-02-13 18:37:22 +00:00
Tyler Trahan f5126cba08
Fix: Accurately describe Ctrl+Clicking on a waypoint in Go To tooltip (#12081) 2024-02-13 11:41:25 -05:00
Florian 02b59920ed
Fix #12050: Add default size, shade and pin control buttons to company livery widget. (#12080) 2024-02-13 15:55:13 +00:00
Peter Nelson 14b31c8fed
Add: Show cargo icons on subsidy list window. (#12079) 2024-02-13 07:41:24 +00:00
Patric Stout 15c14a896f
Fix: survey-time seconds for clients was calculated wrong (#12078) 2024-02-12 21:56:27 +00:00
Patric Stout bad31f2d42
Fix #10079: don't render at 1000fps if HW acceleration + vsync is requested but not active (#12067) 2024-02-12 21:39:23 +00:00
Loïc Guilloux 79374bc003
Fix #12074: Don't allow "part" command for dedicated servers (#12075) 2024-02-12 19:28:30 +00:00
translators a3e6f82150 Update: Translations from eints
english (au): 2 changes by krysclarke
swedish: 307 changes by sereneavatar
galician: 127 changes by pvillaverde
romanian: 165 changes by bnegrut
spanish: 8 changes by MontyMontana
portuguese: 89 changes by azulcosta
portuguese (brazilian): 335 changes by pasantoro
2024-02-12 18:35:10 +00:00
Patric Stout 839f2e025c
Fix: visually also disable vsync when not using HW acceleration (#12066) 2024-02-12 03:19:08 +01:00
Jonathan G Rennison 5ab5f4ace7
Codefix df691eb3: Reloading GRFs destructed small UFO targeting road vehicle (#12072) 2024-02-12 00:51:18 +00:00
Peter Nelson 481fa7dbb5
Change: Show cargo icons on Industry View window. (#12071) 2024-02-12 00:50:58 +00:00
Loïc Guilloux 3ffa176870
Change: [Script] Store randomizers in savegame (#12063) 2024-02-12 01:22:57 +01:00
Peter Nelson d6f34a21e8
Codefix: Incorrect storage type in cargo field of industry cargo chains window. (#12051)
`supp_cargoes` and `cust_cargoes` actually contains a column index, however this index is always stored at the indexed position...

Replace with a bitmask instead, which stores if the column indices are linked.
2024-02-11 23:05:29 +00:00
Peter Nelson df691eb31e
Codechange: Don't scan vehicle pool to find targeting disaster vehicle when deleting any vehicle. (#12064)
* Codechange: Don't scan vehicle pool to find targeting disaster vehicle when deleting any vehicle.

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

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

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

This was missed by #12053.
2024-02-11 17:42:04 +00:00
Patric Stout d02b1547f6
Remove: setting "no_http_content_downloads" (#12058)
As we now use HTTPS, it is very likely this will work on most systems.
For systems that do have HTTPS blocked, it will fail instantly,
and it will fallback to TCP anyway. That makes this setting no longer
very useful.
2024-02-11 14:48:12 +00:00
Peter Nelson 8db08da148
Fix #12052: NewGRFs clearing industry cargo slots could fallback to default instead of empty. (#12053)
Ensure the default label is cleared when NewGRF sets a produced/accepted cargo slot, so that default fallback isn't used.
2024-02-11 00:43:13 +00:00
Tyler Trahan 7b32d9cff5 Fix #12019: Correctly highlight depot unbunch action in dropdown 2024-02-10 15:11:24 -05:00
Tyler Trahan 771615cb4b Fix #12020: Unbunch and service if needed should be mutually exclusive depot order types 2024-02-10 15:11:24 -05:00
Patric Stout 84e6c7aef3
Doc: Update documentation how to make commit message (#12046)
By writing more in the style we need for the changelog,
we avoid requiring lots of work when making a changelog.
2024-02-10 21:01:34 +01:00
translators 2f35a484fe Update: Translations from eints
swedish: 1 change by SpamixOfficial
english (us): 7 changes by 2TallTyler
galician: 123 changes by pvillaverde
estonian: 5 changes by RM87
czech: 46 changes by justidan4
romanian: 19 changes by ALEX11BR
russian: 13 changes by gisterecis
finnish: 6 changes by rikkerton
catalan: 188 changes by J0anJosep
turkish: 29 changes by densxd
latvian: 7 changes by lexuslatvia
portuguese: 33 changes by azulcosta
portuguese (brazilian): 546 changes by pasantoro
polish: 24 changes by pAter-exe
2024-02-10 18:35:13 +00:00
Loïc Guilloux b84b68e959
Codechange: Rework regression output filtering (#12049) 2024-02-10 14:16:24 +01:00
Loïc Guilloux 977aba73be
Change: Store running AI config inside Company (#12003) 2024-02-09 22:55:49 +01:00
Peter Nelson 466e6bb524
Fix #12037: Blurry OpenTTD font on Mac OS. (#12047) 2024-02-09 21:36:13 +01:00
Patric Stout 48e7dceb3c
Revert: Build signals to the next junction when dragging regardless of the Ctrl state (#12034)
This reverts commit b370ae1212.
2024-02-09 19:34:03 +01:00
Jonathan G Rennison bed3ef6f6b
Cleanup: Incorrect savegame number for SLV_DEPOT_UNBUNCHING constant (#12045) 2024-02-09 17:50:29 +00:00
Kuhnovic e38c3c59f3
Fix #11840: Ship pathfinder always returns a valid trackdir if one is available (#12031) 2024-02-09 12:31:38 -05:00
Loïc Guilloux b68d263d5f
Fix #12014: Remove water when area clearing ship depot (#12030) 2024-02-09 18:17:08 +01:00
Tyler Trahan 10bcf0172e
Fix #12022: Adjust economy date when changing timekeeping units in Scenario Editor (#12042) 2024-02-09 11:45:32 -05:00
Loïc Guilloux 165f92c00b
Fix #12041, 0c81579: Tarball extraction failing due to incorrect filename (#12044) 2024-02-09 17:25:56 +01:00
translators 9b323b4ef9 Update: Translations from eints
english (au): 7 changes by krysclarke
galician: 1 change by pvillaverde
chinese (simplified): 3 changes by WenSimEHRP
italian: 29 changes by Giredson
german: 53 changes by MagnumSociety
ukrainian: 37 changes by StepanIvasyn
dutch: 7 changes by rcpaul
spanish: 144 changes by MontyMontana
french: 4 changes by Lishouuu
portuguese: 48 changes by azulcosta
portuguese (brazilian): 156 changes by pasantoro
polish: 22 changes by azabost, 6 changes by pAter-exe
2024-02-08 18:34:34 +00:00
Tyler Trahan 16e6da020d
Cleanup: Remove unnecessary Trackdir casts (#12038) 2024-02-08 09:46:55 -05:00
Loïc Guilloux 82470f5c0d
Codechange 80ebcc7: OptionMenuEntries prefix is OME not ONE (#12036) 2024-02-08 00:22:01 +00:00
Patric Stout 11f5ac72a9
Fix #12029: don't show Sandbox Options in multiplayer (#12032) 2024-02-08 00:33:24 +01:00
Heikki Piirainen 42a88fc1d6
Fix: Finnish thousands separator (#12028)
In Finnish, the recommended digit group separator is a space rather than a dot.
2024-02-07 13:35:56 -05:00
translators d2a4f3123d Update: Translations from eints
galician: 25 changes by pvillaverde
czech: 182 changes by justidan4
hungarian: 31 changes by titanicbobo, 13 changes by Norodix
indonesian: 27 changes by tsaqibfs
german: 58 changes by UnsuspiciousGooball
russian: 18 changes by Ln-Wolf
finnish: 6 changes by hpiirai, 5 changes by lanurmi
ukrainian: 39 changes by StepanIvasyn
turkish: 3 changes by metsysma
danish: 55 changes by mamure, 6 changes by bscargo
dutch: 111 changes by Afoklala, 2 changes by robert5800
spanish: 196 changes by MontyMontana
portuguese: 4 changes by azulcosta
portuguese (brazilian): 148 changes by pasantoro
polish: 42 changes by pAter-exe, 16 changes by azabost
2024-02-07 18:34:54 +00:00
Peter Nelson 2c78146da5 Change: Limit cargo types in station cargo filter, with "More..." option to show all. 2024-02-07 17:13:37 +00:00
Peter Nelson e517e55620 Change: Include count of stations per cargo type in station cargo filter.
Cargo types with no stations are shaded to make the list clearer.
2024-02-07 17:13:37 +00:00
Peter Nelson 46da56b191 Change: Replace long list of cargo filter buttons with a multi-select dropdown list.
As before, hold ctrl while clicking on an item to toggle selections.
2024-02-07 17:13:37 +00:00
Peter Nelson 0ce30d05c8 Codechange: Add method to replace the content of a dropdown menu.
If necessary the dropdown list window will be resized and scrollbar enabled/disabled.
2024-02-07 17:13:37 +00:00
Peter Nelson ac44c001a4 Codechange: Expose `FindChildWindow()` as a method of `Window`. 2024-02-07 17:13:37 +00:00
Peter Nelson 4c44e1eae0 Codechange: Add parameter to persist dropdown menus.
If a dropdown menu is set to persist, it will not close when an item is selected. It will close as normal if the window loses focus.

Closing the list is the responsibility of the caller.
2024-02-07 17:13:37 +00:00
Peter Nelson b1c5e03df1
Fix: Don't issue autoreplace failed news message for command test mode. (#12026) 2024-02-07 12:07:00 +00:00
Peter Nelson 1f8533ebe0
Fix #12024: Autoreplace failed news message for trains must go to lead engine. (#12025) 2024-02-07 08:51:03 +00:00
847 changed files with 35714 additions and 28577 deletions

View File

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

View File

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

View File

@ -1,4 +1,4 @@
name: CI
name: CI - Build
on:
pull_request:
@ -17,79 +17,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
uses: actions/checkout@v4
- 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::"
uses: ./.github/workflows/ci-emscripten.yml
secrets: inherit
linux:
strategy:
fail-fast: false
matrix:
include:
- name: Clang - Debug
- name: Clang
compiler: clang-15
cxxcompiler: clang++-15
libraries: libsdl2-dev
- name: Clang - Release
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++
@ -99,317 +42,57 @@ jobs:
name: Linux (${{ matrix.name }})
runs-on: ubuntu-latest
env:
CC: ${{ matrix.compiler }}
CXX: ${{ matrix.cxxcompiler }}
uses: ./.github/workflows/ci-linux.yml
secrets: inherit
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 \
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 .. -DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake ${{ matrix.extra-cmake-parameters }}
echo "::endgroup::"
echo "::group::Build"
echo "Running on $(nproc) cores"
cmake --build . -j $(nproc)
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: 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
name: Mac OS (${{ matrix.arch }})
name: Mac OS (${{ matrix.name }})
runs-on: macos-latest
env:
MACOSX_DEPLOYMENT_TARGET: 10.13
uses: ./.github/workflows/ci-macos.yml
secrets: inherit
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
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::"
echo "::group::Build"
echo "Running on $(sysctl -n hw.logicalcpu) cores"
cmake --build . -j $(sysctl -n hw.logicalcpu)
echo "::endgroup::"
- 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
uses: actions/checkout@v4
- 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
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=${{ matrix.arch }}-windows-static \
-DCMAKE_TOOLCHAIN_FILE="c:\vcpkg\scripts\buildsystems\vcpkg.cmake" \
# EOF
echo "::endgroup::"
echo "::group::Build"
cmake --build .
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
- os: windows-latest
arch: x86
- os: windows-latest
arch: x64
name: MinGW (${{ matrix.arch }})
name: Windows (${{ matrix.arch }})
runs-on: windows-latest
uses: ./.github/workflows/ci-windows.yml
secrets: inherit
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
mingw-w64-${{ matrix.arch }}-lld
mingw-w64-${{ matrix.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" \
# EOF
echo "::endgroup::"
echo "::group::Build"
cmake --build .
echo "::endgroup::"
- name: Test
shell: msys2 {0}
run: |
cd build
ctest --timeout 120
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
check_annotations:
name: Check Annotations
@ -418,7 +101,6 @@ jobs:
- linux
- macos
- windows
- msys2
if: always() && github.event_name == 'pull_request'

61
.github/workflows/ci-emscripten.yml vendored Normal file
View File

@ -0,0 +1,61 @@
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.57
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup cache
uses: actions/cache@v4
with:
path: /emsdk/upstream/emscripten/cache
key: 3.1.57-${{ runner.os }}
- name: Add liblzma support
run: |
cp ${GITHUB_WORKSPACE}/os/emscripten/ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/
- 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::"

123
.github/workflows/ci-linux.yml vendored Normal file
View File

@ -0,0 +1,123 @@
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
uses: actions/checkout@v4
- 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 \
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)
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

90
.github/workflows/ci-macos.yml vendored Normal file
View File

@ -0,0 +1,90 @@
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
uses: actions/checkout@v4
- 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)
echo "::endgroup::"
- name: Test
run: |
cd build
ctest -j $(sysctl -n hw.logicalcpu) --timeout 120

83
.github/workflows/ci-mingw.yml vendored Normal file
View File

@ -0,0 +1,83 @@
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
uses: actions/checkout@v4
- 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" \
# EOF
echo "::endgroup::"
echo "::group::Build"
cmake --build .
echo "::endgroup::"
- name: Test
shell: msys2 {0}
run: |
cd build
ctest --timeout 120

82
.github/workflows/ci-nightly.yml vendored Normal file
View File

@ -0,0 +1,82 @@
name: CI - Nightly
on:
schedule:
- cron: '0 3 * * *'
workflow_dispatch:
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

87
.github/workflows/ci-windows.yml vendored Normal file
View File

@ -0,0 +1,87 @@
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
uses: actions/checkout@v4
- 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 .
echo "::endgroup::"
- name: Test
shell: bash
run: |
cd build
ctest --timeout 120

View File

@ -26,6 +26,19 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- 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"
@ -44,13 +57,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
@ -58,8 +86,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

View File

@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
container:
# If you change this version, change the number in the cache step too.
image: emscripten/emsdk:3.1.42
image: emscripten/emsdk:3.1.57
steps:
- name: Checkout
@ -38,12 +38,11 @@ jobs:
uses: actions/cache@v4
with:
path: /emsdk/upstream/emscripten/cache
key: 3.1.42-${{ runner.os }}
key: 3.1.57-${{ runner.os }}
- name: Patch Emscripten to support LZMA
- name: Add liblzma support
run: |
cd /emsdk/upstream/emscripten
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
cp ${GITHUB_WORKSPACE}/os/emscripten/ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/
- name: Build (host tools)
run: |

View File

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

View File

@ -124,7 +124,7 @@ jobs:
)
echo "::group::Install breakpad dependencies"
cargo install dump_syms
cargo install --locked dump_syms
echo "::endgroup::"
- name: Install GCC problem matcher

View File

@ -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
@ -52,7 +62,7 @@ jobs:
echo "::endgroup::"
echo "::group::Install breakpad dependencies"
cargo install dump_syms
cargo install --locked dump_syms
echo "::endgroup::"
- name: Install GCC problem matcher
@ -94,7 +104,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=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
@ -115,7 +125,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=RelWithDebInfo \
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \

View File

@ -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: |
@ -61,7 +66,7 @@ jobs:
echo "::endgroup::"
echo "::group::Install breakpad dependencies"
cargo install dump_syms
cargo install --locked dump_syms
echo "::endgroup::"
- name: Install MSVC problem matcher
@ -95,21 +100,6 @@ jobs:
with:
arch: ${{ matrix.host }}
- name: Import code signing certificate
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
@ -121,12 +111,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::"
@ -134,7 +123,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'
@ -147,11 +141,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::"
@ -159,7 +152,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 breakpad symbols
shell: bash
@ -193,13 +191,15 @@ jobs:
- name: Sign installer
if: 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

View File

@ -5,7 +5,7 @@ if(NOT BINARY_NAME)
endif()
project(${BINARY_NAME}
VERSION 14.0
VERSION 15.0
LANGUAGES CXX
)
@ -343,7 +343,7 @@ if(NOT OPTION_DEDICATED)
endif()
endif()
include(CheckAtomic)
include(3rdparty/llvm/CheckAtomic)
if(APPLE)
link_package(Iconv TARGET Iconv::Iconv)

View File

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

View File

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

View File

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

View File

@ -3,6 +3,8 @@
# 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/>.
# Doxyfile 1.9.4
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
@ -13,6 +15,7 @@ PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ${CPACK_BINARY_DIR}/docs/source/
CREATE_SUBDIRS = YES
CREATE_SUBDIRS_LEVEL = 8
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
@ -35,8 +38,10 @@ STRIP_FROM_PATH = ./
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
JAVADOC_BANNER = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
PYTHON_DOCSTRING = YES
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 2
@ -45,6 +50,7 @@ OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
OPTIMIZE_OUTPUT_SLICE = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 0
@ -60,16 +66,19 @@ INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
EXTRACT_ALL = NO
EXTRACT_PRIVATE = YES
EXTRACT_PRIV_VIRTUAL = NO
EXTRACT_PACKAGE = NO
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = YES
RESOLVE_UNNAMED_PARAMS = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
@ -78,6 +87,7 @@ INTERNAL_DOCS = NO
CASE_SENSE_NAMES = YES
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_HEADERFILE = YES
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
@ -107,9 +117,11 @@ QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_IF_INCOMPLETE_DOC = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LINE_FORMAT = "at line $line of file $file"
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
@ -150,6 +162,10 @@ REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
CLANG_ASSISTED_PARSING = NO
CLANG_ADD_INC_PATHS = YES
CLANG_OPTIONS =
CLANG_DATABASE_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@ -175,6 +191,7 @@ HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_FEEDURL =
DOCSET_BUNDLE_ID = org.doxygen.Project
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
DOCSET_PUBLISHER_NAME = Publisher
@ -197,12 +214,17 @@ GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = org.doxygen.Project
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
FULL_SIDEBAR = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
OBFUSCATE_EMAILS = YES
HTML_FORMULA_FORMAT = png
FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
FORMULA_MACROFILE =
USE_MATHJAX = NO
MATHJAX_VERSION = MathJax_2
MATHJAX_FORMAT = HTML-CSS
MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/
MATHJAX_EXTENSIONS =
@ -221,6 +243,7 @@ GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
LATEX_MAKEINDEX_CMD = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4
EXTRA_PACKAGES =
@ -232,9 +255,9 @@ PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = NO
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@ -244,7 +267,6 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
@ -259,12 +281,12 @@ MAN_LINKS = NO
GENERATE_XML = NO
XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
@ -311,7 +333,6 @@ EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
@ -324,6 +345,8 @@ COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
UML_LOOK = NO
UML_LIMIT_NUM_FIELDS = 10
DOT_UML_DETAILS = NO
DOT_WRAP_THRESHOLD = 17
TEMPLATE_RELATIONS = NO
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = YES
@ -331,6 +354,7 @@ CALL_GRAPH = NO
CALLER_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DIR_GRAPH_MAX_DEPTH = 1
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =

View File

@ -212,6 +212,9 @@ See `src/3rdparty/monocypher/LICENSE.md` for the complete license text.
The OpenTTD Social Integration API in `src/3rdparty/openttd_social_integration_api` is licensed under the MIT license.
See `src/3rdparty/openttd_social_integration_api/LICENSE` for the complete license text.
The atomic datatype support detection in `cmake/3rdparty/llvm/CheckAtomic.cmake` is licensed under the Apache 2.0 license.
See `cmake/3rdparty/llvm/LICENSE.txt` for the complete license text.
## 4.0 Credits
See [CREDITS.md](./CREDITS.md)

View File

@ -15,6 +15,7 @@ set(AI_COMPAT_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
${CMAKE_CURRENT_SOURCE_DIR}/compat_13.nut
${CMAKE_CURRENT_SOURCE_DIR}/compat_14.nut
${CMAKE_CURRENT_SOURCE_DIR}/compat_15.nut
)
foreach(AI_COMPAT_SOURCE_FILE IN LISTS AI_COMPAT_SOURCE_FILES)

View File

@ -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.");

View File

@ -4,26 +4,3 @@
* 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/>.
*/
/** @file script_timemode.cpp Implementation of ScriptTimeMode. */
#include "../../stdafx.h"
#include "script_timemode.hpp"
#include "../../safeguards.h"
ScriptTimeMode::ScriptTimeMode(bool calendar)
{
this->last_time_mode = ScriptObject::IsCalendarTimeMode();
ScriptObject::SetTimeMode(calendar);
}
ScriptTimeMode::~ScriptTimeMode()
{
ScriptObject::SetTimeMode(this->last_time_mode);
}
/* static */ bool ScriptTimeMode::IsCalendarMode()
{
return ScriptObject::IsCalendarTimeMode();
}

View File

@ -12,6 +12,7 @@ set(GS_COMPAT_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/compat_12.nut
${CMAKE_CURRENT_SOURCE_DIR}/compat_13.nut
${CMAKE_CURRENT_SOURCE_DIR}/compat_14.nut
${CMAKE_CURRENT_SOURCE_DIR}/compat_15.nut
)
foreach(GS_COMPAT_SOURCE_FILE IN LISTS GS_COMPAT_SOURCE_FILES)

View File

@ -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.");

6
bin/game/compat_15.nut Normal file
View File

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

View File

@ -1,3 +1,11 @@
#
# This was originally part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See (https://llvm.org/)LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Modifications have been made to suit building OpenTTD.
#
# atomic builtins are required for threading support.
INCLUDE(CheckCXXSourceCompiles)
@ -48,6 +56,8 @@ else()
check_working_cxx_atomics(HAVE_CXX_ATOMICS_WITHOUT_LIB)
# If not, check if the library exists, and atomics work with it.
if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB)
# check_library_exists requires the C-compiler as the atomic functions are built-in declared.
enable_language(C)
check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC)
if(HAVE_LIBATOMIC)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")
@ -69,6 +79,8 @@ else()
check_working_cxx_atomics64(HAVE_CXX_ATOMICS64_WITHOUT_LIB)
# If not, check if the library exists, and atomics work with it.
if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
# check_library_exists requires the C-compiler as the atomic functions are built-in declared.
enable_language(C)
check_library_exists(atomic __atomic_load_8 "" HAVE_CXX_LIBATOMICS64)
if(HAVE_CXX_LIBATOMICS64)
list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic")

279
cmake/3rdparty/llvm/LICENSE.txt vendored Normal file
View File

@ -0,0 +1,279 @@
==============================================================================
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
==============================================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
==============================================================================
Software from third parties included in the LLVM Project:
==============================================================================
The LLVM Project contains third party software which is under different license
terms. All such code will be identified clearly using at least one of two
mechanisms:
1) It will be in a separate directory tree with its own `LICENSE.txt` or
`LICENSE` file at the top containing the specific license and restrictions
which apply to that software, or
2) It will contain specific license and restriction terms at the top of every
file.
==============================================================================
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
LLVM Team
University of Illinois at Urbana-Champaign
http://llvm.org
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal with
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimers.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimers in the
documentation and/or other materials provided with the distribution.
* Neither the names of the LLVM Team, University of Illinois at
Urbana-Champaign, nor the names of its contributors may be used to
endorse or promote products derived from this Software without specific
prior written permission.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.

View File

@ -74,12 +74,6 @@ macro(compile_flags)
# We use 'ABCD' multichar for SaveLoad chunks identifiers
-Wno-multichar
# Compilers complains about that we break strict-aliasing.
# On most places we don't see how to fix it, and it doesn't
# break anything. So disable strict-aliasing to make the
# compiler all happy.
-fno-strict-aliasing
)
# Ninja processes the output so the output from the compiler

View File

@ -172,10 +172,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)

View File

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

View File

@ -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} show -s --pretty=format:%ci HEAD
set(ENV{TZ} "UTC0")
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --date=iso-local --pretty=format:%cd HEAD
OUTPUT_VARIABLE COMMITDATE
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}

View File

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

View File

@ -63,11 +63,10 @@ string(REGEX REPLACE "\\\[[0-9-]+ [0-9:]+\\\] " "" REGRESSION_RESULT "${REGRESSI
string(REGEX REPLACE "\\\[script:[0-9]\\\]" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Convert the output to a format that is expected (and more readable) by result.txt
string(REPLACE "\ndbg: " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\n " "\nERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\nERROR: [1] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\n[P] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "\n[S] " "\n" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "dbg: " "ERROR: " REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "ERROR: [1] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "[P] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REPLACE "[S] " "" REGRESSION_RESULT "${REGRESSION_RESULT}")
string(REGEX REPLACE "dbg: ([^\n]*)\n?" "" REGRESSION_RESULT "${REGRESSION_RESULT}")
# Remove duplicate script info

View File

@ -195,10 +195,11 @@ Last updated: 2014-02-23
'src/network/network_func.h'.
(DEBUG_FAILED_DUMP_COMMANDS is explained later)
- Put the 'commands-out.log' into the root save folder, and rename
it to 'commands.log'.
- Run 'openttd -D -d desync=3 -g startsavegame.sav'.
This replays the server log and creates new 'commands-out.log'
and 'dmp_cmds_*.sav' in your autosave folder.
it to 'commands.log'. Strip everything and including the "newgame"
entry from the log.
- Run 'openttd -D -d desync=0 -g startsavegame.sav'.
This replays the server log. Use "-d desync=3" to also create a
new 'commands-out.log' and 'dmp_cmds_*.sav' in your autosave folder.
## 3.2) Evaluation of the replay
@ -226,7 +227,7 @@ Last updated: 2014-02-23
savegames with your own ones from the replay. You can also comment/disable
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
the replay after the mismatch has already been detected.
See Section 3.2 on how to compare savegames.
See Section 3.3 on how to compare savegames.
If the saves differ you have located the Desync between the last dmp_cmds
that match and the first one that does not. The difference of the saves
may point you in the direction of what causes it.
@ -252,16 +253,14 @@ Last updated: 2014-02-23
are replayed. Their internal state will thus not change in the
replay and will differ.
To compare savegame more semantically, there exist some ugly hackish
tools at:
http://devs.openttd.org/~frosch/texts/zpipe.c
http://devs.openttd.org/~frosch/texts/printhunk.c
To compare savegame more semantically, easiest is to first export them
to a JSON format with for example:
The first one decompresses OpenTTD savegames. The second one creates
a textual representation of an uncompressed savegame, by parsing hunks
and arrays and such. With both tools you need to be a bit careful
since they work on stdin and stdout, which may not deal well with
binary data.
https://github.com/TrueBrain/OpenTTD-savegame-reader
If you have the textual representation of the savegames, you can
compare them with regular diff tools.
By running:
python -m savegame_reader --export-json dmp_cmds_NNN.sav | jq . > NNN.json
Now you can use any (JSON) diff tool to compare the two savegames in a
somewhat human readable way.

View File

@ -20,7 +20,6 @@
.Op Fl M Ar musicset
.Op Fl n Ar host Ns Oo : Ns Ar port Oc Ns Op # Ns Ar company
.Op Fl p Ar password
.Op Fl P Ar password
.Op Fl q Ar savegame
.Op Fl r Ar width Ns x Ns Ar height
.Op Fl s Ar driver
@ -100,10 +99,6 @@ play as.
Password used to join server.
Only useful with
.Fl n .
.It Fl P Ar password
Password used to join company.
Only useful with
.Fl n .
.It Fl q Ar savegame
Write some information about the specified savegame and exit.
.It Fl Q

View File

@ -7,15 +7,17 @@ This guide is for OpenTTD developers/maintainers, to release a new version of Op
* If this is a beta version release, skip this step.
* If this is an RC1 (first Release Candidate) build, create a new branch `release/nn` where `nn` is the major version number, then apply changes similar to [PR#9573](https://github.com/OpenTTD/OpenTTD/pull/9573). You also need to forwardport the changelog, as in [PR#10113](https://github.com/OpenTTD/OpenTTD/pull/10113).
* Update CMakeLists.txt
* Add a new (empty) AI compatibility script in bin/ai/
* Add the new version to CheckAPIVersion in src/ai/ai_info.cpp + src/game/game_info.cpp
* Add the new version to src/script/api/ai_changelog.hpp + src/script/api/game_changelog.hpp
* Update the version of regression in bin/ai/regression/regression_info.nut
* Add a note to src/saveload/saveload.h about which savegame version is used in the branch.
* Update the version in `CMakeLists.txt` in the master branch, heading for the next major release, e.g. from 14.0 to 15.0.
* Add a new (empty) AI compatibility script in `bin/ai/`
* Add the new version to CheckAPIVersion in `src/ai/ai_info.cpp` and `src/game/game_info.cpp`
* Add the new version to `src/script/api/ai_changelog.hpp` and `src/script/api/game_changelog.hpp`
* Update the version of regression in `bin/ai/regression/regression_info.nut`
* Add a note to `src/saveload/saveload.h` about which savegame version is used in the branch.
* If this is a later RC or release build and the release branch already exists, you'll need to backport fixes and language from master to this branch, which were merged after the branch diverged from master. You can use these two helper scripts: https://github.com/OpenTTD/scripts/tree/main/backport
* If this is a maintenance release, update the version in `CMakeLists.txt` in the release branch, e.g. from 14.0 to 14.1.
## Step 1: Prepare changelog documentation
1. Update the [changelog](../changelog.txt) with new changes since the last release.
@ -29,20 +31,26 @@ This guide is for OpenTTD developers/maintainers, to release a new version of Op
1. Go to https://github.com/OpenTTD/website/new/main/_posts and write a new announcement post. See a [previous example](https://github.com/OpenTTD/website/pull/238) for a template.
2. Create a new branch for this post and open a PR for it.
3. Write announcement text for socials like Forum/Discord/Twitter/Reddit and include it in the PR.
3. Write announcement text for the store pages and socials like TT-Forums / Discord / Twitter / Reddit / Fosstodon / etc., and include it in the PR.
4. Create a Steam news image for that post and include it in the PR.
5. Check the website post (preview link via checks page) and make corrections. We usually just use the GitHub web interface for this and squash the result later.
5. Check the website post ("View Deployment" link) and make corrections. We usually just use the GitHub web interface for this and squash the result later.
6. Get this PR approved, but do not merge yet.
## Step 3: Make the actual OpenTTD release
1. Go to https://github.com/OpenTTD/OpenTTD/releases/new and create a new tag matching the release number. For the body of the release, see any older release. "Set as a pre-release" for a beta or RC, set as latest for a real release.
2. Merge website PR.
3. Wait for the OpenTTD release checks to be complete.
4. Check that website links to the new release are working and correct, using the [staging website](https://www-staging.openttd.org/).
5. If this is a full release, ask orudge to update the Microsoft Store and TrueBrain to move the release from the "testing" to "default" branch on Steam.
1. Confirm that the version in `CMakeLists.txt` matches the intended release version.
2. Go to https://github.com/OpenTTD/OpenTTD/releases/new and create a new tag matching the release number. For the body of the release, copy in the changelog. "Set as a pre-release" for a beta or RC.
3. Wait for the OpenTTD release workflow to be complete.
4. If this is a full release:
* for `Steam`: under Steamworks -> SteamPipe -> Builds, set the "testing" branch live on the "default" branch. This will request 2FA validation.
* for `GOG`: under Builds, "Publish" the freshly uploaded builds to `Master`, `GOG-use only` and `Testing`.
* for `Microsoft Store`: ask orudge to publish the new release.
Access to `Steam`, `GOG` and/or `Microsoft Store` requires a developer account on that platform.
You will need access to the shared keystore in order to create such an account.
For help and/or access to either or both, please contact TrueBrain.
## Step 4: Tell the world
1. Tag and create a website release to trigger the actions that update the website.
2. After the website is live, make announcements on social media. You may need to coordinate with other developers who can make posts on Twitter, Reddit, Steam, and GOG.
1. Merge the website PR. This will publish the release post.
2. Make announcements on social media and store pages. You may need to coordinate with other developers who can make posts on TT-Forums, Twitter, Reddit, Fosstodon, Discord, Steam, GOG, Microsoft Store, etc.

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

@ -1,4 +1,3 @@
FROM emscripten/emsdk:3.1.42
FROM emscripten/emsdk:3.1.57
COPY emsdk-liblzma.patch /
RUN cd /emsdk/upstream/emscripten && patch -p1 < /emsdk-liblzma.patch
COPY ports/liblzma.py /emsdk/upstream/emscripten/tools/ports/contrib/liblzma.py

View File

@ -2,8 +2,8 @@
Please use docker with the supplied `Dockerfile` to build for emscripten.
It takes care of a few things:
- Use a version of emscripten we know works
- Patch in LibLZMA support (as this is not supported by upstream)
- Use a version of emscripten we know works.
- Add LibLZMA library under contrib ports.
First, build the docker image by navigating in the folder this `README.md` is in, and executing:
```

View File

@ -1,7 +1,7 @@
# LibLZMA is a custom addition to the emscripten SDK, so it is possible
# someone patched their SDK. Test out if the SDK supports LibLZMA.
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_FLAGS "-sUSE_LIBLZMA=1")
set(CMAKE_REQUIRED_FLAGS "--use-port=contrib.liblzma")
check_cxx_source_compiles("
#include <lzma.h>
@ -12,9 +12,9 @@ check_cxx_source_compiles("
if (LIBLZMA_FOUND)
add_library(LibLZMA::LibLZMA INTERFACE IMPORTED)
set_target_properties(LibLZMA::LibLZMA PROPERTIES
INTERFACE_COMPILE_OPTIONS "-sUSE_LIBLZMA=1"
INTERFACE_LINK_LIBRARIES "-sUSE_LIBLZMA=1"
INTERFACE_COMPILE_OPTIONS "--use-port=contrib.liblzma"
INTERFACE_LINK_LIBRARIES "--use-port=contrib.liblzma"
)
else()
message(WARNING "You are using an emscripten SDK without LibLZMA support. Many savegames won't be able to load in OpenTTD. Please apply 'emsdk-liblzma.patch' to your local emsdk installation.")
message(WARNING "You are using an emscripten SDK without LibLZMA support. Many savegames won't be able to load in OpenTTD. Please copy liblzma.py to your ports/contrib folder in your local emsdk installation.")
endif()

View File

@ -1,198 +0,0 @@
From 84d0e9112d5c87a714abd21ec8547921f46f37b5 Mon Sep 17 00:00:00 2001
From: milek7 <me@milek7.pl>
Date: Tue, 8 Dec 2020 01:03:31 +0100
Subject: [PATCH] Add liblzma port
---
src/settings.js | 4 ++
tools/ports/liblzma.py | 151 +++++++++++++++++++++++++++++++++++++++++
tools/settings.py | 1 +
3 files changed, 156 insertions(+)
create mode 100644 tools/ports/liblzma.py
diff --git a/src/settings.js b/src/settings.js
index f93140d..7b6bec9 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -1451,6 +1451,10 @@ var USE_GIFLIB = false;
// [compile+link]
var USE_LIBJPEG = false;
+// 1 = use liblzma from emscripten-ports
+// [compile+link]
+var USE_LIBLZMA = false;
+
// 1 = use libpng from emscripten-ports
// [compile+link]
var USE_LIBPNG = false;
diff --git a/tools/ports/liblzma.py b/tools/ports/liblzma.py
new file mode 100644
index 0000000..6872a8b
--- /dev/null
+++ b/tools/ports/liblzma.py
@@ -0,0 +1,151 @@
+# Copyright 2020 The Emscripten Authors. All rights reserved.
+# Emscripten is available under two separate licenses, the MIT license and the
+# University of Illinois/NCSA Open Source License. Both these licenses can be
+# found in the LICENSE file.
+
+import os
+import shutil
+import logging
+from pathlib import Path
+
+VERSION = '5.4.2'
+HASH = '149f980338bea3d66de1ff5994b2b236ae1773135eda68b62b009df0c9dcdf5467f8cb2c06da95a71b6556d60bd3d21f475feced34d5dfdb80ee95416a2f9737'
+
+
+def needed(settings):
+ return settings.USE_LIBLZMA
+
+
+def get(ports, settings, shared):
+ ports.fetch_project('liblzma', f'https://tukaani.org/xz/xz-{VERSION}.tar.gz', sha512hash=HASH)
+
+ def create(final):
+ logging.info('building port: liblzma')
+
+ ports.clear_project_build('liblzma')
+
+ source_path = os.path.join(ports.get_dir(), 'liblzma', f'xz-{VERSION}', 'src', 'liblzma')
+ ports.write_file(os.path.join(source_path, 'config.h'), config_h)
+ ports.install_headers(os.path.join(source_path, 'api'), pattern='lzma.h')
+ ports.install_headers(os.path.join(source_path, 'api', 'lzma'), pattern='*.h', target='lzma')
+
+ build_flags = ['-DHAVE_CONFIG_H', '-DTUKLIB_SYMBOL_PREFIX=lzma_', '-fvisibility=hidden']
+ exclude_files = ['crc32_small.c', 'crc64_small.c', 'crc32_tablegen.c', 'crc64_tablegen.c', 'price_tablegen.c', 'fastpos_tablegen.c',
+ 'tuklib_exit.c', 'tuklib_mbstr_fw.c', 'tuklib_mbstr_width.c', 'tuklib_open_stdxxx.c', 'tuklib_progname.c']
+ include_dirs_rel = ['../common', 'api', 'check', 'common', 'delta', 'lz', 'lzma', 'rangecoder', 'simple']
+
+ include_dirs = [os.path.join(source_path, p) for p in include_dirs_rel]
+ ports.build_port(source_path, final, 'liblzma', flags=build_flags, exclude_files=exclude_files, includes=include_dirs)
+
+ return [shared.cache.get_lib('liblzma.a', create, what='port')]
+
+
+def clear(ports, settings, shared):
+ shared.cache.erase_lib('liblzma.a')
+
+
+def process_args(ports):
+ return []
+
+
+def show():
+ return 'liblzma (USE_LIBLZMA=1; public domain)'
+
+
+config_h = '''
+#define ASSUME_RAM 128
+#define ENABLE_NLS 1
+#define HAVE_CHECK_CRC32 1
+#define HAVE_CHECK_CRC64 1
+#define HAVE_CHECK_SHA256 1
+#define HAVE_CLOCK_GETTIME 1
+#define HAVE_DCGETTEXT 1
+#define HAVE_DECL_CLOCK_MONOTONIC 1
+#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
+#define HAVE_DECODERS 1
+#define HAVE_DECODER_ARM 1
+#define HAVE_DECODER_ARMTHUMB 1
+#define HAVE_DECODER_DELTA 1
+#define HAVE_DECODER_IA64 1
+#define HAVE_DECODER_LZMA1 1
+#define HAVE_DECODER_LZMA2 1
+#define HAVE_DECODER_POWERPC 1
+#define HAVE_DECODER_SPARC 1
+#define HAVE_DECODER_X86 1
+#define HAVE_DLFCN_H 1
+#define HAVE_ENCODERS 1
+#define HAVE_ENCODER_ARM 1
+#define HAVE_ENCODER_ARMTHUMB 1
+#define HAVE_ENCODER_DELTA 1
+#define HAVE_ENCODER_IA64 1
+#define HAVE_ENCODER_LZMA1 1
+#define HAVE_ENCODER_LZMA2 1
+#define HAVE_ENCODER_POWERPC 1
+#define HAVE_ENCODER_SPARC 1
+#define HAVE_ENCODER_X86 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FUTIMENS 1
+#define HAVE_GETOPT_H 1
+#define HAVE_GETOPT_LONG 1
+#define HAVE_GETTEXT 1
+#define HAVE_IMMINTRIN_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MBRTOWC 1
+#define HAVE_MEMORY_H 1
+#define HAVE_MF_BT2 1
+#define HAVE_MF_BT3 1
+#define HAVE_MF_BT4 1
+#define HAVE_MF_HC3 1
+#define HAVE_MF_HC4 1
+#define HAVE_OPTRESET 1
+#define HAVE_POSIX_FADVISE 1
+#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
+#define HAVE_PTHREAD_PRIO_INHERIT 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
+#define HAVE_SYS_PARAM_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_UINTPTR_T 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VISIBILITY 1
+#define HAVE_WCWIDTH 1
+#define HAVE__BOOL 1
+#define HAVE___BUILTIN_ASSUME_ALIGNED 1
+#define HAVE___BUILTIN_BSWAPXX 1
+#define MYTHREAD_POSIX 1
+#define NDEBUG 1
+#define PACKAGE "xz"
+#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org"
+#define PACKAGE_NAME "XZ Utils"
+#define PACKAGE_STRING "XZ Utils 5.4.0"
+#define PACKAGE_TARNAME "xz"
+#define PACKAGE_VERSION "5.4.0"
+#define SIZEOF_SIZE_T 4
+#define STDC_HEADERS 1
+#define TUKLIB_CPUCORES_SYSCONF 1
+#define TUKLIB_FAST_UNALIGNED_ACCESS 1
+#define TUKLIB_PHYSMEM_SYSCONF 1
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+#define VERSION "5.4.0"
+'''
diff --git a/tools/settings.py b/tools/settings.py
index 10d6ca0..827e4a9 100644
--- a/tools/settings.py
+++ b/tools/settings.py
@@ -40,6 +40,7 @@ PORTS_SETTINGS = {
'USE_SDL_NET',
'USE_SDL_GFX',
'USE_LIBJPEG',
+ 'USE_LIBLZMA',
'USE_OGG',
'USE_REGAL',
'USE_BOOST_HEADERS',
--
2.34.1

View File

@ -0,0 +1,139 @@
import os
import logging
VERSION = '5.4.6'
HASH = '495cc890d25c075c927c907b77e60d86dd8a4c377cea5b1172c8e916984149a7bb5fb32db25091f7219346b83155b47e4bc0404cc8529d992014cd7ed0c278b7'
URL = 'https://github.com/tukaani-project/xz'
DESCRIPTION = 'liblzma provides a general-purpose data-compression library.'
LICENSE = 'LGPL-2.1'
def get(ports, settings, shared):
ports.fetch_project('contrib.liblzma', f'https://github.com/tukaani-project/xz/releases/download/v{VERSION}/xz-{VERSION}.tar.xz', sha512hash=HASH)
def create(final):
logging.info('building port: contrib.liblzma')
ports.clear_project_build('contrib.liblzma')
source_path = os.path.join(ports.get_dir(), 'contrib.liblzma', f'xz-{VERSION}', 'src', 'liblzma')
ports.write_file(os.path.join(source_path, 'config.h'), config_h)
ports.install_headers(os.path.join(source_path, 'api'), pattern='lzma.h')
ports.install_headers(os.path.join(source_path, 'api', 'lzma'), pattern='*.h', target='lzma')
build_flags = ['-DHAVE_CONFIG_H', '-DTUKLIB_SYMBOL_PREFIX=lzma_', '-fvisibility=hidden']
exclude_files = ['crc32_small.c', 'crc64_small.c', 'crc32_tablegen.c', 'crc64_tablegen.c', 'price_tablegen.c', 'fastpos_tablegen.c',
'tuklib_exit.c', 'tuklib_mbstr_fw.c', 'tuklib_mbstr_width.c', 'tuklib_open_stdxxx.c', 'tuklib_progname.c']
include_dirs_rel = ['../common', 'api', 'check', 'common', 'delta', 'lz', 'lzma', 'rangecoder', 'simple']
include_dirs = [os.path.join(source_path, p) for p in include_dirs_rel]
ports.build_port(source_path, final, 'contrib.liblzma', flags=build_flags, exclude_files=exclude_files, includes=include_dirs)
return [shared.cache.get_lib('liblzma.a', create, what='port')]
def clear(ports, settings, shared):
shared.cache.erase_lib('liblzma.a')
def process_args(ports):
return []
config_h = '''
#define ASSUME_RAM 128
#define ENABLE_NLS 1
#define HAVE_CHECK_CRC32 1
#define HAVE_CHECK_CRC64 1
#define HAVE_CHECK_SHA256 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_DCGETTEXT 1
#define HAVE_DECL_CLOCK_MONOTONIC 1
#define HAVE_DECL_PROGRAM_INVOCATION_NAME 1
#define HAVE_DECODERS 1
#define HAVE_DECODER_ARM 1
#define HAVE_DECODER_ARMTHUMB 1
#define HAVE_DECODER_DELTA 1
#define HAVE_DECODER_IA64 1
#define HAVE_DECODER_LZMA1 1
#define HAVE_DECODER_LZMA2 1
#define HAVE_DECODER_POWERPC 1
#define HAVE_DECODER_SPARC 1
#define HAVE_DECODER_X86 1
#define HAVE_DLFCN_H 1
#define HAVE_ENCODERS 1
#define HAVE_ENCODER_ARM 1
#define HAVE_ENCODER_ARMTHUMB 1
#define HAVE_ENCODER_DELTA 1
#define HAVE_ENCODER_IA64 1
#define HAVE_ENCODER_LZMA1 1
#define HAVE_ENCODER_LZMA2 1
#define HAVE_ENCODER_POWERPC 1
#define HAVE_ENCODER_SPARC 1
#define HAVE_ENCODER_X86 1
#define HAVE_FCNTL_H 1
#define HAVE_FUTIMENS 1
#define HAVE_GETOPT_H 1
#define HAVE_GETOPT_LONG 1
#define HAVE_GETTEXT 1
#define HAVE_IMMINTRIN_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MBRTOWC 1
#define HAVE_MEMORY_H 1
#define HAVE_MF_BT2 1
#define HAVE_MF_BT3 1
#define HAVE_MF_BT4 1
#define HAVE_MF_HC3 1
#define HAVE_MF_HC4 1
#define HAVE_OPTRESET 1
#define HAVE_POSIX_FADVISE 1
#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
#define HAVE_PTHREAD_PRIO_INHERIT 1
#define HAVE_STDBOOL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_UINTPTR_T 1
#define HAVE_UNISTD_H 1
#define HAVE_VISIBILITY 1
#define HAVE_WCWIDTH 1
#define HAVE__BOOL 1
#define HAVE___BUILTIN_ASSUME_ALIGNED 1
#define HAVE___BUILTIN_BSWAPXX 1
#define MYTHREAD_POSIX 1
#define NDEBUG 1
#define PACKAGE "xz"
#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org"
#define PACKAGE_NAME "XZ Utils"
#define PACKAGE_STRING "XZ Utils 5.4.0"
#define PACKAGE_TARNAME "xz"
#define PACKAGE_VERSION "5.4.0"
#define SIZEOF_SIZE_T 4
#define STDC_HEADERS 1
#define TUKLIB_CPUCORES_SYSCONF 1
#define TUKLIB_FAST_UNALIGNED_ACCESS 1
#define TUKLIB_PHYSMEM_SYSCONF 1
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
#define VERSION "5.4.0"
'''

View File

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

40
os/windows/sign_azure.ps1 Normal file
View File

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

View File

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

View File

@ -220,6 +220,7 @@ function Regression::Airport()
print(" GetAirportWidth(" + i + "): " + AIAirport.GetAirportWidth(i));
print(" GetAirportHeight(" + i + "): " + AIAirport.GetAirportHeight(i));
print(" GetAirportCoverageRadius(" + i + "): " + AIAirport.GetAirportCoverageRadius(i));
print(" GetAirportNumHelipads(" + i + "): " + AIAirport.GetAirportNumHelipads(i));
}
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));

View File

@ -1,3 +1,4 @@
--TestInit--
Ops: 9988
TickTest: 1
@ -804,56 +805,67 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetAirportWidth(-1): -1
GetAirportHeight(-1): -1
GetAirportCoverageRadius(-1): -1
GetAirportNumHelipads(-1): -1
IsAirportInformationAvailable(0): true
IsValidAirportType(0): true
GetAirportWidth(0): 4
GetAirportHeight(0): 3
GetAirportCoverageRadius(0): 4
GetAirportNumHelipads(0): 0
IsAirportInformationAvailable(1): true
IsValidAirportType(1): false
GetAirportWidth(1): 6
GetAirportHeight(1): 6
GetAirportCoverageRadius(1): 5
GetAirportNumHelipads(1): 0
IsAirportInformationAvailable(2): true
IsValidAirportType(2): false
GetAirportWidth(2): 1
GetAirportHeight(2): 1
GetAirportCoverageRadius(2): 4
GetAirportNumHelipads(2): 1
IsAirportInformationAvailable(3): true
IsValidAirportType(3): false
GetAirportWidth(3): 6
GetAirportHeight(3): 6
GetAirportCoverageRadius(3): 6
GetAirportNumHelipads(3): 0
IsAirportInformationAvailable(4): true
IsValidAirportType(4): false
GetAirportWidth(4): 7
GetAirportHeight(4): 7
GetAirportCoverageRadius(4): 8
GetAirportNumHelipads(4): 2
IsAirportInformationAvailable(5): true
IsValidAirportType(5): false
GetAirportWidth(5): 5
GetAirportHeight(5): 4
GetAirportCoverageRadius(5): 4
GetAirportNumHelipads(5): 2
IsAirportInformationAvailable(6): true
IsValidAirportType(6): false
GetAirportWidth(6): 2
GetAirportHeight(6): 2
GetAirportCoverageRadius(6): 4
GetAirportNumHelipads(6): 1
IsAirportInformationAvailable(7): true
IsValidAirportType(7): false
GetAirportWidth(7): 9
GetAirportHeight(7): 11
GetAirportCoverageRadius(7): 10
GetAirportNumHelipads(7): 2
IsAirportInformationAvailable(8): true
IsValidAirportType(8): false
GetAirportWidth(8): 4
GetAirportHeight(8): 2
GetAirportCoverageRadius(8): 4
GetAirportNumHelipads(8): 3
IsAirportInformationAvailable(9): false
IsValidAirportType(9): false
GetAirportWidth(9): -1
GetAirportHeight(9): -1
GetAirportCoverageRadius(9): -1
GetAirportNumHelipads(9): -1
GetBankBalance(): 1999999790
GetPrice(): 5400
BuildAirport(): true
@ -6081,7 +6093,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetNumEngines(): 1
GetNumEngines(): 1
GetNumEngines(): 0
GetName(): Group 0
GetName(): Group 1
GetName(): (null : 0x00000000)
AIVehicle.SellVehicle(): true
AITile.DemolishTile(): true
@ -7498,7 +7510,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
BuildRailDepot(): false
BuildRailDepot(): true
BuildRailDepot(): true
BuildRailDepot(): false
BuildRailDepot(): true
GetRailDepotFrontTile(): 33412
IsBuildable(): false
DepotList
@ -7592,12 +7604,12 @@ ERROR: IsEnd() is invalid as Begin() is never called
BuildRoadDepot(): false
BuildRoadDepot(): true
BuildRoadDepot(): true
BuildRoadDepot(): false
BuildRoadDepot(): true
HasRoadType(Road): true
HasRoadType(Tram): false
GetLastError(): 259
GetLastErrorString(): ERR_ALREADY_BUILT
GetErrorCategory(): 1
GetLastError(): 0
GetLastErrorString(): ERR_NONE
GetErrorCategory(): 0
IsRoadTile(): false
GetRoadDepotFrontTile(): 33412
IsRoadDepotTile(): true
@ -9459,7 +9471,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
IsStoppedInDepot(): false
--Accounting--
GetCosts(): -5947
Should be: -5946
Should be: -5947
GetName(): Road Vehicle #1
SetName(): true
GetName(): MyVehicleName
@ -9473,7 +9485,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
GetAgeLeft(): 5489
GetCurrentSpeed(): 7
GetRunningCost(): 421
GetProfitThisYear(): -1
GetProfitThisYear(): 0
GetProfitLastYear(): 0
GetCurrentValue(): 5947
GetVehicleType(): 1
@ -9592,7 +9604,7 @@ ERROR: IsEnd() is invalid as Begin() is never called
16 => 0
14 => 0
13 => 0
12 => -1
12 => 0
ProfitLastYear ListDump:
17 => 0
16 => 0
@ -9736,9 +9748,9 @@ ERROR: IsEnd() is invalid as Begin() is never called
--Valuate() with excessive CPU usage--
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [unknown()] regression/main.nut line [2050]
*FUNCTION [unknown()] regression/main.nut line [2051]
*FUNCTION [Valuate()] NATIVE line [-1]
*FUNCTION [Start()] regression/main.nut line [2051]
*FUNCTION [Start()] regression/main.nut line [2052]
[id] 0
[this] TABLE
@ -9747,7 +9759,7 @@ Your script made an error: excessive CPU usage in valuator function
[this] INSTANCE
Your script made an error: excessive CPU usage in valuator function
*FUNCTION [Start()] regression/main.nut line [2051]
*FUNCTION [Start()] regression/main.nut line [2052]
[Infinite] CLOSURE
[list] INSTANCE

View File

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

View File

@ -1,3 +1,4 @@
--StationList--
Count(): 5
Location ListDump:

View File

@ -57,8 +57,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.

View File

@ -650,8 +650,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));
@ -697,7 +696,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));

View File

@ -199,7 +199,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);
@ -242,19 +242,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;
};
}

View File

@ -51,7 +51,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; }
}
}
@ -472,10 +472,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()
{
@ -764,7 +764,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);

View File

@ -52,6 +52,8 @@ add_files(
animated_tile_func.h
articulated_vehicles.cpp
articulated_vehicles.h
autocompletion.cpp
autocompletion.h
autoreplace.cpp
autoreplace_base.h
autoreplace_cmd.cpp
@ -75,6 +77,7 @@ add_files(
bridge_map.cpp
bridge_map.h
build_vehicle_gui.cpp
cachecheck.cpp
cargo_type.h
cargoaction.cpp
cargoaction.h
@ -136,6 +139,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_cmd.h
@ -248,6 +255,7 @@ add_files(
music_gui.cpp
newgrf.cpp
newgrf.h
newgrf_act5.h
newgrf_airport.cpp
newgrf_airport.h
newgrf_airporttiles.cpp
@ -330,6 +338,9 @@ add_files(
palette_func.h
pbs.cpp
pbs.h
picker_func.h
picker_gui.cpp
picker_gui.h
progress.cpp
progress.h
querystring_gui.h
@ -391,6 +402,8 @@ add_files(
signs_func.h
signs_gui.cpp
signs_type.h
slider.cpp
slider_func.h
slope_func.h
slope_type.h
smallmap_gui.cpp
@ -466,7 +479,6 @@ add_files(
tilearea_type.h
tilehighlight_func.h
tilehighlight_type.h
tilematrix_type.hpp
timetable.h
timetable_cmd.cpp
timetable_cmd.h

View File

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

View File

@ -8,6 +8,7 @@
/** @file ai_config.cpp Implementation of AIConfig. */
#include "../stdafx.h"
#include "../company_base.h"
#include "../settings_type.h"
#include "../string_func.h"
#include "ai.hpp"
@ -24,6 +25,10 @@
if (source == SSS_FORCE_NEWGAME || (source == SSS_DEFAULT && _game_mode == GM_MENU)) {
config = &_settings_newgame.ai_config[company];
} else {
if (source != SSS_FORCE_GAME) {
Company *c = Company::GetIfValid(company);
if (c != nullptr && c->ai_config != nullptr) return c->ai_config.get();
}
config = &_settings_game.ai_config[company];
}
if (*config == nullptr) *config = new AIConfig();

View File

@ -33,30 +33,34 @@
return !_networking || (_network_server && _settings_game.ai.ai_in_multiplayer);
}
/* static */ void AI::StartNew(CompanyID company, bool rerandomise_ai)
/* static */ void AI::StartNew(CompanyID company)
{
assert(Company::IsValidID(company));
/* Clients shouldn't start AIs */
if (_networking && !_network_server) return;
AIConfig *config = AIConfig::GetConfig(company, AIConfig::SSS_FORCE_GAME);
Backup<CompanyID> cur_company(_current_company, company);
Company *c = Company::Get(company);
AIConfig *config = c->ai_config.get();
if (config == nullptr) {
c->ai_config = std::make_unique<AIConfig>(AIConfig::GetConfig(company, AIConfig::SSS_FORCE_GAME));
config = c->ai_config.get();
}
AIInfo *info = config->GetInfo();
if (info == nullptr || (rerandomise_ai && config->IsRandom())) {
if (info == nullptr) {
info = AI::scanner_info->SelectRandomAI();
assert(info != nullptr);
/* Load default data and store the name in the settings */
config->Change(info->GetName(), -1, false, true);
config->Change(info->GetName(), -1, false);
}
if (rerandomise_ai) config->AddRandomDeviation();
config->AnchorUnchangeableSettings();
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
c->ai_info = info;
assert(c->ai_instance == nullptr);
c->ai_instance = new AIInstance();
c->ai_instance = std::make_unique<AIInstance>();
c->ai_instance->Initialize(info);
c->ai_instance->LoadOnStack(config->GetToLoadData());
config->SetToLoadData(nullptr);
@ -77,7 +81,7 @@
assert(_settings_game.difficulty.competitor_speed <= 4);
if ((AI::frame_counter & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return;
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company);
for (const Company *c : Company::Iterate()) {
if (c->is_ai) {
PerformanceMeasurer framerate((PerformanceElement)(PFE_AI0 + c->index));
@ -105,17 +109,16 @@
if (_networking && !_network_server) return;
PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + company));
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company);
Company *c = Company::Get(company);
delete c->ai_instance;
c->ai_instance = nullptr;
c->ai_instance.reset();
c->ai_info = nullptr;
c->ai_config.reset();
cur_company.Restore();
InvalidateWindowClassesData(WC_SCRIPT_DEBUG, -1);
CloseWindowById(WC_SCRIPT_SETTINGS, company);
}
/* static */ void AI::Pause(CompanyID company)
@ -125,7 +128,7 @@
* for the server owner to unpause the script again. */
if (_network_dedicated) return;
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company);
Company::Get(company)->ai_instance->Pause();
cur_company.Restore();
@ -133,7 +136,7 @@
/* static */ void AI::Unpause(CompanyID company)
{
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company);
Company::Get(company)->ai_instance->Unpause();
cur_company.Restore();
@ -141,7 +144,7 @@
/* static */ bool AI::IsPaused(CompanyID company)
{
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company);
bool paused = Company::Get(company)->ai_instance->IsPaused();
cur_company.Restore();
@ -210,25 +213,30 @@
if (!_settings_game.ai_config[c]->ResetInfo(true)) {
Debug(script, 0, "After a reload, the AI by the name '{}' was no longer found, and removed from the list.", _settings_game.ai_config[c]->GetName());
_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 '{}' was no longer found, and removed from the list.", _settings_newgame.ai_config[c]->GetName());
_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();
}
}
}
}
@ -250,7 +258,7 @@
}
/* Queue the event */
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, company);
Company::Get(_current_company)->ai_instance->InsertEvent(event);
cur_company.Restore();
@ -280,14 +288,18 @@
{
if (!_networking || _network_server) {
Company *c = Company::GetIfValid(company);
assert(c != nullptr && c->ai_instance != nullptr);
assert(c != nullptr);
Backup<CompanyID> cur_company(_current_company, company, FILE_LINE);
c->ai_instance->Save();
cur_company.Restore();
} else {
AIInstance::SaveEmpty();
/* When doing emergency saving, an AI can be not fully initialised. */
if (c->ai_instance != nullptr) {
Backup<CompanyID> cur_company(_current_company, company);
c->ai_instance->Save();
cur_company.Restore();
return;
}
}
AIInstance::SaveEmpty();
}
/* static */ void AI::GetConsoleList(std::back_insert_iterator<std::string> &output_iterator, bool newest_only)

View File

@ -82,7 +82,7 @@ static constexpr NWidgetPart _nested_ai_config_widgets[] = {
};
/** Window definition for the configure AI window. */
static WindowDesc _ai_config_desc(__FILE__, __LINE__,
static WindowDesc _ai_config_desc(
WDP_CENTER, nullptr, 0, 0,
WC_GAME_OPTIONS, WC_NONE,
0,
@ -128,20 +128,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;
}
}

View File

@ -24,7 +24,7 @@
*/
static bool CheckAPIVersion(const std::string &api_version)
{
static const std::set<std::string> 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 const std::set<std::string> 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 versions.find(api_version) != versions.end();
}

View File

@ -64,9 +64,12 @@ void AIInstance::Died()
/* Intro is not supposed to use AI, but it may have 'dummy' AI which instant dies. */
if (_game_mode == GM_MENU) return;
/* Don't show errors while loading savegame. They will be shown at end of loading anyway. */
if (_switch_mode != SM_NONE) return;
ShowScriptDebugWindow(_current_company);
const AIInfo *info = AIConfig::GetConfig(_current_company, AIConfig::SSS_FORCE_GAME)->GetInfo();
const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
if (info != nullptr) {
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);

View File

@ -73,14 +73,14 @@ struct AircraftCache {
*/
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.
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.
byte state; ///< State of the airport. @see AirportMovementStates
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;
@ -111,6 +111,7 @@ struct Aircraft final : public SpecializedVehicle<Aircraft, VEH_AIRCRAFT> {
void OnNewEconomyDay() override;
uint Crash(bool flooded = false) override;
TileIndex GetOrderStationLocation(StationID station) override;
TileIndex GetCargoTile() const override { return this->First()->tile; }
ClosestDepot FindClosestDepot() override;
/**

View File

@ -134,7 +134,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 {
@ -456,6 +456,7 @@ void Aircraft::OnNewCalendarDay()
void Aircraft::OnNewEconomyDay()
{
if (!this->IsNormalAircraft()) return;
EconomyAgeVehicle(this);
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
@ -654,7 +655,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. */
@ -671,7 +672,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
@ -698,7 +699,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;
}
@ -824,7 +825,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);
@ -1181,10 +1182,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, Map::MaxX() * TILE_SIZE), Clamp(v->y_pos, 0, Map::MaxY() * 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) {
@ -1284,7 +1288,7 @@ void HandleMissingAircraftOrders(Aircraft *v)
*/
const Station *st = GetTargetAirportIfValid(v);
if (st == nullptr) {
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner);
CommandCost ret = Command<CMD_SEND_VEHICLE_TO_DEPOT>::Do(DC_EXEC, v->index, DepotCommand::None, {});
cur_company.Restore();
@ -1650,7 +1654,7 @@ static void AircraftEventHandler_HeliTakeOff(Aircraft *v, const AirportFTAClass
/* Send the helicopter to a hangar if needed for replacement */
if (v->NeedsAutomaticServicing()) {
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner);
Command<CMD_SEND_VEHICLE_TO_DEPOT>::Do(DC_EXEC, v->index, DepotCommand::Service | DepotCommand::LocateHangar, {});
cur_company.Restore();
}
@ -1665,7 +1669,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) {
@ -1701,7 +1705,7 @@ static void AircraftEventHandler_Landing(Aircraft *v, const AirportFTAClass *)
/* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed */
if (v->NeedsAutomaticServicing()) {
Backup<CompanyID> cur_company(_current_company, v->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, v->owner);
Command<CMD_SEND_VEHICLE_TO_DEPOT>::Do(DC_EXEC, v->index, DepotCommand::Service, {});
cur_company.Restore();
}
@ -1812,8 +1816,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);
@ -1949,7 +1953,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);

View File

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

View File

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

View File

@ -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"
@ -41,11 +42,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(Commands, const CommandCost &result, TileIndex tile)
{
@ -63,8 +64,8 @@ static void PlaceAirport(TileIndex tile)
{
if (_selected_airport_index == -1) return;
byte airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
byte layout = _selected_airport_layout;
uint8_t airport_type = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index)->GetIndex();
uint8_t layout = _selected_airport_layout;
bool adjacent = _ctrl_pressed;
auto proc = [=](bool test, StationID to_join) -> bool {
@ -207,7 +208,7 @@ static constexpr NWidgetPart _nested_air_toolbar_widgets[] = {
EndContainer(),
};
static WindowDesc _air_toolbar_desc(__FILE__, __LINE__,
static WindowDesc _air_toolbar_desc(
WDP_ALIGN_TOOLBAR, "toolbar_air", 0, 0,
WC_BUILD_TOOLBAR, WC_NONE,
WDF_CONSTRUCTION,
@ -240,8 +241,8 @@ class BuildAirportWindow : public PickerWindowBase {
{
DropDownList list;
for (uint i = 0; i < AirportClass::GetClassCount(); 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;
@ -276,7 +277,7 @@ public:
const AirportSpec *as = ac->GetSpec(_selected_airport_index);
if (as->IsAvailable()) {
/* Ensure the airport layout is valid. */
_selected_airport_layout = Clamp(_selected_airport_layout, 0, as->num_table - 1);
_selected_airport_layout = Clamp(_selected_airport_layout, 0, static_cast<uint8_t>(as->layouts.size() - 1));
selectFirstAirport = false;
this->UpdateSelectSize();
}
@ -305,7 +306,7 @@ public:
StringID string = GetAirportTextCallback(as, _selected_airport_layout, CBID_AIRPORT_LAYOUT_NAME);
if (string != STR_UNDEFINED) {
SetDParam(0, string);
} else if (as->num_table > 1) {
} else if (as->layouts.size() > 1) {
SetDParam(0, STR_STATION_BUILD_AIRPORT_LAYOUT_NAME);
SetDParam(1, _selected_airport_layout + 1);
}
@ -316,17 +317,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;
}
@ -335,11 +336,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;
}
@ -347,13 +348,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 < static_cast<uint8_t>(as->layouts.size()); 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);
}
}
}
@ -363,12 +364,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 < static_cast<uint8_t>(as->layouts.size()); 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;
@ -473,14 +474,14 @@ public:
const AirportSpec *as = AirportClass::Get(_selected_airport_class)->GetSpec(_selected_airport_index);
int w = as->size_x;
int h = as->size_y;
Direction rotation = as->rotation[_selected_airport_layout];
Direction rotation = as->layouts[_selected_airport_layout].rotation;
if (rotation == DIR_E || rotation == DIR_W) Swap(w, h);
SetTileSelectSize(w, h);
this->preview_sprite = GetCustomAirportSprite(as, _selected_airport_layout);
this->SetWidgetDisabledState(WID_AP_LAYOUT_DECREASE, _selected_airport_layout == 0);
this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1 >= as->num_table);
this->SetWidgetDisabledState(WID_AP_LAYOUT_INCREASE, _selected_airport_layout + 1U >= as->layouts.size());
int rad = _settings_game.station.modified_catchment ? as->catchment : (uint)CA_UNMODIFIED;
if (_settings_client.gui.station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
@ -495,8 +496,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;
@ -545,14 +546,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;
}
}
@ -618,7 +617,7 @@ static constexpr NWidgetPart _nested_build_airport_widgets[] = {
EndContainer(),
};
static WindowDesc _build_airport_desc(__FILE__, __LINE__,
static WindowDesc _build_airport_desc(
WDP_AUTO, nullptr, 0, 0,
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
WDF_CONSTRUCTION,

66
src/autocompletion.cpp Normal file
View File

@ -0,0 +1,66 @@
/*
* 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/>.
*/
/** @file autocompletion.cpp Generic auto-completion engine. */
#include "stdafx.h"
#include "autocompletion.h"
#include "console_internal.h"
#include "town.h"
#include "network/network_base.h"
#include "safeguards.h"
bool AutoCompletion::AutoComplete()
{
// We are pressing TAB for the first time after reset.
if (this->suggestions.empty()) {
this->InitSuggestions(this->textbuf->buf);
if (this->suggestions.empty()) {
return false;
}
this->ApplySuggestion(prefix, suggestions[0]);
return true;
}
// We are pressing TAB again on the same text.
if (this->current_suggestion_index + 1 < this->suggestions.size()) {
this->ApplySuggestion(prefix, this->suggestions[++this->current_suggestion_index]);
} else {
// We are out of options, restore original text.
this->textbuf->Assign(initial_buf);
this->Reset();
}
return true;
}
void AutoCompletion::Reset()
{
this->prefix = "";
this->query = "";
this->initial_buf.clear();
this->suggestions.clear();
this->current_suggestion_index = 0;
}
void AutoCompletion::InitSuggestions(std::string_view text)
{
this->initial_buf = text;
size_t space_pos = this->initial_buf.find_last_of(' ');
this->query = this->initial_buf;
if (space_pos == std::string::npos) {
this->prefix = "";
} else {
this->prefix = this->query.substr(0, space_pos + 1);
this->query.remove_prefix(space_pos + 1);
}
this->suggestions = this->GetSuggestions(prefix, query);
this->current_suggestion_index = 0;
}

46
src/autocompletion.h Normal file
View File

@ -0,0 +1,46 @@
/*
* 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/>.
*/
/** @file autocompletion.h Generic auto-completion engine. */
#ifndef AUTOCOMPLETION_H
#define AUTOCOMPLETION_H
#include "textbuf_type.h"
class AutoCompletion {
protected:
Textbuf *textbuf;
private:
std::string initial_buf; ///< Value of text buffer when we started current suggestion session.
std::string_view prefix; ///< Prefix of the text before the last space.
std::string_view query; ///< Last token of the text. This is used to based the suggestions on.
std::vector<std::string> suggestions;
size_t current_suggestion_index;
public:
AutoCompletion(Textbuf *textbuf) : textbuf(textbuf)
{
this->Reset();
}
virtual ~AutoCompletion() = default;
// Returns true the textbuf was updated.
bool AutoComplete();
void Reset();
private:
void InitSuggestions(std::string_view text);
virtual std::vector<std::string> GetSuggestions(std::string_view prefix, std::string_view query) = 0;
virtual void ApplySuggestion(std::string_view prefix, std::string_view suggestion) = 0;
};
#endif /* AUTOCOMPLETION_H */

View File

@ -315,9 +315,10 @@ static CommandCost GetNewEngineType(const Vehicle *v, const Company *c, bool alw
* @param old_veh A single (articulated/multiheaded) vehicle that shall be replaced.
* @param new_vehicle Returns the newly build and refitted vehicle
* @param part_of_chain The vehicle is part of a train
* @param flags The calling command flags.
* @return cost or error
*/
static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehicle, bool part_of_chain)
static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehicle, bool part_of_chain, DoCommandFlag flags)
{
*new_vehicle = nullptr;
@ -331,9 +332,10 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
/* Does it need to be refitted */
CargoID refit_cargo = GetNewCargoTypeForReplace(old_veh, e, part_of_chain);
if (!IsValidCargoID(refit_cargo)) {
if (!IsLocalCompany()) return CommandCost();
if (!IsLocalCompany() || (flags & DC_EXEC) == 0) return CommandCost();
SetDParam(0, old_veh->index);
VehicleID old_veh_id = (old_veh->type == VEH_TRAIN) ? Train::From(old_veh)->First()->index : old_veh->index;
SetDParam(0, old_veh_id);
int order_id = GetIncompatibleRefitOrderIdForAutoreplace(old_veh, e);
if (order_id != -1) {
@ -346,7 +348,7 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
SetDParam(2, CargoSpec::Get(old_veh->cargo_type)->name);
}
AddVehicleAdviceNewsItem(STR_NEWS_VEHICLE_AUTORENEW_FAILED, old_veh->index);
AddVehicleAdviceNewsItem(STR_NEWS_VEHICLE_AUTORENEW_FAILED, old_veh_id);
return CommandCost();
}
@ -360,7 +362,7 @@ static CommandCost BuildReplacementVehicle(Vehicle *old_veh, Vehicle **new_vehic
/* 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(std::get<0>(Command<CMD_REFIT_VEHICLE>::Do(DC_EXEC, new_veh->index, refit_cargo, subtype, false, false, 0)));
assert(cost.Succeeded()); // This should be ensured by GetNewCargoTypeForReplace()
@ -455,7 +457,7 @@ static CommandCost ReplaceFreeUnit(Vehicle **single_unit, DoCommandFlag flags, b
/* Build and refit replacement vehicle */
Vehicle *new_v = nullptr;
cost.AddCost(BuildReplacementVehicle(old_v, &new_v, false));
cost.AddCost(BuildReplacementVehicle(old_v, &new_v, false, flags));
/* Was a new vehicle constructed? */
if (cost.Succeeded() && new_v != nullptr) {
@ -531,7 +533,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
for (Train *w = Train::From(old_head); w != nullptr; w = w->GetNextUnit()) {
ReplaceChainItem &replacement = replacements.emplace_back(w, nullptr, 0);
CommandCost ret = BuildReplacementVehicle(replacement.old_veh, &replacement.new_veh, true);
CommandCost ret = BuildReplacementVehicle(replacement.old_veh, &replacement.new_veh, true, flags);
cost.AddCost(ret);
if (cost.Failed()) break;
@ -688,7 +690,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
} else {
/* Build and refit replacement vehicle */
Vehicle *new_head = nullptr;
cost.AddCost(BuildReplacementVehicle(old_head, &new_head, true));
cost.AddCost(BuildReplacementVehicle(old_head, &new_head, true, flags));
/* Was a new vehicle constructed? */
if (cost.Succeeded() && new_head != nullptr) {

View File

@ -24,7 +24,8 @@
#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 "autoreplace_cmd.h"
#include "group_cmd.h"
#include "settings_cmd.h"
@ -33,8 +34,6 @@
#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)
{
return Engine::Get(a.engine_id)->list_position < Engine::Get(b.engine_id)->list_position;
@ -72,7 +71,6 @@ void AddRemoveEngineFromAutoreplaceAndBuildWindows(VehicleType type)
static const StringID _start_replace_dropdown[] = {
STR_REPLACE_VEHICLES_NOW,
STR_REPLACE_VEHICLES_WHEN_OLD,
INVALID_STRING_ID
};
/**
@ -85,7 +83,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.
@ -113,27 +111,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
@ -143,7 +120,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;
@ -207,7 +184,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 +292,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 +322,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 +331,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 +340,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 +351,7 @@ public:
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
@ -385,18 +362,16 @@ public:
}
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
case WID_RV_START_REPLACE: {
Dimension d = GetStringBoundingBox(STR_REPLACE_VEHICLES_START);
for (int i = 0; _start_replace_dropdown[i] != INVALID_STRING_ID; i++) {
d = maxdim(d, GetStringBoundingBox(_start_replace_dropdown[i]));
}
d = maxdim(d, GetStringListBoundingBox(_start_replace_dropdown));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
size = maxdim(size, d);
break;
}
}
@ -424,7 +399,7 @@ public:
break;
case WID_RV_SORT_DROPDOWN:
SetDParam(0, _engine_sort_listing[this->window_number][this->sort_criteria]);
SetDParam(0, std::data(_engine_sort_listing[this->window_number])[this->sort_criteria]);
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: {
@ -487,11 +462,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;
}
}
@ -565,8 +538,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;
}
@ -609,7 +582,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 {
@ -789,7 +762,7 @@ static constexpr NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
EndContainer(),
};
static WindowDesc _replace_rail_vehicle_desc(__FILE__, __LINE__,
static WindowDesc _replace_rail_vehicle_desc(
WDP_AUTO, "replace_vehicle_train", 500, 140,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
@ -847,7 +820,7 @@ static constexpr NWidgetPart _nested_replace_road_vehicle_widgets[] = {
EndContainer(),
};
static WindowDesc _replace_road_vehicle_desc(__FILE__, __LINE__,
static WindowDesc _replace_road_vehicle_desc(
WDP_AUTO, "replace_vehicle_road", 500, 140,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,
@ -901,7 +874,7 @@ static constexpr NWidgetPart _nested_replace_vehicle_widgets[] = {
EndContainer(),
};
static WindowDesc _replace_vehicle_desc(__FILE__, __LINE__,
static WindowDesc _replace_vehicle_desc(
WDP_AUTO, "replace_vehicle", 456, 118,
WC_REPLACE_VEHICLE, WC_NONE,
WDF_CONSTRUCTION,

View File

@ -313,8 +313,8 @@ static const uint NUM_SONGS_AVAILABLE = 1 + NUM_SONG_CLASSES * NUM_SONGS_CLASS;
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);
std::optional<std::string> GetMusicCatEntryName(const std::string &filename, size_t entrynum);
std::optional<std::vector<uint8_t>> GetMusicCatEntryData(const std::string &filename, size_t entrynum);
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);
};

View File

@ -19,16 +19,11 @@
typedef Pool<BaseStation, StationID, 32, 64000> StationPool;
extern StationPool _station_pool;
struct StationSpecList {
const StationSpec *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
template <typename T>
struct SpecMapping {
const T *spec; ///< Custom spec.
uint32_t grfid; ///< GRF ID of this custom spec.
uint16_t localidx; ///< Local ID within GRF of this custom spec.
};
struct RoadStopTileData {
@ -64,7 +59,7 @@ struct StationRect : public Rect {
struct BaseStation : StationPool::PoolItem<&_station_pool> {
TileIndex xy; ///< Base tile of the station
TrackedViewportSign sign; ///< NOSAVE: Dimensions of sign
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 delete_ctr; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
std::string name; ///< Custom name
StringID string_id; ///< Default name (town area) of station
@ -74,13 +69,13 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
Owner owner; ///< The owner of this station
StationFacility facilities; ///< The facilities that this station has
std::vector<StationSpecList> speclist; ///< List of rail station specs of this station.
std::vector<RoadStopSpecList> roadstop_speclist; ///< List of road stop specs of this station
std::vector<SpecMapping<StationSpec>> speclist; ///< List of rail station specs of this station.
std::vector<SpecMapping<RoadStopSpec>> roadstop_speclist; ///< List of road stop specs of this station
TimerGameCalendar::Date build_date; ///< Date of construction
uint16_t random_bits; ///< Random bits assigned to this station
byte waiting_triggers; ///< Waiting triggers (NewGRF) for this station
uint8_t waiting_triggers; ///< Waiting triggers (NewGRF) for this station
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
@ -118,7 +113,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, byte variable, byte parameter, bool *available) const = 0;
virtual uint32_t GetNewGRFVariable(const struct ResolverObject &object, uint8_t variable, uint8_t parameter, bool &available) const = 0;
/**
* Update the coordinated of the sign (as shown in the viewport).
@ -184,7 +179,7 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
return (this->facilities & ~FACIL_WAYPOINT) != 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;
@ -192,7 +187,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;
@ -201,11 +196,11 @@ struct BaseStation : StationPool::PoolItem<&_station_pool> {
}
private:
void SetRoadStopTileData(TileIndex tile, byte data, bool animation);
void SetRoadStopTileData(TileIndex tile, uint8_t data, bool animation);
public:
inline void SetRoadStopRandomBits(TileIndex tile, byte random_bits) { this->SetRoadStopTileData(tile, random_bits, false); }
inline void SetRoadStopAnimationFrame(TileIndex tile, byte frame) { this->SetRoadStopTileData(tile, frame, true); }
inline void SetRoadStopRandomBits(TileIndex tile, uint8_t random_bits) { this->SetRoadStopTileData(tile, random_bits, false); }
inline void SetRoadStopAnimationFrame(TileIndex tile, uint8_t frame) { this->SetRoadStopTileData(tile, frame, true); }
void RemoveRoadStopTileData(TileIndex tile);
static void PostDestructor(size_t index);
@ -226,7 +221,7 @@ struct SpecializedStation : public BaseStation {
* Set station type correctly
* @param tile The base tile of the station.
*/
inline SpecializedStation<T, Tis_waypoint>(TileIndex tile) :
inline SpecializedStation(TileIndex tile) :
BaseStation(tile)
{
this->facilities = EXPECTED_FACIL;
@ -310,4 +305,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 */

View File

@ -34,23 +34,23 @@ 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
for (int y = 0; y < bp->height; y++) {
Colour *dst_ln = dst + bp->pitch;
uint16_t *anim_ln = anim + this->anim_buf_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 + bp->skip_left;

View File

@ -47,7 +47,7 @@ public:
void PaletteAnimate(const Palette &palette) override;
Blitter::PaletteAnimation UsePaletteAnimation() override;
const char *GetName() override { return "32bpp-anim"; }
std::string_view GetName() override { return "32bpp-anim"; }
void PostResize() override;
/**

View File

@ -31,7 +31,7 @@
class Blitter_32bppSSE2_Anim : public Blitter_32bppAnim {
public:
void PaletteAnimate(const Palette &palette) override;
const char *GetName() override { return "32bpp-sse2-anim"; }
std::string_view GetName() override { return "32bpp-sse2-anim"; }
};
/** Factory for the partially 32bpp blitter with animation. */

View File

@ -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;
@ -368,7 +368,7 @@ bmcr_alpha_blend_single:
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;
}

View File

@ -42,7 +42,7 @@ public:
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator) override {
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
}
const char *GetName() override { return "32bpp-sse4-anim"; }
std::string_view GetName() override { return "32bpp-sse4-anim"; }
using Blitter_32bppSSE2_Anim::LookupColourInPalette;
};

View File

@ -40,26 +40,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 */
@ -306,9 +306,9 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
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 = _settings_client.gui.zoom_max;
@ -405,8 +405,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];
}
uint len = 0; // total length of data
@ -416,10 +416,10 @@ template <bool Tpal_to_rgb> Sprite *Blitter_32bppOptimized::EncodeInternal(const
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sizeof(SpriteData) + len);
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;
SpriteData *dst = (SpriteData *)dest_sprite->data;
memset(dst, 0, sizeof(*dst));

View File

@ -18,13 +18,13 @@ public:
/** Data stored about a (single) sprite. */
struct SpriteData {
uint32_t offset[ZOOM_LVL_END][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.
};
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator) override;
const char *GetName() override { return "32bpp-optimized"; }
std::string_view GetName() override { return "32bpp-optimized"; }
template <BlitterMode mode, bool Tpal_to_rgb = false> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);

View File

@ -118,17 +118,17 @@ 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 = static_cast<Sprite *>(allocator(sizeof(*dest_sprite) + static_cast<size_t>(sprite[ZOOM_LVL_MIN].height) * static_cast<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;
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;

View File

@ -28,7 +28,7 @@ public:
void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override;
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator) override;
const char *GetName() override { return "32bpp-simple"; }
std::string_view GetName() override { return "32bpp-simple"; }
};
/** Factory for the simple 32 bpp blitter. */

View File

@ -26,9 +26,9 @@ 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;
if (sprite[ZOOM_LVL_NORMAL].type != SpriteType::Font) {
ZoomLevel zoom_min = ZOOM_LVL_MIN;
ZoomLevel zoom_max = ZOOM_LVL_MIN;
if (sprite[ZOOM_LVL_MIN].type != SpriteType::Font) {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = _settings_client.gui.zoom_max;
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
@ -52,10 +52,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;
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
/* Copy colours and determine flags. */
@ -114,7 +114,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;

View File

@ -73,7 +73,7 @@ public:
struct SpriteData {
SpriteFlags flags;
SpriteInfo infos[ZOOM_LVL_END];
byte data[]; ///< Data, all zoomlevels.
uint8_t data[]; ///< Data, all zoomlevels.
};
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator);
@ -92,7 +92,7 @@ public:
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
}
const char *GetName() override { return "32bpp-sse2"; }
std::string_view GetName() override { return "32bpp-sse2"; }
};
/** Factory for the SSE2 32 bpp blitter (without palette animation). */

View File

@ -32,7 +32,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
const char *GetName() override { return "32bpp-sse4"; }
std::string_view GetName() override { return "32bpp-sse4"; }
};
/** Factory for the SSE4 32 bpp blitter (without palette animation). */

View File

@ -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 (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);
if (read_mode != RM_WITH_MARGIN) {
src_rgba_line += bp->skip_left;
@ -307,7 +314,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; \
@ -435,7 +442,7 @@ bmcr_alpha_blend_single:
next_line:
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_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;
}
}

View File

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

View File

@ -32,7 +32,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
const char *GetName() override { return "32bpp-ssse3"; }
std::string_view GetName() override { return "32bpp-ssse3"; }
};
/** Factory for the SSSE3 32 bpp blitter (without palette animation). */

View File

@ -104,8 +104,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 */
@ -114,7 +114,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 */
@ -122,11 +122,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 */

View File

@ -32,7 +32,7 @@ public:
Blitter::PaletteAnimation UsePaletteAnimation() override;
bool NeedsAnimationBuffer() override;
const char *GetName() override { return "40bpp-anim"; }
std::string_view GetName() override { return "40bpp-anim"; }
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);

View File

@ -128,9 +128,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 = _settings_client.gui.zoom_max;
@ -147,10 +147,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++) {
@ -166,7 +166,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];
@ -213,7 +213,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);
@ -221,10 +221,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;
memcpy(dest_sprite->data, temp_dst, size);
return dest_sprite;

View File

@ -19,13 +19,13 @@ public:
/** Data stored about a (single) sprite. */
struct SpriteData {
uint32_t offset[ZOOM_LVL_END]; ///< 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;
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator) override;
const char *GetName() override { return "8bpp-optimized"; }
std::string_view GetName() override { return "8bpp-optimized"; }
};
/** Factory for the 8bpp blitter optimised for speed. */

View File

@ -64,16 +64,16 @@ 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 = static_cast<Sprite *>(allocator(sizeof(*dest_sprite) + static_cast<size_t>(sprite[ZOOM_LVL_MIN].height) * static_cast<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;
/* 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;

View File

@ -19,7 +19,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override;
Sprite *Encode(const SpriteLoader::SpriteCollection &sprite, AllocatorProc *allocator) override;
const char *GetName() override { return "8bpp-simple"; }
std::string_view GetName() override { return "8bpp-simple"; }
};
/** Factory for the most trivial 8bpp blitter. */

View File

@ -31,7 +31,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 skip_left; ///< How much pixels of the source to skip on the left (based on zoom of dst)
int skip_top; ///< How much pixels of the source to skip on the top (based on zoom of dst)
@ -197,7 +197,7 @@ public:
/**
* Get the name of the blitter, the same as the Factory-instance returns.
*/
virtual const char *GetName() = 0;
virtual std::string_view GetName() = 0;
/**
* Post resize event

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