(svn r11916) -Codechange: use enums from VehicleViewWindowWidgets instead of constants

-Fix: refit button widget was not correctly updated
This commit is contained in:
smatz 2008-01-18 13:02:47 +00:00
parent 68707808c0
commit 1d59439166
9 changed files with 61 additions and 65 deletions

View File

@ -537,7 +537,7 @@ CommandCost CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32
v->vehstatus ^= VS_STOPPED; v->vehstatus ^= VS_STOPPED;
v->cur_speed = 0; v->cur_speed = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClasses(WC_AIRCRAFT_LIST); InvalidateWindowClasses(WC_AIRCRAFT_LIST);
} }
@ -576,7 +576,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -586,7 +586,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++; if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++;
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} else { } else {
bool next_airport_has_hangar = true; bool next_airport_has_hangar = true;
@ -610,7 +610,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = next_airport_index; v->current_order.dest = next_airport_index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
if (v->u.air.state == FLYING && !next_airport_has_hangar) { if (v->u.air.state == FLYING && !next_airport_has_hangar) {
/* The aircraft is now heading for a different hangar than the next in the orders */ /* The aircraft is now heading for a different hangar than the next in the orders */
AircraftNextAirportPos_and_Order(v); AircraftNextAirportPos_and_Order(v);
@ -715,11 +715,11 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
// v->u.air.targetairport = st->index; // v->u.air.targetairport = st->index;
v->current_order.type = OT_GOTO_DEPOT; v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OFB_NON_STOP; v->current_order.flags = OFB_NON_STOP;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} else if (v->current_order.type == OT_GOTO_DEPOT) { } else if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
@ -941,7 +941,7 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) if (_patches.vehicle_speed)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
if (!(v->direction & 1)) spd = spd * 3 / 4; if (!(v->direction & 1)) spd = spd * 3 / 4;

View File

@ -314,7 +314,7 @@ CommandCost CmdStartStopRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32
v->vehstatus ^= VS_STOPPED; v->vehstatus ^= VS_STOPPED;
v->cur_speed = 0; v->cur_speed = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
} }
@ -486,7 +486,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -500,7 +500,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -518,7 +518,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = dep->index; v->current_order.dest = dep->index;
v->dest_tile = dep->xy; v->dest_tile = dep->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
@ -694,7 +694,7 @@ static void RoadVehCrash(Vehicle *v)
ClearSlot(v); ClearSlot(v);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
SetDParam(0, pass); SetDParam(0, pass);
AddNewsItem( AddNewsItem(
@ -963,7 +963,7 @@ static bool RoadVehAccelerate(Vehicle *v)
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) { if (_patches.vehicle_speed) {
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
@ -1892,7 +1892,7 @@ again:
} }
StartRoadVehSound(v); StartRoadVehSound(v);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
/* Check tile position conditions - i.e. stop position in depot, /* Check tile position conditions - i.e. stop position in depot,
@ -1983,7 +1983,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
if (v->current_order.type == OT_GOTO_DEPOT) { if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return; return;
} }
@ -2001,7 +2001,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
v->current_order.flags = OFB_NON_STOP; v->current_order.flags = OFB_NON_STOP;
v->current_order.dest = depot->index; v->current_order.dest = depot->index;
v->dest_tile = depot->xy; v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
void OnNewDay_RoadVeh(Vehicle *v) void OnNewDay_RoadVeh(Vehicle *v)

View File

@ -158,7 +158,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
if (v->current_order.type == OT_GOTO_DEPOT) { if (v->current_order.type == OT_GOTO_DEPOT) {
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return; return;
} }
@ -167,7 +167,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
v->current_order.flags = OFB_NON_STOP; v->current_order.flags = OFB_NON_STOP;
v->current_order.dest = depot->index; v->current_order.dest = depot->index;
v->dest_tile = depot->xy; v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
void OnNewDay_Ship(Vehicle *v) void OnNewDay_Ship(Vehicle *v)
@ -386,7 +386,7 @@ static bool ShipAccelerate(Vehicle *v)
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) if (_patches.vehicle_speed)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
/* Decrease somewhat when turning */ /* Decrease somewhat when turning */
@ -683,7 +683,7 @@ static void ShipController(Vehicle *v)
* always skip ahead. */ * always skip ahead. */
if (v->current_order.type == OT_LEAVESTATION) { if (v->current_order.type == OT_LEAVESTATION) {
v->current_order.Free(); v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} else if (v->dest_tile != 0) { } else if (v->dest_tile != 0) {
/* We have a target, let's see if we reached it... */ /* We have a target, let's see if we reached it... */
if (v->current_order.type == OT_GOTO_STATION && if (v->current_order.type == OT_GOTO_STATION &&
@ -961,7 +961,7 @@ CommandCost CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->vehstatus ^= VS_STOPPED; v->vehstatus ^= VS_STOPPED;
v->cur_speed = 0; v->cur_speed = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
InvalidateWindowClasses(WC_SHIPS_LIST); InvalidateWindowClasses(WC_SHIPS_LIST);
} }
@ -1007,7 +1007,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -1021,7 +1021,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -1038,7 +1038,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
v->current_order.dest = dep->index; v->current_order.dest = dep->index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();

View File

@ -132,7 +132,7 @@ void TrainPowerChanged(Vehicle* v)
v->u.rail.cached_power = total_power; v->u.rail.cached_power = total_power;
v->u.rail.cached_max_te = max_te; v->u.rail.cached_max_te = max_te;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
@ -1247,7 +1247,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
InvalidateWindow(WC_VEHICLE_DETAILS, src_head->index); InvalidateWindow(WC_VEHICLE_DETAILS, src_head->index);
/* Update the refit button and window */ /* Update the refit button and window */
InvalidateWindow(WC_VEHICLE_REFIT, src_head->index); InvalidateWindow(WC_VEHICLE_REFIT, src_head->index);
InvalidateWindowWidget(WC_VEHICLE_VIEW, src_head->index, 12); InvalidateWindowWidget(WC_VEHICLE_VIEW, src_head->index, VVW_WIDGET_REFIT_VEH);
} }
/* Update the depot window */ /* Update the depot window */
InvalidateWindow(WC_VEHICLE_DEPOT, src_head->tile); InvalidateWindow(WC_VEHICLE_DEPOT, src_head->tile);
@ -1261,7 +1261,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
UpdateTrainAcceleration(dst_head); UpdateTrainAcceleration(dst_head);
InvalidateWindow(WC_VEHICLE_DETAILS, dst_head->index); InvalidateWindow(WC_VEHICLE_DETAILS, dst_head->index);
/* Update the refit button and window */ /* Update the refit button and window */
InvalidateWindowWidget(WC_VEHICLE_VIEW, dst_head->index, 12); InvalidateWindowWidget(WC_VEHICLE_VIEW, dst_head->index, VVW_WIDGET_REFIT_VEH);
InvalidateWindow(WC_VEHICLE_REFIT, dst_head->index); InvalidateWindow(WC_VEHICLE_REFIT, dst_head->index);
} }
/* Update the depot window */ /* Update the depot window */
@ -1304,7 +1304,7 @@ CommandCost CmdStartStopTrain(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
} }
v->vehstatus ^= VS_STOPPED; v->vehstatus ^= VS_STOPPED;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
} }
return CommandCost(); return CommandCost();
@ -1549,7 +1549,7 @@ static void SetLastSpeed(Vehicle* v, int spd)
if (spd != old) { if (spd != old) {
v->u.rail.last_speed = spd; v->u.rail.last_speed = spd;
if (_patches.vehicle_speed || (old == 0) != (spd == 0)) if (_patches.vehicle_speed || (old == 0) != (spd == 0))
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
@ -2062,7 +2062,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
ClrBit(v->current_order.flags, OF_PART_OF_ORDERS); ClrBit(v->current_order.flags, OF_PART_OF_ORDERS);
ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT); ToggleBit(v->current_order.flags, OF_HALT_IN_DEPOT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -2075,7 +2075,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return CommandCost(); return CommandCost();
} }
@ -2096,7 +2096,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT); if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
v->current_order.dest = GetDepotByTile(tfdd.tile)->index; v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
v->current_order.refit_cargo = CT_INVALID; v->current_order.refit_cargo = CT_INVALID;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
/* If there is no depot in front, reverse automatically */ /* If there is no depot in front, reverse automatically */
if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION); if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
} }
@ -2844,7 +2844,7 @@ static void SetVehicleCrashed(Vehicle *v)
v->u.rail.crash_anim_pos++; v->u.rail.crash_anim_pos++;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
if (v->u.rail.track == TRACK_BIT_DEPOT) { if (v->u.rail.track == TRACK_BIT_DEPOT) {
@ -2995,7 +2995,7 @@ static void TrainController(Vehicle *v, bool update_image)
if (v->current_order.type == OT_LEAVESTATION) { if (v->current_order.type == OT_LEAVESTATION) {
v->current_order.Free(); v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
} else { } else {
@ -3588,7 +3588,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
* schedule? */ * schedule? */
v->current_order.type = OT_DUMMY; v->current_order.type = OT_DUMMY;
v->current_order.flags = 0; v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
return; return;
} }
@ -3605,7 +3605,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
v->current_order.flags = OFB_NON_STOP; v->current_order.flags = OFB_NON_STOP;
v->current_order.dest = depot->index; v->current_order.dest = depot->index;
v->dest_tile = tfdd.tile; v->dest_tile = tfdd.tile;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
void OnNewDay_Train(Vehicle *v) void OnNewDay_Train(Vehicle *v)

View File

@ -3131,7 +3131,7 @@ void Vehicle::BeginLoading()
VehiclePayment(this); VehiclePayment(this);
InvalidateWindow(this->GetVehicleListWindowClass(), this->owner); InvalidateWindow(this->GetVehicleListWindowClass(), this->owner);
InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DETAILS, this->index); InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
InvalidateWindow(WC_STATION_VIEW, this->last_station_visited); InvalidateWindow(WC_STATION_VIEW, this->last_station_visited);
@ -3222,7 +3222,7 @@ void StopAllVehicles()
/* Code ripped from CmdStartStopTrain. Can't call it, because of /* Code ripped from CmdStartStopTrain. Can't call it, because of
* ownership problems, so we'll duplicate some code, for now */ * ownership problems, so we'll duplicate some code, for now */
v->vehstatus |= VS_STOPPED; v->vehstatus |= VS_STOPPED;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
} }
} }

View File

@ -133,10 +133,6 @@ SpriteID GetEnginePalette(EngineID engine_type, PlayerID player);
*/ */
SpriteID GetVehiclePalette(const Vehicle *v); SpriteID GetVehiclePalette(const Vehicle *v);
/* A lot of code calls for the invalidation of the status bar, which is widget 5.
* Best is to have a virtual value for it when it needs to change again */
#define STATUS_BAR 5
extern const uint32 _veh_build_proc_table[]; extern const uint32 _veh_build_proc_table[];
extern const uint32 _veh_sell_proc_table[]; extern const uint32 _veh_sell_proc_table[];
extern const uint32 _veh_refit_proc_table[]; extern const uint32 _veh_refit_proc_table[];

View File

@ -1645,26 +1645,6 @@ static void ShowVehicleDetailsWindow(const Vehicle *v)
/* Unified vehicle GUI - Vehicle View Window */ /* Unified vehicle GUI - Vehicle View Window */
/** Constants of vehicle view widget indices */
enum VehicleViewWindowWidgets {
VVW_WIDGET_CLOSEBOX = 0,
VVW_WIDGET_CAPTION,
VVW_WIDGET_STICKY,
VVW_WIDGET_PANEL,
VVW_WIDGET_VIEWPORT,
VVW_WIDGET_START_STOP_VEH,
VVW_WIDGET_CENTER_MAIN_VIEH,
VVW_WIDGET_GOTO_DEPOT,
VVW_WIDGET_REFIT_VEH,
VVW_WIDGET_SHOW_ORDERS,
VVW_WIDGET_SHOW_DETAILS,
VVW_WIDGET_CLONE_VEH,
VVW_WIDGET_EMPTY_BOTTOM_RIGHT,
VVW_WIDGET_RESIZE,
VVW_WIDGET_TURN_AROUND,
VVW_WIDGET_FORCE_PROCEED,
};
/** Vehicle view widgets. */ /** Vehicle view widgets. */
static const Widget _vehicle_view_widgets[] = { static const Widget _vehicle_view_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // VVW_WIDGET_CLOSEBOX { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // VVW_WIDGET_CLOSEBOX

View File

@ -22,7 +22,27 @@ void BuildVehicleList(vehiclelist_d *vl, PlayerID owner, uint16 index, uint16 wi
extern const StringID _vehicle_sort_listing[]; extern const StringID _vehicle_sort_listing[];
/* Start of functions regarding vehicle list windows */ /** Constants of vehicle view widget indices */
enum VehicleViewWindowWidgets {
VVW_WIDGET_CLOSEBOX = 0,
VVW_WIDGET_CAPTION,
VVW_WIDGET_STICKY,
VVW_WIDGET_PANEL,
VVW_WIDGET_VIEWPORT,
VVW_WIDGET_START_STOP_VEH,
VVW_WIDGET_CENTER_MAIN_VIEH,
VVW_WIDGET_GOTO_DEPOT,
VVW_WIDGET_REFIT_VEH,
VVW_WIDGET_SHOW_ORDERS,
VVW_WIDGET_SHOW_DETAILS,
VVW_WIDGET_CLONE_VEH,
VVW_WIDGET_EMPTY_BOTTOM_RIGHT,
VVW_WIDGET_RESIZE,
VVW_WIDGET_TURN_AROUND,
VVW_WIDGET_FORCE_PROCEED,
};
/** Start of functions regarding vehicle list windows */
enum { enum {
PLY_WND_PRC__OFFSET_TOP_WIDGET = 26, PLY_WND_PRC__OFFSET_TOP_WIDGET = 26,
PLY_WND_PRC__SIZE_OF_ROW_TINY = 13, PLY_WND_PRC__SIZE_OF_ROW_TINY = 13,
@ -31,7 +51,7 @@ enum {
PLY_WND_PRC__SIZE_OF_ROW_BIG2 = 39, PLY_WND_PRC__SIZE_OF_ROW_BIG2 = 39,
}; };
/* Vehicle List Window type flags */ /** Vehicle List Window type flags */
enum { enum {
VLW_STANDARD = 0 << 8, VLW_STANDARD = 0 << 8,
VLW_SHARED_ORDERS = 1 << 8, VLW_SHARED_ORDERS = 1 << 8,

View File

@ -770,7 +770,7 @@ static void FloodVehicle(Vehicle *v)
return; return;
} }
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile); InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
SetDParam(0, pass); SetDParam(0, pass);