1
0
Fork 0

Fix #9202: Invalid test for unset NewGRF override mapping. (#9226)

pull/9251/head
PeterN 2021-05-12 08:11:14 +01:00 committed by GitHub
parent c0a0d85d20
commit 3d9436bd75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -218,7 +218,6 @@ public:
inline uint16 GetMaxMapping() const { return max_new_entities; }
inline uint16 GetMaxOffset() const { return max_offset; }
inline bool IsValidID(uint16 entity_id) const { return entity_overrides[entity_id] != invalid_ID; }
};

View File

@ -30,7 +30,8 @@ static const SaveLoad _newgrf_mapping_desc[] = {
void Save_NewGRFMapping(const OverrideManagerBase &mapping)
{
for (uint i = 0; i < mapping.GetMaxMapping(); i++) {
if (!mapping.IsValidID(i)) continue;
if (mapping.mapping_ID[i].grfid == 0 &&
mapping.mapping_ID[i].entity_id == 0) continue;
SlSetArrayIndex(i);
SlObject(&mapping.mapping_ID[i], _newgrf_mapping_desc);
}