summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-05 20:41:13 +0000
committerfrosch <frosch@openttd.org>2011-02-05 20:41:13 +0000
commitef3ec0f8c83567f0fce799270ea2e43ab7bb8cb0 (patch)
tree15ad2600b7a156154ccd87decd68b68315eb1836 /src/engine.cpp
parentfaa2a26ae15d6a8cf986059ed504b3371e6c3e37 (diff)
downloadopenttd-ef3ec0f8c83567f0fce799270ea2e43ab7bb8cb0.tar.xz
(svn r21987) -Fix: Make news items, engine previews and AI preview events deal with no longer existing Engine items after resetting the pool.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index 2a6183d7e..d08fbef32 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -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);