Mercurial > hg > openttd
changeset 7816:e5c29f8ae0cd draft
(svn r11366) -Fix [FS#1258]: road vehicles must not drive through eachother on bridges/in tunnels.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Wed, 31 Oct 2007 22:13:41 +0000 |
parents | a7db3577709b |
children | 3de6e9f27233 |
files | src/roadveh_cmd.cpp |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -884,25 +884,30 @@ { RoadVehFindData rvf; Vehicle *u; + Vehicle *front = v->First(); - if (v->u.road.reverse_ctr != 0) return NULL; + if (front->u.road.reverse_ctr != 0) return NULL; rvf.x = x; rvf.y = y; rvf.dir = dir; rvf.veh = v; - u = (Vehicle*)VehicleFromPosXY(x, y, &rvf, EnumCheckRoadVehClose); + if (front->u.road.state == RVSB_WORMHOLE) { + u = (Vehicle*)VehicleFromPos(v->tile, &rvf, EnumCheckRoadVehClose); + } else { + u = (Vehicle*)VehicleFromPosXY(x, y, &rvf, EnumCheckRoadVehClose); + } /* This code protects a roadvehicle from being blocked for ever * If more than 1480 / 74 days a road vehicle is blocked, it will * drive just through it. The ultimate backup-code of TTD. * It can be disabled. */ if (u == NULL) { - v->u.road.blocked_ctr = 0; + front->u.road.blocked_ctr = 0; return NULL; } - if (++v->u.road.blocked_ctr > 1480) return NULL; + if (++front->u.road.blocked_ctr > 1480) return NULL; return u; }