diff --git a/roadveh.h b/roadveh.h new file mode 100644 index 0000000000..9d5800e6da --- /dev/null +++ b/roadveh.h @@ -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; +} diff --git a/roadveh_gui.c b/roadveh_gui.c index 3040e05d7a..3befa2be91 100644 --- a/roadveh_gui.c +++ b/roadveh_gui.c @@ -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 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e) 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);