OpenTTD Source 20241224-master-gee860a5c8e
EntityIDMapping Struct Reference

Maps an entity id stored on the map to a GRF file. More...

#include <newgrf_commons.h>

Data Fields

uint32_t grfid
 The GRF ID of the file the entity belongs to.
 
uint16_t entity_id
 The entity ID within the GRF file.
 
uint16_t substitute_id
 The (original) entity ID to use if this GRF is not available.
 

Detailed Description

Maps an entity id stored on the map to a GRF file.

Entities are objects used ingame (houses, industries, industry tiles) for which we need to correlate the ids from the grf files with the ones in the the savegames themselves. An array of EntityIDMapping structs is saved with the savegame so that those GRFs can be loaded in a different order, or removed safely. The index in the array is the entity's ID stored on the map.

The substitute ID is the ID of an original entity that should be used instead if the GRF containing the new entity is not available.

Definition at line 185 of file newgrf_commons.h.

Field Documentation

◆ entity_id

uint16_t EntityIDMapping::entity_id

The entity ID within the GRF file.

Definition at line 187 of file newgrf_commons.h.

Referenced by OverrideManagerBase::AddEntityID(), IndustryOverrideManager::AddEntityID(), and OverrideManagerBase::GetID().

◆ grfid

uint32_t EntityIDMapping::grfid

The GRF ID of the file the entity belongs to.

Definition at line 186 of file newgrf_commons.h.

Referenced by OverrideManagerBase::AddEntityID(), IndustryOverrideManager::AddEntityID(), and OverrideManagerBase::GetID().

◆ substitute_id

uint16_t EntityIDMapping::substitute_id

The (original) entity ID to use if this GRF is not available.

Definition at line 188 of file newgrf_commons.h.

Referenced by OverrideManagerBase::AddEntityID(), and IndustryOverrideManager::AddEntityID().


The documentation for this struct was generated from the following file: