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/newgrf_engine.cpp | |
parent | 297fd3dda3abe353ebe2fe77c67b011e24d403bc (diff) | |
download | openttd-ab711e6942757d775c08c31a6c32d488feba1dba.tar.xz |
Codechange: Replaced SmallVector::[Begin|End]() with std alternatives
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r-- | src/newgrf_engine.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 7a0bb04f3..0c7e4314b 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -1231,13 +1231,12 @@ void CommitVehicleListOrderChanges() FOR_ALL_ENGINES(e) { ordering.push_back(e->index); } - QSortT(ordering.Begin(), ordering.size(), EnginePreSort); + QSortT(ordering.data(), ordering.size(), EnginePreSort); /* Apply Insertion-Sort operations */ - const ListOrderChange *end = _list_order_changes.End(); - for (const ListOrderChange *it = _list_order_changes.Begin(); it != end; ++it) { - EngineID source = it->engine; - uint local_target = it->target; + for (const ListOrderChange &it : _list_order_changes) { + EngineID source = it.engine; + uint local_target = it.target; const EngineIDMapping *id_source = _engine_mngr.data() + source; if (id_source->internal_id == local_target) continue; @@ -1251,7 +1250,7 @@ void CommitVehicleListOrderChanges() assert(source_index >= 0 && target_index >= 0); assert(source_index != target_index); - EngineID *list = ordering.Begin(); + EngineID *list = ordering.data(); if (source_index < target_index) { --target_index; for (int i = source_index; i < target_index; ++i) list[i] = list[i + 1]; @@ -1263,10 +1262,10 @@ void CommitVehicleListOrderChanges() } /* Store final sort-order */ - const EngineID *idend = ordering.End(); uint index = 0; - for (const EngineID *it = ordering.Begin(); it != idend; ++it, ++index) { - Engine::Get(*it)->list_position = index; + for (const EngineID &eid : ordering) { + Engine::Get(eid)->list_position = index; + ++index; } /* Clear out the queue */ |