|
OpenTTD Source 20260711-master-g3fb3006dff
|
Stores the mapping of EngineID to the internal id of newgrfs. More...
#include <engine_base.h>
Public Member Functions | |
| void | ResetToDefaultMapping () |
| Initializes the EngineOverrideManager with the default engines. | |
| EngineID | GetID (VehicleType type, uint16_t grf_local_id, GrfID grfid) |
| Looks up an EngineID in the EngineOverrideManager. | |
| EngineID | UseUnreservedID (VehicleType type, uint16_t grf_local_id, GrfID grfid, bool static_access) |
| Look for an unreserved EngineID matching the local id, and reserve it if found. | |
| void | SetID (VehicleType type, uint16_t grf_local_id, GrfID grfid, uint8_t substitute_id, EngineID engine) |
| Create an override to the given engine. | |
Static Public Member Functions | |
| static bool | ResetToCurrentNewGRFConfig () |
| Tries to reset the engine mapping to match the current NewGRF configuration. | |
Data Fields | |
| VehicleTypeIndexArray< std::vector< EngineIDMapping > > | mappings |
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 reset in different cases.
Definition at line 248 of file engine_base.h.
| EngineID EngineOverrideManager::GetID | ( | VehicleType | type, |
| uint16_t | grf_local_id, | ||
| GrfID | grfid ) |
Looks up an EngineID in the EngineOverrideManager.
| 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 dynamic_engines is disabled, all newgrf share the same ID scope identified by INVALID_GRFID. |
Definition at line 556 of file engine.cpp.
References EngineIDMapping::Key().
|
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.
Definition at line 619 of file engine.cpp.
References IsCompanyBuildableVehicleType(), and ReloadNewGRFData().
Referenced by CheckDynamicEngines(), ConResetEnginePool(), OnStartScenario(), and ResetLandscapeConfirmationCallback().
| void EngineOverrideManager::ResetToDefaultMapping | ( | ) |
Initializes the EngineOverrideManager with the default engines.
Definition at line 535 of file engine.cpp.
References CompanyEnd, GetOriginalEngineCount(), and INVALID_GRFID.
| void EngineOverrideManager::SetID | ( | VehicleType | type, |
| uint16_t | grf_local_id, | ||
| GrfID | grfid, | ||
| uint8_t | substitute_id, | ||
| EngineID | engine ) |
Create an override to the given engine.
If the override already exists, it will be overwritten.
| type | The vehicle type. |
| grf_local_id | The NewGRF internal identifier. |
| grfid | The unique identifier of the NewGRF. |
| substitute_id | The fallback original engine. |
| engine | The engine this override is for. |
Definition at line 602 of file engine.cpp.
References EngineIDMapping::Key().
| EngineID EngineOverrideManager::UseUnreservedID | ( | VehicleType | type, |
| uint16_t | grf_local_id, | ||
| GrfID | grfid, | ||
| bool | static_access ) |
Look for an unreserved EngineID matching the local id, and reserve it if found.
| 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 dynamic_engines is disabled, all newgrf share the same ID scope identified by INVALID_GRFID. |
| static_access | Whether to actually reserve the EngineID. |
Definition at line 575 of file engine.cpp.
References INVALID_GRFID, EngineIDMapping::Key(), EngineIDMapping::Key(), and Slide().
| VehicleTypeIndexArray<std::vector<EngineIDMapping> > EngineOverrideManager::mappings |
Definition at line 249 of file engine_base.h.