# IndustryOverrideManager Class Reference

Inheritance diagram for IndustryOverrideManager:

## Public Member Functions
| IndustryOverrideManager (uint16 offset, uint16 maximum, uint16 invalid)
virtual uint16 | AddEntityID (byte grf_local_id, uint32 grfid, byte substitute_id)
| Method to find an entity ID and to mark it as reserved for the Industry to be included.
virtual uint16 | GetID (uint8 grf_local_id, uint32 grfid)
| Return the ID (if ever available) of a previously inserted entity.
void | SetEntitySpec (IndustrySpec *inds)
| Method to install the new indistry data in its proper slot The slot assigment is internal of this method, since it requires checking what is available.

## Detailed Description

Definition at line 78 of file newgrf_commons.h.

## Member Function Documentation

uint16 IndustryOverrideManager::AddEntityID | ( | byte | grf_local_id,
|  | uint32 | grfid,
|  | byte | substitute_id |
| ) |  |  | `[virtual]`

Method to find an entity ID and to mark it as reserved for the Industry to be included.

Parameters:

  | grf_local_id | ID used by the grf file for pre-installation work (equivalent of TTDPatch's setid
  | grfid | ID of the current grf file
  | substitute_id | industry from which data has been copied

Returns:
  a free entity id (slotid) if ever one has been found, or Invalid_ID marker otherwise

Reimplemented from OverrideManagerBase.

Definition at line 195 of file newgrf_commons.cpp.

References IndustrySpec::enabled, EntityIDMapping::entity_id, GetIndustrySpec(), IndustrySpec::grf_prop, GRFFileProps::grffile, EntityIDMapping::grfid, OverrideManagerBase::invalid_ID, OverrideManagerBase::mapping_ID, OverrideManagerBase::max_new_entities, OverrideManagerBase::max_offset, and EntityIDMapping::substitute_id.

Referenced by SetEntitySpec().

uint16 IndustryOverrideManager::GetID | ( | uint8 | grf_local_id,
|  | uint32 | grfid |
| ) |  |  | `[virtual]`

Return the ID (if ever available) of a previously inserted entity.

Parameters:

  | grf_local_id | ID of this enity withing the grfID
  | grfid | ID of the grf file

Returns:
  the ID of the candidate, of the Invalid flag item ID

Reimplemented from OverrideManagerBase.

Definition at line 176 of file newgrf_commons.cpp.

References OverrideManagerBase::invalid_ID, and OverrideManagerBase::max_offset.

Referenced by SetEntitySpec().

void IndustryOverrideManager::SetEntitySpec | ( | IndustrySpec * | inds | ) |

Method to install the new indistry data in its proper slot The slot assigment is internal of this method, since it requires checking what is available.

Parameters:

  | inds | Industryspec that comes from the grf decoding process

Definition at line 229 of file newgrf_commons.cpp.

References AddEntityID(), IndustrySpec::enabled, GetID(), IndustrySpec::grf_prop, GRFFileProps::grffile, grfmsg(), OverrideManagerBase::invalid_ID, GRFFileProps::local_id, and GRFFileProps::override.

Referenced by FinaliseIndustriesArray().

The documentation for this class was generated from the following files:

- src/newgrf_commons.h
- src/newgrf_commons.cpp