]> git.tdb.fi Git - r2c2.git/commitdiff
Don't return indeterminate paths from Route::get_path
authorMikko Rasa <tdb@tdb.fi>
Thu, 10 Apr 2014 19:49:52 +0000 (22:49 +0300)
committerMikko Rasa <tdb@tdb.fi>
Thu, 10 Apr 2014 19:53:43 +0000 (22:53 +0300)
Return the active path of the track instead.

source/libr2c2/route.cpp

index be4237d10bddb875f84d172a0a7f98cb1c3b8a55..5ee30e033161030fa31a8f558f50e7f4a3b9aaea 100644 (file)
@@ -218,7 +218,7 @@ unsigned Route::get_path(Track &trk) const
        if(trk.get_type().is_turnout())
        {
                map<unsigned, int>::const_iterator i = turnouts.find(trk.get_turnout_address());
-               if(i!=turnouts.end())
+               if(i!=turnouts.end() && i->second>=0)
                        return i->second;
        }
        return trk.get_active_path();