summaryrefslogtreecommitdiff
path: root/src/newgrf_engine.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-12-13 15:59:25 +0000
committersmatz <smatz@openttd.org>2008-12-13 15:59:25 +0000
commit3cd29575445a7f4b9861f6f80d209244bf58a608 (patch)
treef7d53055629d646fc78ce07c0d156d85e17b6d46 /src/newgrf_engine.cpp
parent0bf775a20a4cd232e13e13f215bb6894b209acd7 (diff)
downloadopenttd-3cd29575445a7f4b9861f6f80d209244bf58a608.tar.xz
(svn r14669) -Codechange: use SmallVector instead of std::list at one place
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r--src/newgrf_engine.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 4679f2b7e..f7a0587fd 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -28,6 +28,7 @@
#include "rail.h"
#include "settings_type.h"
#include "aircraft.h"
+#include "core/smallvec_type.hpp"
#include <map>
@@ -1086,15 +1087,14 @@ struct ListOrderChange {
EngineID target;
};
-static std::list<ListOrderChange> _list_order_changes;
+static SmallVector<ListOrderChange, 16> _list_order_changes;
void AlterVehicleListOrder(EngineID engine, EngineID target)
{
/* Add the list order change to a queue */
- ListOrderChange loc;
- loc.engine = engine;
- loc.target = target;
- _list_order_changes.push_back(loc);
+ ListOrderChange *loc = _list_order_changes.Append();
+ loc->engine = engine;
+ loc->target = target;
}
void CommitVehicleListOrderChanges()
@@ -1103,8 +1103,8 @@ void CommitVehicleListOrderChanges()
typedef std::map<uint16, Engine*> ListPositionMap;
ListPositionMap lptr_map;
- std::list<ListOrderChange>::iterator it;
- for (it = _list_order_changes.begin(); it != _list_order_changes.end(); ++it) {
+ const ListOrderChange *end = _list_order_changes.End();
+ for (const ListOrderChange *it = _list_order_changes.Begin(); it != end; ++it) {
EngineID engine = it->engine;
EngineID target = it->target;
@@ -1139,5 +1139,5 @@ void CommitVehicleListOrderChanges()
}
/* Clear out the queue */
- _list_order_changes.clear();
+ _list_order_changes.Reset();
}