summaryrefslogtreecommitdiff
path: root/vehicle.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-08-14 22:34:43 +0000
committerDarkvater <Darkvater@openttd.org>2006-08-14 22:34:43 +0000
commitfe811fd8cddb8936e045fd5b09b60d92a8824e48 (patch)
tree4550d453f646bee481126343fcd3b388360f5ca7 /vehicle.c
parent10a2a0013888bc9a59306c2bfbaef49b13bbd454 (diff)
downloadopenttd-fe811fd8cddb8936e045fd5b09b60d92a8824e48.tar.xz
(svn r5898) -Fix [FS#249]: Bugfix: Goto Depot not always working for road vehicles. (mart3p)
Diffstat (limited to 'vehicle.c')
-rw-r--r--vehicle.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/vehicle.c b/vehicle.c
index 611ae95ca..9eb997a36 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -2051,6 +2051,10 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
if (IsRoadStopTile(v->tile)) /* We'll assume the road vehicle is facing outwards */
return DiagdirToDiagTrackdir(GetRoadStopDir(v->tile)); /* Road vehicle in a station */
+ /* If vehicle's state is a valid track direction (vehicle is not turning around) return it */
+ if ((v->u.road.state & 7) < 6) return v->u.road.state;
+
+ /* Vehicle is turning around, get the direction from vehicle's direction */
return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));
/* case VEH_Aircraft: case VEH_Special: case VEH_Disaster: */