1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-12 09:09:09 +00:00
Commit Graph

31547 Commits

Author SHA1 Message Date
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
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
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
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
653e5e8b63 Codechange: Use std::visit for formatting script strings. 2024-11-23 10:55:41 +00:00
43da3e7693 Codechange: Use std::visit for ScriptDataVariant. 2024-11-23 10:55:41 +00:00
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
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
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
a951896364 Add: Add cargo transported to industry production graph. 2024-11-22 20:47:51 +00:00
22035a4f2a Add: Ability to show and filter different datasets on the same graph. 2024-11-22 20:47:51 +00:00
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
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
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
b730f8783e Fix d450d4743: Division by zero when larger_towns is set to 0. (#13104)
Universe ended.
2024-11-20 00:09:02 +00:00
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
6c09dcdd66 Codechange: Use reference for non-optional StationList parameter. (#13092) 2024-11-19 20:33:32 +00:00
640a270ed6 Codefix: Use correct type for IndustryType in several industry functions. (#13096) 2024-11-19 20:32:06 +00:00
fcac5479f1 Codechange: Use std::visit for SetupCargoForClimate. (#13103) 2024-11-19 20:30:16 +00:00
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
f9b5f78b8a Codechange: Use std::visit for GetActiveCargoLabel. 2024-11-19 18:27:19 +00:00
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
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
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
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
04b6dfae48 Cleanup: Remove now-unneeded includes from yapf. (#13088) 2024-11-16 23:23:06 +00:00
ec1dc434ac Codechange: Shuffle CommandCost members to reduce size. (#13087)
Prefer member initialisation as well.
2024-11-16 21:49:49 +00:00
Jonathan G Rennison
71ea58c6de Codechange: Remove unused CYapfDestinationTileT (#13086) 2024-11-16 16:12:18 +00:00
57ac1cbe0c Fix: Don't allow right-click to close world generation progress window. (#13084) 2024-11-16 13:54:47 +00:00
translators
8c395ed67c Update: Translations from eints
vietnamese: 4 changes by KhoiCanDev
2024-11-16 04:48:13 +00:00
14e2839087 Codechange: Let's use this new emplace_back() thing. (#13081) 2024-11-15 20:28:17 +00:00
98c8445519 Codechange: Limit house default cargo label lists to original slot counts. (#13079)
Same as for IndustrySpec and IndustryTileSpec.
2024-11-15 08:07:02 +00:00
translators
d6c2f9edf1 Update: Translations from eints
polish: 5 changes by pAter-exe
2024-11-15 04:48:47 +00:00
61aff3fa49 Codechange: Limit industry default cargo label lists to original slot counts. (#13072)
IndustrySpec and IndustryTileSpec cargo label lists are only used for original industries. Original industries can only have up to 2 inputs and 3 outputs. Therefore having space for 16 input/outputs slots is unnecessary

This saves 216 bytes per industry type, and 164 bytes per industry tile type.
2024-11-14 19:05:18 +00:00
translators
9742038b68 Update: Translations from eints
chinese (simplified): 2 changes by WenSimEHRP
2024-11-13 04:45:59 +00:00
Koen Bussemaker
6faf4fa70a Codechange: Simplified YAPF ship region node 2024-11-12 23:17:56 +01:00
Koen Bussemaker
3e195df3c7 Codechange: Cleaned up and renamed NodeList 2024-11-12 21:06:17 +01:00