Public Member Functions | Static Public Member Functions | Static Public Attributes

# EngineOverrideManager Struct Reference

Stores the mapping of EngineID to the internal id of newgrfs. More...

`#include <engine_base.h>`

Inheritance diagram for EngineOverrideManager:

## Public Member Functions
void | ResetToDefaultMapping ()
| Initializes the EngineOverrideManager with the default engines.
EngineID | GetID (VehicleType type, uint16 grf_local_id, uint32 grfid)
| Looks up an EngineID in the EngineOverrideManager.
## Static Public Member Functions
static bool | ResetToCurrentNewGRFConfig ()
| Tries to reset the engine mapping to match the current NewGRF configuration.
## Static Public Attributes
static const uint | NUM_DEFAULT_ENGINES = _engine_counts[VEH_TRAIN] + _engine_counts[VEH_ROAD] + _engine_counts[VEH_SHIP] + _engine_counts[VEH_AIRCRAFT]
| Number of default entries.

## Detailed Description

Stores the mapping of EngineID to the internal id of newgrfs.

Note: This is not part of Engine, as the data in the EngineOverrideManager and the engine pool get resetted in different cases.

Definition at line 147 of file engine_base.h.

## Member Function Documentation

EngineID EngineOverrideManager::GetID | ( | VehicleType | type,
|  | uint16 | grf_local_id,
|  | uint32 | grfid |
| ) |  |  |

Looks up an EngineID in the EngineOverrideManager.

Parameters:

  | type | Vehicle type
  | grf_local_id | The local id in the newgrf
  | grfid | The GrfID that defines the scope of grf_local_id. If a newgrf overrides the engines of another newgrf, the "scope grfid" is the ID of the overridden newgrf. If dynnamic_engines is disabled, all newgrf share the same ID scope identified by INVALID_GRFID.

Returns:
  The engine ID if present, or INVALID_ENGINE if not.

Definition at line 493 of file engine.cpp.

References SmallVector< EngineIDMapping, 256 >::Begin(), SmallVector< EngineIDMapping, 256 >::End(), and INVALID_ENGINE.

Referenced by CommitVehicleListOrderChanges(), GetNewEngine(), and GetNewEngineID().

bool EngineOverrideManager::ResetToCurrentNewGRFConfig | ( |  | ) | `[static]`

Tries to reset the engine mapping to match the current NewGRF configuration.

This is only possible when there are currently no vehicles in the game.

Returns:
  false if resetting failed due to present vehicles.

Definition at line 510 of file engine.cpp.

References FOR_ALL_VEHICLES, IsCompanyBuildableVehicleType(), ReloadNewGRFData(), and ResetToDefaultMapping().

Referenced by ChangeDynamicEngines(), DEF_CONSOLE_CMD(), and ResetLandscapeConfirmationCallback().

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

- src/engine_base.h
- src/engine.cpp