]> git.tdb.fi Git - r2c2.git/commitdiff
Copy speed only if the preceding train is active
authorMikko Rasa <tdb@tdb.fi>
Sat, 19 Feb 2011 06:45:28 +0000 (06:45 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sat, 19 Feb 2011 06:45:28 +0000 (06:45 +0000)
source/libr2c2/aicontrol.cpp

index d1a69aac11f04717d10d13c4e5fea365ec8d7cba..59126d8505b193cafea380401b5c7db0edf3ffc4 100644 (file)
@@ -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)