diff options
author | smatz <smatz@openttd.org> | 2011-02-08 18:34:13 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2011-02-08 18:34:13 +0000 |
commit | 887a7724dc3f68cdd3d0c566c66adf00696e4bc0 (patch) | |
tree | 00a9055a6bc84b0f9d278e3a8faac022dd0a3778 /src/engine.cpp | |
parent | 364ef8e6e6342f8f777da561571422c8c57c402b (diff) | |
download | openttd-887a7724dc3f68cdd3d0c566c66adf00696e4bc0.tar.xz |
(svn r22025) -Fix: verify there is enough space in the pool when creating new pool items while loading old savegames
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index d08fbef32..8774b0b3e 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -497,6 +497,9 @@ void SetCachedEngineCounts() } } +/** + * Initialise the engine pool with the data from the original vehicles. + */ void SetupEngines() { DeleteWindowByClass(WC_ENGINE_PREVIEW); @@ -506,6 +509,9 @@ void SetupEngines() const EngineIDMapping *end = _engine_mngr.End(); uint index = 0; for (const EngineIDMapping *eid = _engine_mngr.Begin(); eid != end; eid++, index++) { + /* 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); assert(e->index == index); } |