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

Method ResetToDefaultMapping

src/engine.cpp:508–518  ·  view source on GitHub ↗

* Initializes the #EngineOverrideManager with the default engines. */

Source from the content-addressed store, hash-verified

506 * Initializes the #EngineOverrideManager with the default engines.
507 */
508void EngineOverrideManager::ResetToDefaultMapping()
509{
510 EngineID id = EngineID::Begin();
511 for (VehicleType type = VEH_TRAIN; type <= VEH_AIRCRAFT; type++) {
512 auto &map = this->mappings[type];
513 map.clear();
514 for (uint internal_id = 0; internal_id < _engine_counts[type]; internal_id++, ++id) {
515 map.emplace_back(INVALID_GRFID, internal_id, type, internal_id, id);
516 }
517 }
518}
519
520/**
521 * Looks up an EngineID in the EngineOverrideManager

Callers 2

Calls 2

BeginFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected