(svn r22025) -Fix: verify there is enough space in the pool when creating new pool items while loading old savegames
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user