(svn r8609) -Fix: a road vehicle that is very close after another (slower) road vehicle gets its speed reset to 0 when entering a tunnel, which causes a traffic jam outside of the tunnel.
authorrubidium
Tue, 06 Feb 2007 09:29:56 +0000
changeset 6194 3d84c2b85f3d
parent 6193 71f42ac93928
child 6195 b90cf92697b9
(svn r8609) -Fix: a road vehicle that is very close after another (slower) road vehicle gets its speed reset to 0 when entering a tunnel, which causes a traffic jam outside of the tunnel.
src/roadveh_cmd.cpp
--- a/src/roadveh_cmd.cpp	Tue Feb 06 09:25:52 2007 +0000
+++ b/src/roadveh_cmd.cpp	Tue Feb 06 09:29:56 2007 +0000
@@ -1330,8 +1330,9 @@
 
 		GetNewVehiclePos(v, &gp);
 
-		if (RoadVehFindCloseTo(v, gp.x, gp.y, v->direction) != NULL) {
-			v->cur_speed = 0;
+		const Vehicle *u = RoadVehFindCloseTo(v, gp.x, gp.y, v->direction);
+		if (u != NULL && u->cur_speed < v->cur_speed) {
+			v->cur_speed = u->cur_speed;
 			return;
 		}