From: Mikko Rasa Date: Sat, 26 Jan 2013 20:30:19 +0000 (+0200) Subject: Set vehicle position from reference if it has no track X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=ac3bd4db7b4d639488e05dab7d8316182f5368c7;p=r2c2.git Set vehicle position from reference if it has no track This only became apparent when I happened to park a train near the origin and the program went into an infinite loop while loading the layout. --- diff --git a/source/libr2c2/vehicle.cpp b/source/libr2c2/vehicle.cpp index 1699fd8..4259c7d 100644 --- a/source/libr2c2/vehicle.cpp +++ b/source/libr2c2/vehicle.cpp @@ -200,7 +200,7 @@ void Vehicle::update_position_from(const Vehicle &veh) float margin = layout.get_catalogue().get_scale(); float dist = distance(veh.position, position); - if(disttdist+margin) + if(!track_pos.track || disttdist+margin) { track_pos = veh.track_pos; track_pos.advance(sign*tdist);