changeset 5943:375985ba9c32 draft

(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.
author rubidium <rubidium@openttd.org>
date Tue, 06 Feb 2007 09:29:56 +0000
parents 95c1ea04b01d
children ca95cde4d1b4
files src/roadveh_cmd.cpp
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -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;
 		}