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

(cherry picked from commit 3d9436bd75)
pull/259/head
PeterN 3 years ago committed by Jonathan G Rennison
parent 457b4f80b6
commit 66cac92028

@ -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; }
};

@ -31,7 +31,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);
SlSetLength(4 + 1 + 1);
SlObjectSaveFiltered(&mapping.mapping_ID[i], _newgrf_mapping_desc); // _newgrf_mapping_desc has no conditionals

Loading…
Cancel
Save