summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-07 19:18:56 +0000
committerrubidium <rubidium@openttd.org>2008-04-07 19:18:56 +0000
commitcf250390c5bd2a4980197b1801630fac80944fd3 (patch)
tree107ad3411123e54f1869835417c772620cee3502 /src
parent0017149c33d8607ca25b154c28cd94e8221e911f (diff)
downloadopenttd-cf250390c5bd2a4980197b1801630fac80944fd3.tar.xz
(svn r12615) -Codechange: rename some enums related to depot orders to make it more clear that they are no loading/unloading flags. Also add more type strictness.
Diffstat (limited to 'src')
-rw-r--r--src/ai/trolly/trolly.cpp2
-rw-r--r--src/aircraft_cmd.cpp14
-rw-r--r--src/order_base.h10
-rw-r--r--src/order_cmd.cpp19
-rw-r--r--src/order_gui.cpp10
-rw-r--r--src/order_type.h30
-rw-r--r--src/roadveh_cmd.cpp14
-rw-r--r--src/ship_cmd.cpp14
-rw-r--r--src/timetable_cmd.cpp2
-rw-r--r--src/timetable_gui.cpp2
-rw-r--r--src/train_cmd.cpp14
-rw-r--r--src/vehicle.cpp10
-rw-r--r--src/vehicle_gui.cpp2
13 files changed, 73 insertions, 70 deletions
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index d62044705..9170950df 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -1184,7 +1184,7 @@ static void AiNew_State_GiveOrders(Player *p)
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
if (_patches.gotodepot) {
idx = 0;
- order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, true);
+ order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, ODTFB_PART_OF_ORDERS);
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
}
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 925577877..c81f5e220 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -570,14 +570,14 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
if (v->current_order.IsType(OT_GOTO_DEPOT) && !(p2 & DEPOT_LOCATE_HANGAR)) {
- bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ bool halt_in_depot = v->current_order.GetDepotActionType() & ODATFB_HALT;
if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
* Note: the if is (true for requesting service == true for ordered to stop in hangar) */
if (flags & DC_EXEC) {
- v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
- v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(ODTF_MANUAL);
+ v->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -587,7 +587,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
+ if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) v->cur_order_index++;
v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
@@ -609,8 +609,8 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (flags & DC_EXEC) {
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
- v->current_order.MakeGoToDepot(next_airport_index, false);
- if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
+ v->current_order.MakeGoToDepot(next_airport_index, ODTF_MANUAL);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
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 */
@@ -714,7 +714,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
if (st->IsValid() && st->airport_tile != 0 && st->Airport()->terminals != NULL) {
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
// v->u.air.targetairport = st->index;
- v->current_order.MakeGoToDepot(0, false);
+ v->current_order.MakeGoToDepot(0, ODTFB_SERVICE);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
v->current_order.MakeDummy();
diff --git a/src/order_base.h b/src/order_base.h
index 2e9ac6fc6..f6f2dc396 100644
--- a/src/order_base.h
+++ b/src/order_base.h
@@ -87,7 +87,7 @@ public:
* @param cargo the cargo type to change to.
* @param subtype the subtype to change to.
*/
- void MakeGoToDepot(DepotID destination, bool order, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
+ void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
/**
* Makes this order a Go To Waypoint order.
@@ -167,9 +167,9 @@ public:
/** Where must we stop? */
OrderNonStopFlags GetNonStopType() const;
/** What caused us going to the depot? */
- inline byte GetDepotOrderType() const { return this->flags; }
+ inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)this->flags; }
/** What are we going to do when in the depot. */
- inline byte GetDepotActionType() const { return this->flags; }
+ inline OrderDepotActionFlags GetDepotActionType() const { return (OrderDepotActionFlags)this->flags; }
/** Set how the consist must be loaded. */
inline void SetLoadType(byte load_type) { SB(this->flags, 2, 1, !!load_type); }
@@ -178,9 +178,9 @@ public:
/** Set whether we must stop at stations or not. */
inline void SetNonStopType(OrderNonStopFlags non_stop_type) { SB(this->flags, 3, 1, !!non_stop_type); }
/** Set the cause to go to the depot. */
- inline void SetDepotOrderType(byte depot_order_type) { this->flags = depot_order_type; }
+ inline void SetDepotOrderType(OrderDepotTypeFlags depot_order_type) { this->flags = depot_order_type; }
/** Set what we are going to do in the depot. */
- inline void SetDepotActionType(byte depot_service_type) { this->flags = depot_service_type; }
+ inline void SetDepotActionType(OrderDepotActionFlags depot_service_type) { this->flags = depot_service_type; }
bool ShouldStopAtStation(const Vehicle *v, StationID station) const;
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 866238734..b940ba25b 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -65,13 +65,12 @@ void Order::MakeGoToStation(StationID destination)
this->dest = destination;
}
-void Order::MakeGoToDepot(DepotID destination, bool order, CargoID cargo, byte subtype)
+void Order::MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, CargoID cargo, byte subtype)
{
this->type = OT_GOTO_DEPOT;
this->flags = 0;
- if (order) {
- this->SetDepotOrderType(OFB_PART_OF_ORDERS);
- } else {
+ this->SetDepotOrderType(order);
+ if (!(order & ODTFB_PART_OF_ORDERS)) {
this->SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
}
this->dest = destination;
@@ -377,8 +376,8 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* order [+ halt] [+ non-stop]
* non-stop orders (if any) are only valid for trains */
switch (new_order.GetDepotOrderType() | new_order.GetDepotActionType()) {
- case OFB_PART_OF_ORDERS:
- case OFB_PART_OF_ORDERS | OFB_HALT_IN_DEPOT:
+ case ODTFB_PART_OF_ORDERS:
+ case ODTFB_PART_OF_ORDERS | ODATFB_HALT:
break;
default: return CMD_ERROR;
@@ -765,7 +764,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
switch (p2) {
case OF_FULL_LOAD:
if (order->IsType(OT_GOTO_DEPOT)) {
- order->SetDepotOrderType(order->GetDepotOrderType() ^ OFB_SERVICE_IF_NEEDED);
+ order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() ^ ODTFB_SERVICE));
} else {
order->SetLoadType(order->GetLoadType() ^ OFB_FULL_LOAD);
order->SetUnloadType(order->GetUnloadType() & ~OFB_UNLOAD);
@@ -984,7 +983,7 @@ CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(u);
/* If the vehicle already got the current depot set as current order, then update current order as well */
- if (u->cur_order_index == order_number && HasBit(u->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
+ if (u->cur_order_index == order_number && u->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
u->current_order.SetRefit(cargo, subtype);
}
}
@@ -1367,9 +1366,9 @@ bool ProcessOrders(Vehicle *v)
switch (v->current_order.GetType()) {
case OT_GOTO_DEPOT:
/* Let a depot order in the orderlist interrupt. */
- if (!(v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS)) return false;
+ if (!(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) return false;
- if ((v->current_order.GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) && !VehicleNeedsService(v)) {
+ if ((v->current_order.GetDepotOrderType() & ODTFB_SERVICE) && !VehicleNeedsService(v)) {
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
}
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 871bd5e3f..633189850 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -222,7 +222,7 @@ static void DrawOrdersWindow(Window *w)
}
}
- if (order->GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) s++; /* service at */
+ if (order->GetDepotOrderType() & ODTFB_SERVICE) s++; /* service at */
SetDParam(1, s);
if (order->IsRefit()) {
@@ -270,7 +270,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_RAILWAY:
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
if (IsRailDepot(tile)) {
- order.MakeGoToDepot(GetDepotByTile(tile)->index, true);
+ order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
return order;
}
}
@@ -278,7 +278,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_ROAD:
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
- order.MakeGoToDepot(GetDepotByTile(tile)->index, true);
+ order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
return order;
}
break;
@@ -286,7 +286,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_STATION:
if (v->type != VEH_AIRCRAFT) break;
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
- order.MakeGoToDepot(GetStationIndex(tile), true);
+ order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS);
return order;
}
break;
@@ -297,7 +297,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
IsTileOwner(tile, _local_player)) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
- order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, true);
+ order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS);
return order;
}
diff --git a/src/order_type.h b/src/order_type.h
index 4d331a89d..4a21807e9 100644
--- a/src/order_type.h
+++ b/src/order_type.h
@@ -49,16 +49,6 @@ enum OrderFlagMasks {
/** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting
* @todo make this two different flags */
OFB_FULL_LOAD = 0x4,
-
- //Flags for depots:
- /** The current depot-order was initiated because it was in the vehicle's order list */
- OFB_MANUAL_ORDER = 0x0,
- OFB_PART_OF_ORDERS = 0x2,
- /** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
- OFB_NORMAL_ACTION = 0x0,
- OFB_HALT_IN_DEPOT = 0x4,
- /** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
- OFB_SERVICE_IF_NEEDED = 0x4, //used when OFB_PART_OF_ORDERS is set.
};
/**
@@ -71,6 +61,23 @@ enum OrderNonStopFlags {
ONSF_NO_STOP_AT_ANY_STATION = 3
};
+/**
+ * Reasons that could cause us to go to the depot.
+ */
+enum OrderDepotTypeFlags {
+ ODTF_MANUAL = 0, ///< The player initiated this order manually.
+ ODTFB_SERVICE = 1 << 2, ///< This depot order is because of the servicing limit.
+ ODTFB_PART_OF_ORDERS = 1 << 1, ///< This depot order is because of a regular order.
+};
+
+/**
+ * Actions that can be performed when the vehicle enters the depot.
+ */
+enum OrderDepotActionFlags {
+ ODATF_SERVICE_ONLY = 0, ///< Only service the vehicle.
+ ODATFB_HALT = 1 << 2, ///< Service the vehicle and then halt it.
+};
+
/** Order flags bits - these are for the *BIT macros
* for descrption of flags, see OrderFlagMasks
* @see OrderFlagMasks
@@ -79,9 +86,6 @@ enum {
OF_TRANSFER = 0,
OF_UNLOAD = 1,
OF_FULL_LOAD = 2,
- OF_PART_OF_ORDERS = 1,
- OF_HALT_IN_DEPOT = 2,
- OF_SERVICE_IF_NEEDED = 2,
OF_NON_STOP = 3
};
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 4eceebb64..fba9831cc 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -477,14 +477,14 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
/* If the current orders are already goto-depot */
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
- bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ bool halt_in_depot = v->current_order.GetDepotActionType() & ODATFB_HALT;
if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
- v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(ODTF_MANUAL);
+ v->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -494,7 +494,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
+ if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) v->cur_order_index++;
v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
@@ -509,8 +509,8 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
ClearSlot(v);
- v->current_order.MakeGoToDepot(dep->index, false);
- if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
+ v->current_order.MakeGoToDepot(dep->index, ODTF_MANUAL);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(ODATFB_HALT);
v->dest_tile = dep->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -1937,7 +1937,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
ClearSlot(v);
- v->current_order.MakeGoToDepot(depot->index, false);
+ v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE);
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 5fb38f950..b3656e9ef 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -160,7 +160,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
return;
}
- v->current_order.MakeGoToDepot(depot->index, false);
+ v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE);
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
@@ -943,14 +943,14 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
/* If the current orders are already goto-depot */
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
- bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ bool halt_in_depot = v->current_order.GetDepotActionType() & ODATFB_HALT;
if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
- v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(ODTF_MANUAL);
+ v->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -960,7 +960,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
+ if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) v->cur_order_index++;
v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
@@ -975,8 +975,8 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
v->dest_tile = dep->xy;
- v->current_order.MakeGoToDepot(dep->index, false);
- if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
+ v->current_order.MakeGoToDepot(dep->index, ODTF_MANUAL);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index d2aa1f867..62f91d051 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -24,7 +24,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
order->wait_time = time;
}
- if (v->cur_order_index == order_number && HasBit(v->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
+ if (v->cur_order_index == order_number && v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
if (is_journey) {
v->current_order.travel_time = time;
} else {
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index dd78c2e0f..914eb7e2d 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -146,7 +146,7 @@ static void DrawTimetableWindow(Window *w)
}
}
- if (order->GetDepotOrderType() & OFB_SERVICE_IF_NEEDED) string++; /* service at */
+ if (order->GetDepotOrderType() & ODTFB_SERVICE) string++; /* service at */
SetDParam(0, string);
} break;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 8efba8341..0447d711c 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2109,14 +2109,14 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
- bool halt_in_depot = HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT);
+ bool halt_in_depot = v->current_order.GetDepotActionType() & ODATFB_HALT;
if (!!(p2 & DEPOT_SERVICE) == halt_in_depot) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
if (flags & DC_EXEC) {
- v->current_order.SetDepotOrderType(OFB_MANUAL_ORDER);
- v->current_order.SetDepotActionType(halt_in_depot ? OFB_NORMAL_ACTION : OFB_HALT_IN_DEPOT);
+ v->current_order.SetDepotOrderType(ODTF_MANUAL);
+ v->current_order.SetDepotActionType(halt_in_depot ? ODATF_SERVICE_ONLY : ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
return CommandCost();
@@ -2126,7 +2126,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS) v->cur_order_index++;
+ if (v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) v->cur_order_index++;
v->current_order.MakeDummy();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
@@ -2145,8 +2145,8 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
v->dest_tile = tfdd.tile;
- v->current_order.MakeGoToDepot(GetDepotByTile(tfdd.tile)->index, false);
- if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(OFB_HALT_IN_DEPOT);
+ v->current_order.MakeGoToDepot(GetDepotByTile(tfdd.tile)->index, ODTF_MANUAL);
+ if (!(p2 & DEPOT_SERVICE)) v->current_order.SetDepotActionType(ODATFB_HALT);
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
/* If there is no depot in front, reverse automatically */
if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
@@ -3570,7 +3570,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
return;
}
- v->current_order.MakeGoToDepot(depot->index, false);
+ v->current_order.MakeGoToDepot(depot->index, ODTFB_SERVICE);
v->dest_tile = tfdd.tile;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 50130ffe5..5cdf9e35d 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -121,10 +121,10 @@ void VehicleServiceInDepot(Vehicle *v)
bool VehicleNeedsService(const Vehicle *v)
{
if (v->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
- if (!v->current_order.IsType(OT_GOTO_DEPOT) || !(v->current_order.GetDepotOrderType() & OFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
+ if (!v->current_order.IsType(OT_GOTO_DEPOT) || !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return false;
if (v->current_order.IsType(OT_LOADING)) return false;
- if (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() & OFB_HALT_IN_DEPOT) return false;
+ if (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.GetDepotActionType() & ODATFB_HALT) return false;
}
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
@@ -632,7 +632,7 @@ void VehicleEnteredDepotThisTick(Vehicle *v)
{
/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
* Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
- if ((HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT) && !HasBit(v->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS) && v->current_order.IsType(OT_GOTO_DEPOT)) ||
+ if (((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) && v->current_order.IsType(OT_GOTO_DEPOT)) ||
(v->vehstatus & VS_STOPPED)) {
/* we keep the vehicle in the depot since the user ordered it to stay */
v->leave_depot_instantly = false;
@@ -2263,11 +2263,11 @@ void VehicleEnterDepot(Vehicle *v)
}
}
- if (HasBit(t.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
+ if (t.GetDepotOrderType() & ODTFB_PART_OF_ORDERS) {
/* Part of orders */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
- } else if (HasBit(t.GetDepotActionType(), OF_HALT_IN_DEPOT)) {
+ } else if (t.GetDepotActionType() & ODATFB_HALT) {
/* Force depot visit */
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index f3eebcca9..f1e3101d3 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -1969,7 +1969,7 @@ static void DrawVehicleViewWindow(Window *w)
SetDParam(0, depot->town_index);
SetDParam(1, v->GetDisplaySpeed());
}
- if (HasBit(v->current_order.GetDepotActionType(), OF_HALT_IN_DEPOT) && !HasBit(v->current_order.GetDepotOrderType(), OF_PART_OF_ORDERS)) {
+ if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) {
str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed;
} else {
str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed;