summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-02-06 09:29:56 +0000
committerrubidium <rubidium@openttd.org>2007-02-06 09:29:56 +0000
commitec301e0f8a27a3892375c46dfde4a642ce3d8169 (patch)
treeaf517dd622705d56db96c55bde382355bf3c21b6 /src
parent69d4888c290e0b7de3b2c988cb096a2e95b5e53e (diff)
downloadopenttd-ec301e0f8a27a3892375c46dfde4a642ce3d8169.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/roadveh_cmd.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index b07a81887..3edb3ca9d 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1330,8 +1330,9 @@ static void RoadVehController(Vehicle *v)
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;
}