From ac3bd4db7b4d639488e05dab7d8316182f5368c7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sat, 26 Jan 2013 22:30:19 +0200 Subject: [PATCH] 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. --- source/libr2c2/vehicle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.45.2