(svn r5280) -Backport: r5119 0.4
authortron
Thu, 15 Jun 2006 14:34:31 +0000
branch0.4
changeset 10034 76c349a8330a
parent 10033 cce7f27e214d
child 10035 23985f53225c
(svn r5280) -Backport: r5119
-Fix: If a road vehicle is on a road depot tile and stopped doesn't mean it's in the depot. Use the proper test for this
roadveh.h
roadveh_gui.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/roadveh.h	Thu Jun 15 14:34:31 2006 +0000
@@ -0,0 +1,15 @@
+/* $Id$ */
+
+#include "vehicle.h"
+
+
+static inline bool IsRoadVehInDepot(const Vehicle* v)
+{
+	assert(v->type == VEH_Road);
+	return v->u.road.state == 254;
+}
+
+static inline bool IsRoadVehInDepotStopped(const Vehicle* v)
+{
+	return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED;
+}
--- a/roadveh_gui.c	Thu Jun 15 14:16:57 2006 +0000
+++ b/roadveh_gui.c	Thu Jun 15 14:34:31 2006 +0000
@@ -4,6 +4,7 @@
 #include "openttd.h"
 #include "debug.h"
 #include "functions.h"
+#include "roadveh.h"
 #include "table/sprites.h"
 #include "table/strings.h"
 #include "map.h"
@@ -330,7 +331,7 @@
 			Vehicle *v;
 			uint32 h;
 			v = GetVehicle(w->window_number);
-			h = IsTileDepotType(v->tile, TRANSPORT_ROAD) && (v->vehstatus&VS_STOPPED) ? (1<< 7) : (1 << 11);
+			h = IsRoadVehInDepotStopped(v) ? 1 << 7 : 1 << 11;
 			if (h != w->hidden_state) {
 				w->hidden_state = h;
 				SetWindowDirty(w);