From: Mikko Rasa Date: Sat, 19 Feb 2011 06:45:28 +0000 (+0000) Subject: Copy speed only if the preceding train is active X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=1efb7d0debe9e6e9b480eb16381c1b90d0fb7d17;p=r2c2.git Copy speed only if the preceding train is active --- diff --git a/source/libr2c2/aicontrol.cpp b/source/libr2c2/aicontrol.cpp index d1a69aa..59126d8 100644 --- a/source/libr2c2/aicontrol.cpp +++ b/source/libr2c2/aicontrol.cpp @@ -124,7 +124,7 @@ void AIControl::tick(const Time::TimeDelta &dt) speed_limit = 0; else if(state==APPROACH) speed_limit = approach_speed; - else if(state==FOLLOW) + else if(state==FOLLOW && train.get_preceding_train()->is_active()) speed_limit = train.get_preceding_train()->get_speed(); if(speed_limit>=0 && target_speed.value>speed_limit)