(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
This commit is contained in:
tron 2006-06-15 14:34:31 +00:00
parent af0354ad24
commit a8d2aa157a
2 changed files with 17 additions and 1 deletions

15
roadveh.h Normal file
View File

@ -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;
}

View File

@ -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);