summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-31 22:15:19 +0000
committerrubidium <rubidium@openttd.org>2007-10-31 22:15:19 +0000
commit6fe325ae7f10931a9da2199697ce02cd77bf6174 (patch)
treec76bf6479f3c2a66b5992b2c8af1cefb9eb9bb41 /src
parent3a7c8cc88d0fb4b3135979a45effc1bf7ac51fad (diff)
downloadopenttd-6fe325ae7f10931a9da2199697ce02cd77bf6174.tar.xz
(svn r11367) -Fix [FS#1258]: non-articulated road vehicles should be able to overtake (not-too-long) articulated vehicles, i.e. overtaking of articulated vehicles that are several (3+) tiles long is not supported.
Diffstat (limited to 'src')
-rw-r--r--src/roadveh_cmd.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 542cd3f73..d42e639c8 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1015,7 +1015,7 @@ static void* EnumFindVehToOvertake(Vehicle* v, void* data)
const OvertakeData* od = (OvertakeData*)data;
return
- v->tile == od->tile && v->type == VEH_ROAD && v != od->u && v != od->v ?
+ v->tile == od->tile && v->type == VEH_ROAD && v->First() == v && v != od->u && v != od->v ?
v : NULL;
}
@@ -1465,8 +1465,8 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
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;
+ if (u != NULL && u->First()->cur_speed < v->cur_speed) {
+ v->cur_speed = u->First()->cur_speed;
return false;
}
@@ -1663,6 +1663,7 @@ again:
Vehicle* u = RoadVehFindCloseTo(v, x, y, new_dir);
if (u != NULL) {
+ u = u->First();
/* There is a vehicle in front overtake it if possible */
if (v->u.road.overtaking == 0) RoadVehCheckOvertake(v, u);
if (v->u.road.overtaking == 0) v->cur_speed = u->cur_speed;