mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 02:19:41 +00:00
Codechange: Don't save unused NewGRF override mappings. (#9202)
This commit is contained in:
parent
881e1da51d
commit
69e5da0b54
@ -218,6 +218,7 @@ public:
|
|||||||
|
|
||||||
inline uint16 GetMaxMapping() const { return max_new_entities; }
|
inline uint16 GetMaxMapping() const { return max_new_entities; }
|
||||||
inline uint16 GetMaxOffset() const { return max_offset; }
|
inline uint16 GetMaxOffset() const { return max_offset; }
|
||||||
|
inline bool IsValidID(uint16 entity_id) const { return entity_overrides[entity_id] != invalid_ID; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ static const SaveLoad _newgrf_mapping_desc[] = {
|
|||||||
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
|
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < mapping.GetMaxMapping(); i++) {
|
for (uint i = 0; i < mapping.GetMaxMapping(); i++) {
|
||||||
|
if (!mapping.IsValidID(i)) continue;
|
||||||
SlSetArrayIndex(i);
|
SlSetArrayIndex(i);
|
||||||
SlObject(&mapping.mapping_ID[i], _newgrf_mapping_desc);
|
SlObject(&mapping.mapping_ID[i], _newgrf_mapping_desc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user