diff options
author | Henry Wilson <m3henry@googlemail.com> | 2019-02-17 11:20:52 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-26 20:15:57 +0000 |
commit | ab711e6942757d775c08c31a6c32d488feba1dba (patch) | |
tree | d102dc6d0e6b9c33e7205b63e3360ebd720a3ebb /src/engine.cpp | |
parent | 297fd3dda3abe353ebe2fe77c67b011e24d403bc (diff) | |
download | openttd-ab711e6942757d775c08c31a6c32d488feba1dba.tar.xz |
Codechange: Replaced SmallVector::[Begin|End]() with std alternatives
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 7412ec639..044faa571 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -511,12 +511,12 @@ void EngineOverrideManager::ResetToDefaultMapping() */ EngineID EngineOverrideManager::GetID(VehicleType type, uint16 grf_local_id, uint32 grfid) { - const EngineIDMapping *end = this->End(); EngineID index = 0; - for (const EngineIDMapping *eid = this->Begin(); eid != end; eid++, index++) { - if (eid->type == type && eid->grfid == grfid && eid->internal_id == grf_local_id) { + for (const EngineIDMapping &eid : *this) { + if (eid.type == type && eid.grfid == grfid && eid.internal_id == grf_local_id) { return index; } + index++; } return INVALID_ENGINE; } @@ -549,14 +549,14 @@ void SetupEngines() _engine_pool.CleanPool(); assert(_engine_mngr.size() >= _engine_mngr.NUM_DEFAULT_ENGINES); - const EngineIDMapping *end = _engine_mngr.End(); uint index = 0; - for (const EngineIDMapping *eid = _engine_mngr.Begin(); eid != end; eid++, index++) { + for (const EngineIDMapping &eid : _engine_mngr) { /* Assert is safe; there won't be more than 256 original vehicles * in any case, and we just cleaned the pool. */ assert(Engine::CanAllocateItem()); - const Engine *e = new Engine(eid->type, eid->internal_id); + const Engine *e = new Engine(eid.type, eid.internal_id); assert(e->index == index); + index++; } } |