@@ -209,25 +209,24 @@ public:
void ResetOverride();
void ResetMapping();
void Add(uint8 local_id, uint32 grfid, uint entity_type);
virtual uint16 AddEntityID(byte grf_local_id, uint32 grfid, byte substitute_id);
uint32 GetGRFID(uint16 entity_id) const;
uint16 GetSubstituteID(uint16 entity_id) const;
virtual uint16 GetID(uint8 grf_local_id, uint32 grfid) const;
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; }
};
struct HouseSpec;
class HouseOverrideManager : public OverrideManagerBase {
public:
HouseOverrideManager(uint16 offset, uint16 maximum, uint16 invalid) :
OverrideManagerBase(offset, maximum, invalid) {}
void SetEntitySpec(const HouseSpec *hs);
@@ -21,25 +21,26 @@ static const SaveLoad _newgrf_mapping_de
SLE_VAR(EntityIDMapping, entity_id, SLE_UINT8),
SLE_VAR(EntityIDMapping, substitute_id, SLE_UINT8),
SLE_END()
/**
* Save a GRF ID + local id -> OpenTTD's id mapping.
* @param mapping The mapping to save.
*/
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);
}
* Load a GRF ID + local id -> OpenTTD's id mapping.
* @param mapping The mapping to load.
void Load_NewGRFMapping(OverrideManagerBase &mapping)
/* Clear the current mapping stored.
Status change: