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

Method ResetToCurrentNewGRFConfig

src/engine.cpp:584–595  ·  view source on GitHub ↗

* 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. * @return false if resetting failed due to present vehicles. */

Source from the content-addressed store, hash-verified

582 * @return false if resetting failed due to present vehicles.
583 */
584bool EngineOverrideManager::ResetToCurrentNewGRFConfig()
585{
586 for (const Vehicle *v : Vehicle::Iterate()) {
587 if (IsCompanyBuildableVehicleType(v)) return false;
588 }
589
590 /* Reset the engines, they will get new EngineIDs */
591 _engine_mngr.ResetToDefaultMapping();
592 ReloadNewGRFData();
593
594 return true;
595}
596
597/**
598 * Initialise the engine pool with the data from the original vehicles.

Callers

nothing calls this directly

Calls 3

ReloadNewGRFDataFunction · 0.85
ResetToDefaultMappingMethod · 0.80

Tested by

no test coverage detected