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

Method SetID

src/engine.cpp:567–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

565}
566
567void EngineOverrideManager::SetID(VehicleType type, uint16_t grf_local_id, uint32_t grfid, uint8_t substitute_id, EngineID engine)
568{
569 auto &map = this->mappings[type];
570 const auto key = EngineIDMapping::Key(grfid, grf_local_id);
571 auto it = std::ranges::lower_bound(map, key, std::less{}, EngineIDMappingKeyProjection{});
572 if (it == std::end(map) || it->Key() != key) {
573 map.emplace(it, grfid, grf_local_id, type, substitute_id, engine);
574 } else {
575 it->engine = engine;
576 }
577}
578
579/**
580 * Tries to reset the engine mapping to match the current NewGRF configuration.

Callers 2

GetNewEngineFunction · 0.80
LoadMethod · 0.80

Calls 2

KeyMethod · 0.80
endFunction · 0.50

Tested by

no test coverage detected