GRF: Extend EntityIDMapping/OverrideManagerBase to 16 bit entity IDs

This commit is contained in:
Jonathan G Rennison
2023-02-10 22:57:19 +00:00
parent 3396411b58
commit 43d58ce6c8
6 changed files with 31 additions and 28 deletions

View File

@@ -22,8 +22,8 @@ namespace upstream_sl {
/** Save and load the mapping between a spec and the NewGRF it came from. */
static const SaveLoad _newgrf_mapping_desc[] = {
SLE_VAR(EntityIDMapping, grfid, SLE_UINT32),
SLE_VAR(EntityIDMapping, entity_id, SLE_UINT8),
SLE_VAR(EntityIDMapping, substitute_id, SLE_UINT8),
SLE_VAR(EntityIDMapping, entity_id, SLE_FILE_U8 | SLE_VAR_U16),
SLE_VAR(EntityIDMapping, substitute_id, SLE_FILE_U8 | SLE_VAR_U16),
};
/**
@@ -31,14 +31,8 @@ static const SaveLoad _newgrf_mapping_desc[] = {
*/
void NewGRFMappingChunkHandler::Save() const
{
SlTableHeader(_newgrf_mapping_desc);
for (uint i = 0; i < this->mapping.GetMaxMapping(); i++) {
if (this->mapping.mappings[i].grfid == 0 &&
this->mapping.mappings[i].entity_id == 0) continue;
SlSetArrayIndex(i);
SlObject(&this->mapping.mappings[i], _newgrf_mapping_desc);
}
// removed
NOT_REACHED();
}
/**