MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetID

Method GetID

src/newgrf_commons.cpp:91–101  ·  view source on GitHub ↗

* Return the ID (if ever available) of a previously inserted entity. * @param grf_local_id ID of this entity within the grfID * @param grfid ID of the grf file * @return the ID of the candidate, of the Invalid flag item ID */

Source from the content-addressed store, hash-verified

89 * @return the ID of the candidate, of the Invalid flag item ID
90 */
91uint16_t OverrideManagerBase::GetID(uint16_t grf_local_id, uint32_t grfid) const
92{
93 for (uint16_t id = 0; id < this->max_entities; id++) {
94 const EntityIDMapping *map = &this->mappings[id];
95 if (map->entity_id == grf_local_id && map->grfid == grfid) {
96 return id;
97 }
98 }
99
100 return this->invalid_id;
101}
102
103/**
104 * Reserves a place in the mapping array for an entity to be installed

Callers 2

AddEntityIDMethod · 0.95
SetEntitySpecMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected