(svn r5898) -Fix [FS#249]: Bugfix: Goto Depot not always working for road vehicles. (mart3p)
authorDarkvater
Mon, 14 Aug 2006 22:34:43 +0000
changeset 4270 923ac6b88dad
parent 4269 305543caee2c
child 4271 2428a4eb4f9e
(svn r5898) -Fix [FS#249]: Bugfix: Goto Depot not always working for road vehicles. (mart3p)
vehicle.c
--- a/vehicle.c	Mon Aug 14 22:23:13 2006 +0000
+++ b/vehicle.c	Mon Aug 14 22:34:43 2006 +0000
@@ -2051,6 +2051,10 @@
 			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: */