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.
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.
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.
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.
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.
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.
Instead of falling back to bitnum lookup or climate-dependent cargo types, install a default cargo translation table that performs either of these functions instead.
This allows better mapping of climate-dependent or bitnum cargo slots, falling back to INVALID_CARGO if they are not defined, and reduces special-casing.
* Codechange: Add AssignBit function to assign the value of a single bit
* Codechange: Replace various uses of SB with AssignBit
* Codechange: Replace various uses of SB with a constant with SetBit
Properties 11, 14 and 15 to set pylons/nowires/blocked intrinsically only support 8 station tiles.
Add new property to define all three flags for each station tile layout.
Allow using up to 256 tile layouts in property 0E or callback 24, which defines the layout to be saved into the map.
This was originally limited to 8, because station graphics above 8 referred to other station types but that was changed in 2007.
1) More efficient than using callback 14, as that needs to be checked every time a station tile is rendered.
2) The layout does not get changed when the station is changed (this may or may not be desirable!)
Using more than 256 layouts still requires callback 14.
NewGRFs only use a small subset of the available language IDs. Using an unordered_map allows only the reference languages to have space allocated.
This avoids manual new/delete of array.
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.
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.
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.
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.
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.
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.