summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ai/default/default.cpp8
-rw-r--r--src/aircraft.h20
-rw-r--r--src/aircraft_cmd.cpp10
-rw-r--r--src/group_gui.cpp2
-rw-r--r--src/roadveh.h12
-rw-r--r--src/roadveh_cmd.cpp14
-rw-r--r--src/ship.h13
-rw-r--r--src/ship_cmd.cpp14
-rw-r--r--src/train.h5
-rw-r--r--src/vehicle.cpp36
-rw-r--r--src/vehicle.h16
-rw-r--r--src/vehicle_gui.cpp10
12 files changed, 55 insertions, 105 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 24755a281..b28e2a2b8 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -338,7 +338,7 @@ static void AiHandleReplaceRoadVeh(Player *p)
BackuppedOrders orderbak[1];
EngineID veh;
- if (!IsRoadVehInDepotStopped(v)) {
+ if (!v->IsStoppedInDepot()) {
AiHandleGotoDepot(p, CMD_SEND_ROADVEH_TO_DEPOT);
return;
}
@@ -367,7 +367,7 @@ static void AiHandleReplaceAircraft(Player *p)
BackuppedOrders orderbak[1];
EngineID veh;
- if (!IsAircraftInHangarStopped(v)) {
+ if (!v->IsStoppedInDepot()) {
AiHandleGotoDepot(p, CMD_SEND_AIRCRAFT_TO_HANGAR);
return;
}
@@ -3578,7 +3578,7 @@ static void AiStateSellVeh(Player *p)
DoCommand(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON);
} else if (v->type == VEH_ROAD) {
- if (!IsRoadVehInDepotStopped(v)) {
+ if (!v->IsStoppedInDepot()) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
goto going_to_depot;
@@ -3586,7 +3586,7 @@ static void AiStateSellVeh(Player *p)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
} else if (v->type == VEH_AIRCRAFT) {
- if (!IsAircraftInHangarStopped(v)) {
+ if (!v->IsStoppedInDepot()) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
goto going_to_depot;
diff --git a/src/aircraft.h b/src/aircraft.h
index 15a5530e0..bd274f3a9 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -33,25 +33,6 @@ static inline bool IsNormalAircraft(const Vehicle *v)
return v->subtype <= AIR_AIRCRAFT;
}
-/** Check if this aircraft is in a hangar
- * @param v vehicle to check
- * @return true if in hangar
- */
-static inline bool IsAircraftInHangar(const Vehicle *v)
-{
- assert(v->type == VEH_AIRCRAFT);
- return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
-}
-
-/** Check if this aircraft is in a hangar and stopped
- * @param v vehicle to check
- * @return true if in hangar and stopped
- */
-static inline bool IsAircraftInHangarStopped(const Vehicle *v)
-{
- return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
-}
-
/** Checks if an aircraft is buildable at the tile in question
* @param engine The engine to test
* @param tile The tile where the hangar is
@@ -133,6 +114,7 @@ struct Aircraft : public Vehicle {
int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
+ bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
void Tick();
};
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 6e2977dc2..672d52176 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -485,7 +485,7 @@ CommandCost CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
+ if (!v->IsStoppedInDepot()) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -526,7 +526,7 @@ CommandCost CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32
}
if (flags & DC_EXEC) {
- if (IsAircraftInHangarStopped(v)) {
+ if (v->IsStoppedInDepot()) {
DeleteVehicleNews(p1, STR_A014_AIRCRAFT_IS_WAITING_IN);
}
@@ -560,7 +560,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
@@ -634,7 +634,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Vehicle *v = GetVehicle(p1);
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
+ if (!v->IsStoppedInDepot()) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
/* Check cargo */
CargoID new_cid = GB(p2, 0, 8);
@@ -706,7 +706,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
- if (IsAircraftInHangar(v)) {
+ if (v->IsInDepot()) {
VehicleServiceInDepot(v);
return;
}
diff --git a/src/group_gui.cpp b/src/group_gui.cpp
index 97830ba42..7b994af9d 100644
--- a/src/group_gui.cpp
+++ b/src/group_gui.cpp
@@ -458,7 +458,7 @@ static void GroupWndProc(Window *w, WindowEvent *e)
DrawVehicleProfitButton(v, x, y2 + 13);
SetDParam(0, v->unitnumber);
- DrawString(x, y2 + 2, IsVehicleInDepot(v) ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), 0);
+ DrawString(x, y2 + 2, v->IsInDepot() ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), 0);
if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG2) DrawSmallOrderList(v, x + 138, y2);
diff --git a/src/roadveh.h b/src/roadveh.h
index 7644e3570..5c62fcee0 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -45,17 +45,6 @@ static inline bool RoadVehHasArticPart(const Vehicle *v)
}
-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;
-}
-
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
@@ -85,6 +74,7 @@ struct RoadVehicle : public Vehicle {
int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * _price.roadveh_running; }
+ bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
void Tick();
};
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 82a02305a..d24de2980 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -304,7 +304,7 @@ CommandCost CmdStartStopRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32
}
if (flags & DC_EXEC) {
- if (IsRoadVehInDepotStopped(v)) {
+ if (v->IsStoppedInDepot()) {
DeleteVehicleNews(p1, STR_9016_ROAD_VEHICLE_IS_WAITING);
}
@@ -469,7 +469,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
- if (IsRoadVehInDepot(v)) return CMD_ERROR;
+ if (v->IsInDepot()) return CMD_ERROR;
/* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) {
@@ -538,7 +538,7 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->breakdown_ctr != 0 ||
v->u.road.overtaking != 0 ||
v->u.road.state == RVSB_WORMHOLE ||
- IsRoadVehInDepot(v) ||
+ v->IsInDepot() ||
v->cur_speed < 5) {
return CMD_ERROR;
}
@@ -865,7 +865,7 @@ static void* EnumCheckRoadVehClose(Vehicle *v, void* data)
return
v->type == VEH_ROAD &&
- !IsRoadVehInDepot(v) &&
+ !v->IsInDepot() &&
myabs(v->z_pos - rvf->veh->z_pos) < 6 &&
v->direction == rvf->dir &&
GetFirstVehicleInChain(rvf->veh) != GetFirstVehicleInChain(v) &&
@@ -1439,7 +1439,7 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
/* If this vehicle is in a depot and we've reached this point it must be
* one of the articulated parts. It will stay in the depot until activated
* by the previous vehicle in the chain when it gets to the right place. */
- if (IsRoadVehInDepot(v)) return true;
+ if (v->IsInDepot()) return true;
/* Save old vehicle position to use at end of move to set viewport area dirty */
BeginVehicleMove(v);
@@ -1817,7 +1817,7 @@ static void RoadVehController(Vehicle *v)
if (v->current_order.type == OT_LOADING) return;
- if (IsRoadVehInDepot(v) && RoadVehLeaveDepot(v, true)) return;
+ if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return;
/* Check if vehicle needs to proceed, return if it doesn't */
if (!RoadVehAccelerate(v)) return;
@@ -1858,7 +1858,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
/* If we already got a slot at a stop, use that FIRST, and go to a depot later */
if (v->u.road.slot != NULL) return;
- if (IsRoadVehInDepot(v)) {
+ if (v->IsInDepot()) {
VehicleServiceInDepot(v);
return;
}
diff --git a/src/ship.h b/src/ship.h
index 929eeccc6..b08bc18f4 100644
--- a/src/ship.h
+++ b/src/ship.h
@@ -13,18 +13,6 @@ void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2);
void RecalcShipStuff(Vehicle *v);
void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
-static inline bool IsShipInDepot(const Vehicle *v)
-{
- assert(v->type == VEH_SHIP);
- return v->u.ship.state == 0x80;
-}
-
-static inline bool IsShipInDepotStopped(const Vehicle *v)
-{
- return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
-}
-
-
/**
* This class 'wraps' Vehicle; you do not actually instantiate this class.
* You create a Vehicle using AllocateVehicle, so it is added to the pool
@@ -51,6 +39,7 @@ struct Ship: public Vehicle {
int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
Money GetRunningCost() const { return ShipVehInfo(this->engine_type)->running_cost * _price.ship_running; }
+ bool IsInDepot() const { return this->u.ship.state == 0x80; }
void Tick();
};
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 29be282e6..5b13a2580 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -152,7 +152,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
- if (IsShipInDepot(v)) {
+ if (v->IsInDepot()) {
VehicleServiceInDepot(v);
return;
}
@@ -355,7 +355,7 @@ static void CheckShipLeaveDepot(Vehicle *v)
Axis axis;
uint m;
- if (!IsShipInDepot(v)) return;
+ if (!v->IsInDepot()) return;
tile = v->tile;
axis = GetShipDepotAxis(tile);
@@ -678,7 +678,7 @@ static void ShipController(Vehicle *v)
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
if (gp.old_tile == gp.new_tile) {
/* Staying in tile */
- if (IsShipInDepot(v)) {
+ if (v->IsInDepot()) {
gp.x = v->x_pos;
gp.y = v->y_pos;
} else {
@@ -925,7 +925,7 @@ CommandCost CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
- if (!IsShipInDepotStopped(v)) {
+ if (!v->IsStoppedInDepot()) {
return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
}
@@ -967,7 +967,7 @@ CommandCost CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
if (flags & DC_EXEC) {
- if (IsShipInDepotStopped(v)) {
+ if (v->IsStoppedInDepot()) {
DeleteVehicleNews(p1, STR_981C_SHIP_IS_WAITING_IN_DEPOT);
}
@@ -1007,7 +1007,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
- if (IsShipInDepot(v)) return CMD_ERROR;
+ if (v->IsInDepot()) return CMD_ERROR;
/* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) {
@@ -1079,7 +1079,7 @@ CommandCost CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
- if (!IsShipInDepotStopped(v)) {
+ if (!v->IsStoppedInDepot()) {
return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
}
diff --git a/src/train.h b/src/train.h
index 5befad626..1983b99ff 100644
--- a/src/train.h
+++ b/src/train.h
@@ -248,6 +248,9 @@ void CcBuildWagon(bool success, TileIndex tile, uint32 p1, uint32 p2);
byte FreightWagonMult(CargoID cargo);
+int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped);
+int CheckTrainStoppedInDepot(const Vehicle *v);
+
/**
* This class 'wraps' Vehicle; you do not actually instantiate this class.
* You create a Vehicle using AllocateVehicle, so it is added to the pool
@@ -275,6 +278,8 @@ struct Train : public Vehicle {
int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed * 10 / 16; }
Money GetRunningCost() const;
+ bool IsInDepot() const { return CheckTrainInDepot(this, false) != -1; }
+ bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; }
void Tick();
};
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index d3bb464f8..46c1f3d4c 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1700,7 +1700,7 @@ CommandCost CmdDepotMassAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uin
CommandCost ret;
/* Ensure that the vehicle completely in the depot */
- if (!IsVehicleInDepot(v)) continue;
+ if (!v->IsInDepot()) continue;
x = v->x_pos;
y = v->y_pos;
@@ -1958,7 +1958,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, Vehicle ***engine_l
case VEH_ROAD:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_ROAD && IsRoadVehInDepot(v) && IsRoadVehFront(v)) {
+ if (v->tile == tile && v->type == VEH_ROAD && v->IsInDepot() && IsRoadVehFront(v)) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
@@ -1967,7 +1967,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, Vehicle ***engine_l
case VEH_SHIP:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_SHIP && IsShipInDepot(v)) {
+ if (v->tile == tile && v->type == VEH_SHIP && v->IsInDepot()) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
@@ -1978,7 +1978,7 @@ void BuildDepotVehicleList(VehicleType type, TileIndex tile, Vehicle ***engine_l
FOR_ALL_VEHICLES(v) {
if (v->tile == tile &&
v->type == VEH_AIRCRAFT && IsNormalAircraft(v) &&
- v->vehstatus & VS_HIDDEN) {
+ v->IsInDepot()) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
@@ -2133,30 +2133,6 @@ CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service,
return (flags & DC_EXEC) ? CommandCost() : CMD_ERROR;
}
-bool IsVehicleInDepot(const Vehicle *v)
-{
- switch (v->type) {
- case VEH_TRAIN: return CheckTrainInDepot(v, false) != -1;
- case VEH_ROAD: return IsRoadVehInDepot(v);
- case VEH_SHIP: return IsShipInDepot(v);
- case VEH_AIRCRAFT: return IsAircraftInHangar(v);
- default: NOT_REACHED();
- }
- return false;
-}
-
-bool IsVehicleInDepotStopped(const Vehicle *v)
-{
- switch (v->type) {
- case VEH_TRAIN: return CheckTrainStoppedInDepot(v) >= 0;
- case VEH_ROAD: return IsRoadVehInDepotStopped(v);
- case VEH_SHIP: return IsShipInDepotStopped(v);
- case VEH_AIRCRAFT: return IsAircraftInHangarStopped(v);
- default: NOT_REACHED();
- }
- return false;
-}
-
/**
* Calculates how full a vehicle is.
* @param v The Vehicle to check. For trains, use the first engine.
@@ -2472,14 +2448,14 @@ Trackdir GetVehicleTrackdir(const Vehicle* v)
return TrackDirectionToTrackdir(FindFirstTrack(v->u.rail.track), v->direction);
case VEH_SHIP:
- if (IsShipInDepot(v))
+ if (v->IsInDepot())
// We'll assume the ship is facing outwards
return DiagdirToDiagTrackdir(GetShipDepotDirection(v->tile));
return TrackDirectionToTrackdir(FindFirstTrack(v->u.ship.state), v->direction);
case VEH_ROAD:
- if (IsRoadVehInDepot(v)) // We'll assume the road vehicle is facing outwards
+ if (v->IsInDepot()) // We'll assume the road vehicle is facing outwards
return DiagdirToDiagTrackdir(GetRoadDepotDirection(v->tile));
if (IsStandardRoadStopTile(v->tile)) // We'll assume the road vehicle is facing outwards
diff --git a/src/vehicle.h b/src/vehicle.h
index b07aa44d4..fce09b18d 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -433,6 +433,18 @@ struct Vehicle : PoolItem<Vehicle, VehicleID, &_Vehicle_pool> {
virtual Money GetRunningCost() const { return 0; }
/**
+ * Check whether the vehicle is in the depot.
+ * @return true if and only if the vehicle is in the depot.
+ */
+ virtual bool IsInDepot() const { return false; }
+
+ /**
+ * Check whether the vehicle is in the depot *and* stopped.
+ * @return true if and only if the vehicle is in the depot and stopped.
+ */
+ virtual bool IsStoppedInDepot() const { return this->IsInDepot() && (this->vehstatus & VS_STOPPED) != 0; }
+
+ /**
* Calls the tick handler of the vehicle
*/
virtual void Tick() {};
@@ -573,15 +585,11 @@ void TrainConsistChanged(Vehicle *v);
void TrainPowerChanged(Vehicle *v);
Money GetTrainRunningCost(const Vehicle *v);
-int CheckTrainStoppedInDepot(const Vehicle *v);
-
bool VehicleNeedsService(const Vehicle *v);
uint GenerateVehicleSortList(const Vehicle*** sort_list, uint16 *length_of_array, VehicleType type, PlayerID owner, uint32 index, uint16 window_type);
void BuildDepotVehicleList(VehicleType type, TileIndex tile, Vehicle ***engine_list, uint16 *engine_list_length, uint16 *engine_count, Vehicle ***wagon_list, uint16 *wagon_list_length, uint16 *wagon_count);
CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id);
-bool IsVehicleInDepot(const Vehicle *v);
-bool IsVehicleInDepotStopped(const Vehicle *v);
void VehicleEnterDepot(Vehicle *v);
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g);
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 4a5cf7cd2..62b94105a 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1021,7 +1021,7 @@ static void DrawVehicleListWindow(Window *w)
if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, x + 138, y);
- if (IsVehicleInDepot(v)) {
+ if (v->IsInDepot()) {
str = STR_021F;
} else {
str = (v->age > v->max_age - 366) ? STR_00E3 : STR_00E2;
@@ -1546,9 +1546,9 @@ static bool IsVehicleRefitable(const Vehicle *v)
*/
switch (v->type) {
case VEH_TRAIN: return false;
- case VEH_ROAD: return EngInfo(v->engine_type)->refit_mask != 0 && IsVehicleInDepotStopped(v);
- case VEH_SHIP: return ShipVehInfo(v->engine_type)->refittable && IsVehicleInDepotStopped(v);
- case VEH_AIRCRAFT: return IsVehicleInDepotStopped(v);
+ case VEH_ROAD: return EngInfo(v->engine_type)->refit_mask != 0 && v->IsStoppedInDepot();
+ case VEH_SHIP: return ShipVehInfo(v->engine_type)->refittable && v->IsStoppedInDepot();
+ case VEH_AIRCRAFT: return v->IsStoppedInDepot();
default: NOT_REACHED();
}
}
@@ -1790,7 +1790,7 @@ static void VehicleViewWndProc(Window *w, WindowEvent *e)
case WE_MOUSELOOP: {
const Vehicle *v = GetVehicle(w->window_number);
- bool veh_stopped = IsVehicleInDepotStopped(v);
+ bool veh_stopped = v->IsStoppedInDepot();
/* Widget VVW_WIDGET_GOTO_DEPOT must be hidden if the vehicle is already
* stopped in depot.