|
OpenTTD Source 20260820-master-g39da062c0c
|
Public Member Functions | |
| OverrideManagerBase (uint16_t offset, uint16_t maximum, uint16_t invalid) | |
| Constructor of generic class. | |
| virtual | ~OverrideManagerBase ()=default |
| Ensure the destructor of the sub classes are called as well. | |
| void | ResetOverride () |
| Resets the override, which is used while initializing game. | |
| void | ResetMapping () |
| Resets the mapping, which is used while initializing game. | |
| void | Add (uint16_t local_id, GrfID grfid, uint entity_type) |
| Since the entity IDs defined by the GRF file does not necessarily correlate to those used by the game, the IDs used for overriding old entities must be translated when the entity spec is set. | |
| virtual uint16_t | AddEntityID (uint16_t grf_local_id, GrfID grfid, uint16_t substitute_id) |
| Reserves a place in the mapping array for an entity to be installed. | |
| GrfID | GetGRFID (uint16_t entity_id) const |
| Gives the GRFID of the file the entity belongs to. | |
| uint16_t | GetSubstituteID (uint16_t entity_id) const |
| Gives the substitute of the entity, as specified by the grf file. | |
| virtual uint16_t | GetID (uint16_t grf_local_id, GrfID grfid) const |
| Return the ID (if ever available) of a previously inserted entity. | |
| uint16_t | GetMaxMapping () const |
| uint16_t | GetMaxOffset () const |
Data Fields | |
| std::vector< EntityIDMapping > | mappings |
| mapping of ids from grf files. Public out of convenience | |
Protected Attributes | |
| std::vector< uint16_t > | entity_overrides |
| std::vector< GrfID > | grfid_overrides |
| const uint16_t | max_offset |
| what is the length of the original entity's array of specs | |
| const uint16_t | max_entities |
| what is the amount of entities, old and new summed | |
| const uint16_t | invalid_id |
| ID used to detected invalid entities. | |
Definition at line 200 of file newgrf_commons.h.
| OverrideManagerBase::OverrideManagerBase | ( | uint16_t | offset, |
| uint16_t | maximum, | ||
| uint16_t | invalid ) |
Constructor of generic class.
| offset | end of original data for this entity. i.e: houses = 110 |
| maximum | of entities this manager can deal with. i.e: houses = 512 |
| invalid | is the ID used to identify an invalid entity id |
Definition at line 40 of file newgrf_commons.cpp.
References invalid_id, mappings, max_entities, and max_offset.
| void OverrideManagerBase::Add | ( | uint16_t | local_id, |
| GrfID | grfid, | ||
| uint | entity_type ) |
Since the entity IDs defined by the GRF file does not necessarily correlate to those used by the game, the IDs used for overriding old entities must be translated when the entity spec is set.
| local_id | ID in grf file |
| grfid | ID of the grf file |
| entity_type | original entity type |
Definition at line 57 of file newgrf_commons.cpp.
References invalid_id, and max_offset.
|
virtual |
Reserves a place in the mapping array for an entity to be installed.
| grf_local_id | is an arbitrary id given by the grf's author. Also known as setid |
| grfid | is the id of the grf file itself |
| substitute_id | is the original entity from which data is copied for the new one |
Reimplemented in IndustryOverrideManager.
Definition at line 104 of file newgrf_commons.cpp.
References BaseLabel::Empty(), EntityIDMapping::entity_id, GetID(), EntityIDMapping::grfid, invalid_id, mappings, max_entities, max_offset, and EntityIDMapping::substitute_id.
Referenced by HouseOverrideManager::SetEntitySpec(), and ObjectOverrideManager::SetEntitySpec().
| GrfID OverrideManagerBase::GetGRFID | ( | uint16_t | entity_id | ) | const |
Gives the GRFID of the file the entity belongs to.
| entity_id | ID of the entity being queried. |
Definition at line 134 of file newgrf_commons.cpp.
References mappings.
|
virtual |
Return the ID (if ever available) of a previously inserted entity.
| grf_local_id | ID of this entity within the grfID |
| grfid | ID of the grf file |
Reimplemented in IndustryOverrideManager.
Definition at line 85 of file newgrf_commons.cpp.
References EntityIDMapping::entity_id, EntityIDMapping::grfid, invalid_id, mappings, and max_entities.
Referenced by AddEntityID(), IndustryOverrideManager::GetID(), and ObjectOverrideManager::SetEntitySpec().
|
inline |
Definition at line 226 of file newgrf_commons.h.
|
inline |
Definition at line 227 of file newgrf_commons.h.
| uint16_t OverrideManagerBase::GetSubstituteID | ( | uint16_t | entity_id | ) | const |
Gives the substitute of the entity, as specified by the grf file.
| entity_id | of the entity being queried |
Definition at line 144 of file newgrf_commons.cpp.
References mappings.
| void OverrideManagerBase::ResetMapping | ( | ) |
Resets the mapping, which is used while initializing game.
Definition at line 67 of file newgrf_commons.cpp.
References mappings.
| void OverrideManagerBase::ResetOverride | ( | ) |
Resets the override, which is used while initializing game.
Definition at line 73 of file newgrf_commons.cpp.
|
protected |
Definition at line 202 of file newgrf_commons.h.
|
protected |
Definition at line 203 of file newgrf_commons.h.
|
protected |
ID used to detected invalid entities.
Definition at line 207 of file newgrf_commons.h.
Referenced by Add(), IndustryOverrideManager::AddEntityID(), AddEntityID(), IndustryOverrideManager::GetID(), GetID(), OverrideManagerBase(), HouseOverrideManager::SetEntitySpec(), IndustryOverrideManager::SetEntitySpec(), and ObjectOverrideManager::SetEntitySpec().
| std::vector<EntityIDMapping> OverrideManagerBase::mappings |
mapping of ids from grf files. Public out of convenience
Definition at line 210 of file newgrf_commons.h.
Referenced by IndustryOverrideManager::AddEntityID(), AddEntityID(), GetGRFID(), GetID(), GetSubstituteID(), OverrideManagerBase(), and ResetMapping().
|
protected |
what is the amount of entities, old and new summed
Definition at line 206 of file newgrf_commons.h.
Referenced by IndustryOverrideManager::AddEntityID(), AddEntityID(), GetID(), and OverrideManagerBase().
|
protected |
what is the length of the original entity's array of specs
Definition at line 205 of file newgrf_commons.h.
Referenced by Add(), IndustryOverrideManager::AddEntityID(), AddEntityID(), IndustryOverrideManager::GetID(), OverrideManagerBase(), and HouseOverrideManager::SetEntitySpec().