Peter Nelson
fb70a7fe7e
Codechange: Use EnumBitSet for IndustryTileSpecialFlags.
2025-02-07 12:30:06 +00:00
Peter Nelson
1916454776
Codechange: Use EnumBitSet for IndustryLifeTypes.
2025-02-07 12:30:06 +00:00
Peter Nelson
2bb3f368e3
Codechange: Use EnumBitSet for IndustryBehaviours.
2025-02-07 12:30:06 +00:00
Peter Nelson
17f6da413d
Codechange: Use EnumBitSet for RoadStopSpecFlags.
2025-02-04 18:52:08 +00:00
Peter Nelson
1a6e7f2162
Codechange: Use EnumBitSet for StationSpecFlags.
2025-02-04 18:52:08 +00:00
Peter Nelson
e114ed357d
Codechange: Use EnumBitSet for ObjectFlags. ( #13441 )
2025-02-02 21:15:03 +00:00
Peter Nelson
6f52a977a8
Codechange: Use EnumBitSet for GRFConfigFlags.
...
This is renamed from `GCF_Flag` didn't match convention.
2025-02-02 10:49:45 +00:00
Peter Nelson
59354576d4
Codechange: Use EnumBitSet for LandscapeTypes and remove LandscapeID. ( #13436 )
2025-02-01 23:09:18 +00:00
Peter Nelson
95bd53ddf1
Codechange: Use EnumBitSet for BuildingFlags.
2025-02-01 14:16:25 +00:00
Peter Nelson
113205c540
Codechange: Use EnumBitSet for HouseExtraFlags.
2025-02-01 14:16:25 +00:00
Peter Nelson
6c4ddb242a
Codechange: Use EnumBitSet for EngineMiscFlags.
2025-01-31 18:55:31 +00:00
Peter Nelson
5664b1e2f6
Codechange: Use std::vector for GRFConfig lists. ( #10835 )
...
This replaces the C-style custom managed linked-list and allows use of iterators etc.
2025-01-31 17:09:09 +00:00
Peter Nelson
40aeedeade
Codechange: Use EnumBitSet for callback masks.
2025-01-31 17:08:24 +00:00
Peter Nelson
b9ae833e96
Codechange: Use std::array for water features.
...
Replaces a memset() with fill().
2025-01-31 17:08:24 +00:00
Peter Nelson
917d5cc75d
Codechange: Use EnumBitSet for RoadTypeFlags and RailTypeFlags. ( #13415 )
2025-01-30 22:08:51 +00:00
Peter Nelson
05ac1dd888
Codechange: Use EnumBitSet for TileFlags.
2025-01-29 21:46:39 +00:00
Peter Nelson
3c2706f859
Codechange: Use EnumBitSet for EngineDisplayFlags.
2025-01-29 21:46:39 +00:00
Peter Nelson
afc0745aa2
Codechange: Specify underlying type for all enums excluding those exposed to scripts. ( #13383 )
2025-01-28 22:17:34 +00:00
Rubidium
4099acb946
Codechange: replace BSWAP32/BSWAP16 with std::byteswap
2025-01-28 19:22:12 +01:00
Peter Nelson
9b947a37b8
Codechange: Pass GRFConfig by reference where feasible. ( #13388 )
...
In places where a GRFConfig is passed by pointer and not checked for nullptr, use a reference instead.
2025-01-26 22:41:08 +00:00
Rubidium
e894a5880c
Codechange: rename CargoID to CargoType and amend related variables/comments
2025-01-26 18:07:10 +01:00
Peter Nelson
d22fd78b1c
Codefix: Sprite offsets and counts are not SpriteIDs. ( #13336 )
2025-01-19 15:58:13 +00:00
Peter Nelson
6c88169d7b
Codechange: Use std::variant instead of type and union to evaluate Action 14. ( #13328 )
...
AllowedSubtags are now passed by span, so no terminator is required, and are now static constexpr.
2025-01-17 20:53:19 +00:00
Peter Nelson
2f0b52d5b3
Codechange: Use sorted vector for NewGRF parameter value names. ( #13326 )
...
This replaces use of a std::map per GRF-parameter.
2025-01-17 19:33:11 +00:00
Peter Nelson
74bd064d10
Codechange: Pass first and last ID range instead of first and count. ( #13319 )
...
This allows range checks and loops to be slightly simplified.
2025-01-14 21:22:52 +00:00
Rubidium
3541ba4d0c
Codechange: use unique_ptr over CallocT and avoid copying table
2025-01-13 23:13:28 +01:00
Peter Nelson
11529d865b
Codefix: [NewGRF] Don't read an extended byte into uint8_t. ( #13302 )
2025-01-11 15:53:24 +00:00
Peter Nelson
2d372fa516
Codechange: NewGRF strings are not StringIDs.
...
Add GRFStringID type and use it when dealing with GRF-local string IDs.
2025-01-02 20:03:40 +00:00
Peter Nelson
4edde7d6de
Change: [NewGRF] Use deferred string mapping for bridge and currency names. ( #13230 )
...
This means that the strings can now be defined after the properties using them, as is the case with all other features.
2025-01-02 09:35:15 +00:00
Peter Nelson
0464e6bd13
Codefix: Remove obsolete industry string mapping. ( #13229 )
...
These strings are already correctly mapped by the deferred AddStringForMapping() system.
2025-01-01 22:37:43 +00:00
Rubidium
c0df898ac5
Codechange: do not implicitly convert during assignment to StrongType
2025-01-01 21:32:51 +01:00
Rubidium
3956ed086a
Codechange: use Date/Year constructor explicitly
2025-01-01 16:25:32 +01:00
Rubidium
9b3f4dff4c
Codechange: swap `int + year` to `year + int`
...
This way the operator+ without implicit constructor call is used
2025-01-01 00:10:35 +01:00
Rubidium
54d58a08f3
Codechange: use (better) named constants for the bridge sprite table
2024-12-22 13:59:18 +01:00
Peter Nelson
7af16bff11
Codechange: Use vector for GRFFile parameters instead of array. ( #13157 )
...
This simplifies assigning default parameters and removes the param_end member.
2024-12-07 22:08:59 +00:00
Peter Nelson
f5d78f9eba
Change: [NewGRF] Install translation tables into overridden NewGRF. ( #12879 )
...
When a NewGRF overrides another, any translation table that the overriding NewGRF installs will also be installed in the target file.
This allows the overridden NewGRF to make use of a cargo or rail/road type translation table without directly modifying the original file.
2024-12-07 11:26:53 +00:00
Peter Nelson
ce5279a8dc
Codechange: Implement SoundLoader interface and cache loaded sounds in memory.
...
Sounds are loaded into memory on first use, using the SoundLoader interface to support format conversion. Sounds are retained in memory to avoid reloading every time a sound is played.
This deduplicates WAV header parsing between NewGRF and baseset sounds, and will allow different audio formats to be supported.
2024-12-06 18:41:35 +00:00
Peter Nelson
f56b6756f1
Codechange: Sort EngineOverrideManager for fast lookups.
...
Allows quickly finding the EngineID given the type, grfid and local id of an engine, instead a linear scan.
This can reduce loading time when lots of engines are present and also affects performance in-game.
Lookup can be on the order of 10000 times faster.
2024-12-05 18:17:58 +00:00
Peter Nelson
bc2513975f
Codechange: Don't inherit EngineOverrideManager from std::vector.
...
Inheriting from std::vector means some operations are needlessly complex, and shouldn't really be done anyway.
2024-12-05 18:17:58 +00:00
Peter Nelson
e73d6fcaac
Codechange: Store grfid with entity grfprops.
...
This allows using the grfid without having to dereference the grffile pointer.
Uses no extra storage as it fits within otherwise wasted padding space.
2024-12-05 18:17:58 +00:00
Peter Nelson
e750d10cee
Codechange: Use std::array for per-NewGRF rail/road type maps. ( #13142 )
...
This allows initialisation to be simplified.
2024-12-05 18:17:25 +00:00
Peter Nelson
3a310f1802
Codechange: Store GRFConfig parameters in a vector. ( #13137 )
...
All GRFConfigs have space allocated for parameters, but only configured GRFConfigs need them.
Using a vector instead means that space is only used when parameters are used.
2024-12-01 15:15:21 +00:00
Peter Nelson
b6aece5b88
Fix 51bd344f10: Incorrect translation table used for older NewGRFs. ( #13131 )
...
Incorrect logic was used to select the default translation table for older GRFs.
2024-11-29 07:46:08 +00:00
Peter Nelson
9bc64b553b
Codechange: Cache callback spritegroups. ( #13111 )
...
Each callback result requires a pool memory allocation, each of which is 24 bytes.
Build a cache of results so that if the same result is used later it refers to the same group.
2024-11-27 23:25:35 +00:00
Jonathan G Rennison
f5a6a31e4a
Codefix: Avoid divide by 0 in div/mod type varaction2 adjusts ( #13123 )
2024-11-27 23:24:46 +00:00
Peter Nelson
f9b5f78b8a
Codechange: Use std::visit for GetActiveCargoLabel.
2024-11-19 18:27:19 +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
14e2839087
Codechange: Let's use this new emplace_back() thing. ( #13081 )
2024-11-15 20:28:17 +00:00
Peter Nelson
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