Commit Graph

29859 Commits

Author SHA1 Message Date
Peter Nelson
177e2ebf80 Codechange: Support saveload of reference vectors.
This uses the same data format as reference lists, but for vectors, so allows data structures to be changed without affecting savegame format.
2024-11-27 12:35:27 +00:00
translators
e7c63de55d Update: Translations from eints
korean: 2 changes by telk5093
ukrainian: 7 changes by CodyMaster3
2024-11-27 04:49:29 +00:00
SamuXarick
8e9603bd33
Codechange: Rename and return AyStarStatus instead of int (#13125)
- Rename enum AystarStatus to AyStarStatus.
- Return AyStarStatus instead of int for AyStar::Main and AyStar::Loop functions.
2024-11-27 00:10:06 +01:00
translators
7c3b0e5c9c Update: Translations from eints
polish: 1 change by pAter-exe
2024-11-26 04:49:08 +00:00
Peter Nelson
a3437df7b7
Fix #13121: Crash when clicking on scrollbar if contents don't need scrolling. (#13122) 2024-11-25 08:20:20 +00:00
translators
5b02f51e17 Update: Translations from eints
galician: 7 changes by pvillaverde
vietnamese: 3 changes by KhoiCanDev
polish: 12 changes by pAter-exe
2024-11-25 04:48:28 +00:00
Peter Nelson
0446123194
Change: Show company finances column if it has any values in it. (#13112)
This solves finances not being show if the company inauguration date is in the future.

Current period is now always shown in the same position instead of moving for the first 2 years.
2024-11-24 11:59:30 +00:00
Peter Nelson
0c04966dc3
Fix #13022: Ensure minimum size of scrollbar slider. (#13119)
When there are many more items than fit in a list, the scrollbar slider scales to fit but there is no minimum size. It becomes too small to click on and use.

Ensure scrollbar slider is at least the same size as the buttons either end.
2024-11-24 11:50:04 +00:00
Peter Nelson
0b0b4f50c4
Fix: Crash when exiting game with highscore window open. (#13118) 2024-11-24 10:36:21 +00:00
Peter Nelson
fa1849b855 Codechange: Use std::range::find_if where possible. 2024-11-24 10:36:03 +00:00
Peter Nelson
059a4b22f7 Codechange: Use projection-based std::range::find where possible.
This simplifies matching by class members and avoids wordy lambdas.
2024-11-24 10:36:03 +00:00
Peter Nelson
876d53282e Codechange: Use std::ranges::count(_if). 2024-11-24 10:36:03 +00:00
Peter Nelson
3be0166801 Codechange: Use std::ranges::find where possible.
Replace `std::find(range.begin(), range.end(), ...)` with `std::ranges::find(range, ...)`.
2024-11-24 10:36:03 +00:00
Peter Nelson
1f18894408
Change: Determine industry directory width only on visible rows. (#13097)
When rebuilding the industry directory list, the width of every item in the list is obtained to get the maximum width required for the horizontal scrollbar. This can take considerable time if there are a lot of industries.

Instead, calculate only for the visible rows, and grow as needed.
2024-11-24 06:51:58 +00:00
translators
9399a92a4f Update: Translations from eints
english (au): 2 changes by krysclarke
swedish: 4 changes by joeax910
chinese (traditional): 2 changes by KogentaSan
chinese (simplified): 3 changes by WenSimEHRP
greek: 4 changes by gh658804
russian: 3 changes by Ln-Wolf
finnish: 4 changes by hpiirai
portuguese (brazilian): 3 changes by pasantoro
polish: 46 changes by pAter-exe
2024-11-24 04:46:32 +00:00
Loïc Guilloux
681b1928b4
Fix #13110: [Script] convert table keys to string when generating JSON (#13113) 2024-11-23 13:46:33 +01:00
Peter Nelson
b890dab2b4
Change: Treat recolour sprites as regular sprites in the SpriteCache. (#13107)
Recolour sprites are loaded when seen, instead of being loaded when needed. This could result in the sprite cache being filled up with recolour sprites, and also mean that replacing recolour sprites didn't release the previously allocated memory.

Instead, allow recolour sprites to be loaded as needed and freed when unneeded, like regular sprites.
2024-11-23 12:14:46 +00:00
Peter Nelson
00ae20fa02
Codechange: Tidy up GRFParameterInfo. (#13114)
Use member-initialisation, reorder members to reduce space, and prefer references.

SetValue/GetValue are moved to GRFConfig as they set the config's parameter values.
2024-11-23 12:13:52 +00:00
Jonathan G Rennison
b84a164590 Codechange: Avoid unnecessary re-reads/seeks in RandomAccessFile::ReadBlock 2024-11-23 21:48:22 +10:00
Peter Nelson
653e5e8b63 Codechange: Use std::visit for formatting script strings. 2024-11-23 10:55:41 +00:00
Peter Nelson
43da3e7693 Codechange: Use std::visit for ScriptDataVariant. 2024-11-23 10:55:41 +00:00
Peter Nelson
d875ac8947 Add: const operator->() for ScirptObjectRef. 2024-11-23 10:55:41 +00:00
translators
26ae50baf9 Update: Translations from eints
english (au): 1 change by krysclarke
chinese (traditional): 1 change by KogentaSan
korean: 5 changes by telk5093
greek: 1 change by gh658804
dutch: 1 change by KevinHeijsteeg2
2024-11-23 04:47:22 +00:00
Peter Nelson
a4b4095232
Codechange: Shuffle Engine members around to reduce size. (#13115)
Reduces overall size of Engine from 752 to 720 bytes.
2024-11-22 23:58:13 +00:00
Peter Nelson
16038879e4
Codechange: Speed up industry generation using industry-type checks. (#13094)
Store a list of industries per industry type. This allows industry generation checks which only consider a specific industry type to check a reduced set of industries, leading to a potential performance increase.

This also removes the need to track industry type counts as well.
2024-11-22 23:17:24 +00:00
Peter Nelson
a951896364 Add: Add cargo transported to industry production graph. 2024-11-22 20:47:51 +00:00
Peter Nelson
22035a4f2a Add: Ability to show and filter different datasets on the same graph. 2024-11-22 20:47:51 +00:00
Peter Nelson
598fdf04a4 Codechange: Use vector instead of fixed array for graph data. 2024-11-22 20:47:51 +00:00
felixprigge
67a0fccfad
Fix: [Timetable] Use days as precision in day mode for accurate timetable syncing (#12683)
Co-authored-by: flowprint <61750128+flowprint@users.noreply.github.com>
2024-11-21 22:27:07 +00:00
Peter Nelson
6d3adc6169
Codechange: Remove ZeroedMemoryAllocator from ScriptText. (#13108)
ScriptText is much simplified from its original design. Use member initialisation instead.
2024-11-20 22:16:14 +00:00
Peter Nelson
13da98dab8
Fix: Error message not set when unable load an old save. (#13106) 2024-11-20 18:24:07 +00:00
translators
1b6a6f1cd2 Update: Translations from eints
chinese (simplified): 4 changes by WenSimEHRP
danish: 19 changes by bscargo
2024-11-20 04:46:40 +00:00
Peter Nelson
b730f8783e
Fix d450d4743: Division by zero when larger_towns is set to 0. (#13104)
Universe ended.
2024-11-20 00:09:02 +00:00
Peter Nelson
9b6b6d50c3
Fix: Network clients incorrectly truncated all strings to NETWORK_COMPANY_NAME_LENGTH. (#13102)
This should no longer be necessary since we used std::strings.
2024-11-19 23:44:54 +00:00
SamuXarick
85e9f5745a
Codefix: Replace magic number in Kdtree (#13098) 2024-11-19 20:34:25 +00:00
Peter Nelson
6c09dcdd66
Codechange: Use reference for non-optional StationList parameter. (#13092) 2024-11-19 20:33:32 +00:00
Peter Nelson
640a270ed6
Codefix: Use correct type for IndustryType in several industry functions. (#13096) 2024-11-19 20:32:06 +00:00
Peter Nelson
fcac5479f1
Codechange: Use std::visit for SetupCargoForClimate. (#13103) 2024-11-19 20:30:16 +00:00
Peter Nelson
fc8685d618
Codechange: Use functor for Kdtree's XYFunc. (#13074)
Kdtree uses a function pointer and incorrectly calls it a functor. The function pointer needs to be passed on instantiaton.

Instead, use an actual functor. This simplifies instantiation.
2024-11-19 20:29:56 +00:00
Koen Bussemaker
369ea29e1e Codechange: Remove redundant checks in FindClosestTrainDepot 2024-11-19 20:42:43 +01:00
Peter Nelson
f9b5f78b8a Codechange: Use std::visit for GetActiveCargoLabel. 2024-11-19 18:27:19 +00:00
Peter Nelson
25c5a64d39
Codechange: Use std::visit instead of std::get_if for string parameters. (#13100)
It's tidier and ensures all cases are handled, and doesn't use pointers.
2024-11-19 18:17:41 +00:00
SamuXarick
60ae50e016
Codechange: Make kdtree member functions const for const-correctness (#13099) 2024-11-19 12:36:56 +00:00
Michael Lutz
d2496b6ec4 Add: [NewGRF] Callback for custom refit mask for engines/vehicles. 2024-11-18 22:10:38 +01:00
Michael Lutz
a3ee05737f Add: [NewGRF] Vehicle prop that allows refittability based on cargo class intersection. 2024-11-18 22:10:38 +01:00
Peter Nelson
c39810ff6a Codechange: Replace path cache queues with vectors.
Ship and RoadVehicle path caches use a std::deque, which is quite memory hungry, especially for RoadVehicle which has two.
std::deque was used to be able to push/pop from either end.

Change to use a single std::vector each, which is now push/popped from the back.
2024-11-18 08:59:41 +00:00
Peter Nelson
d4f8453c22 Codefix: Clear and reserve storage when loading vectors from savegames. 2024-11-18 08:59:41 +00:00
translators
b8f3d0dd68 Update: Translations from eints
norwegian (bokmal): 4 changes by eriksorngard
2024-11-18 04:49:46 +00:00
Peter Nelson
d903806e59
Codechange: Add VectorSaveLoadHandler to simplify handlers for vectors. (#13093)
This reduces the duplication needed for each saved complex vector.
2024-11-17 23:46:32 +00:00
translators
a6c526cfa0 Update: Translations from eints
bulgarian: 4 changes by Alexandar83
2024-11-17 04:46:16 +00:00