summaryrefslogtreecommitdiff
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
commit2918fab68d1a37c0a342dfae4a2bfa350facaf8b (patch)
treeaf517dd622705d56db96c55bde382355bf3c21b6
parent8c3793a088091ab29fc99e40fb4a06e5e37c67bf (diff)
downloadopenttd-2918fab68d1a37c0a342dfae4a2bfa350facaf8b.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.
-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;
}