(svn r21987) -Fix: Make news items, engine previews and AI preview events deal with no longer existing Engine items after resetting the pool.

This commit is contained in:
frosch
2011-02-05 20:41:13 +00:00
parent faa2a26ae1
commit ef3ec0f8c8
6 changed files with 41 additions and 0 deletions

View File

@@ -499,6 +499,7 @@ void SetCachedEngineCounts()
void SetupEngines()
{
DeleteWindowByClass(WC_ENGINE_PREVIEW);
_engine_pool.CleanPool();
assert(_engine_mngr.Length() >= _engine_mngr.NUM_DEFAULT_ENGINES);
@@ -859,6 +860,9 @@ void EnginesMonthlyLoop()
CalcEngineReliability(e);
}
/* Do not introduce invalid engines */
if (!e->IsEnabled()) continue;
if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + DAYS_IN_YEAR)) {
/* Introduce it to all companies */
NewVehicleAvailable(e);