| 565 | } |
| 566 | |
| 567 | void 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. |
no test coverage detected