summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aircraft_cmd.c6
-rw-r--r--order.h19
-rw-r--r--order_gui.c8
-rw-r--r--roadveh_cmd.c12
-rw-r--r--ship_cmd.c13
-rw-r--r--train_cmd.c8
6 files changed, 40 insertions, 26 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 827614963..f48dfb1d6 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -575,7 +575,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
return;
if (v->current_order.type == OT_GOTO_DEPOT &&
- v->current_order.flags & OF_FULL_LOAD)
+ v->current_order.flags & OF_HALT_IN_DEPOT)
return;
if (_patches.gotodepot && VehicleHasDepotOrders(v))
@@ -1313,9 +1313,9 @@ static void AircraftEnterHangar(Vehicle *v)
v->current_order.type = OT_NOTHING;
v->current_order.flags = 0;
- if (old_order.flags & OF_UNLOAD) {
+ if (HASBIT(old_order.flags, OFB_PART_OF_ORDERS)) {
v->cur_order_index++;
- } else if (old_order.flags & OF_FULL_LOAD) { // force depot visit
+ } else if (HASBIT(old_order.flags, OFB_HALT_IN_DEPOT)) { // force depot visit
v->vehstatus |= VS_STOPPED;
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
diff --git a/order.h b/order.h
index 840e1ec22..33708c042 100644
--- a/order.h
+++ b/order.h
@@ -16,16 +16,25 @@ enum {
/* Order flags -- please use OFB instead OF and use HASBIT/SETBIT/CLEARBIT */
enum {
- OF_UNLOAD = 0x2,
- OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot
+ //Flags for stations:
+ OF_UNLOAD = 0x2,
+ OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot
+
+ //Flags for depots:
+ OF_PART_OF_ORDERS = 0x2,
+ OF_HALT_IN_DEPOT = 0x4,
+
+ //Common flags
OF_NON_STOP = 0x8
};
/* Order flags bits */
enum {
- OFB_UNLOAD = 1,
- OFB_FULL_LOAD = 2,
- OFB_NON_STOP = 3
+ OFB_UNLOAD = 1,
+ OFB_FULL_LOAD = 2,
+ OFB_PART_OF_ORDERS = 1,
+ OFB_HALT_IN_DEPOT = 2,
+ OFB_NON_STOP = 3
};
/* Possible clone options */
diff --git a/order_gui.c b/order_gui.c
index ebc51c93f..a681a7c3c 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -167,7 +167,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile)
if (v->type == VEH_Train && _map_owner[tile] == _local_player) {
if ((_map5[tile]&0xFC)==0xC0) {
order.type = OT_GOTO_DEPOT;
- order.flags = OF_UNLOAD;
+ order.flags = OF_PART_OF_ORDERS;
order.station = GetDepotByTile(tile)->index;
return order;
}
@@ -177,7 +177,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile)
case MP_STREET:
if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && _map_owner[tile] == _local_player) {
order.type = OT_GOTO_DEPOT;
- order.flags = OF_UNLOAD;
+ order.flags = OF_PART_OF_ORDERS;
order.station = GetDepotByTile(tile)->index;
return order;
}
@@ -187,7 +187,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile)
if (v->type != VEH_Aircraft) break;
if ( IsAircraftHangarTile(tile) && _map_owner[tile] == _local_player) {
order.type = OT_GOTO_DEPOT;
- order.flags = OF_UNLOAD | OF_NON_STOP;
+ order.flags = OF_PART_OF_ORDERS | OF_NON_STOP; //XXX - whats the nonstop stuff doing here?
order.station = _map2[tile];
return order;
}
@@ -202,7 +202,7 @@ static Order GetOrderCmdFromTile(Vehicle *v, uint tile)
case 0x83: tile-= TILE_XY(0,1); break;
}
order.type = OT_GOTO_DEPOT;
- order.flags = OF_UNLOAD;
+ order.flags = OF_PART_OF_ORDERS;
order.station = GetDepotByTile(tile)->index;
return order;
}
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index 2450387ca..d868624c7 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -334,8 +334,10 @@ int32 CmdSendRoadVehToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (v->current_order.type == OT_GOTO_DEPOT) {
if (flags & DC_EXEC) {
- if (v->current_order.flags & OF_UNLOAD)
+
+ if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
v->cur_order_index++;
+
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -349,7 +351,7 @@ int32 CmdSendRoadVehToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
+ v->current_order.flags = OF_NON_STOP | OF_HALT_IN_DEPOT;
v->current_order.station = depot->index;
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -1531,9 +1533,9 @@ void RoadVehEnterDepot(Vehicle *v)
v->current_order.flags = 0;
// Part of the orderlist?
- if (t.flags & OF_UNLOAD) {
+ if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
v->cur_order_index++;
- } else if (t.flags & OF_FULL_LOAD) {
+ } else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SetDParam(0, v->unitnumber);
@@ -1583,7 +1585,7 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
// Don't interfere with a depot visit scheduled by the user, or a
// depot visit by the order list.
if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_FULL_LOAD | OF_UNLOAD)) != 0)
+ (v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0)
return;
//If we already got a slot at a stop, use that FIRST, and go to a depot later
diff --git a/ship_cmd.c b/ship_cmd.c
index b8588ede1..3ccf8c11c 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -108,7 +108,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
return;
if (v->current_order.type == OT_GOTO_DEPOT &&
- v->current_order.flags & OF_FULL_LOAD)
+ v->current_order.flags & OF_HALT_IN_DEPOT)
return;
if (_patches.gotodepot && VehicleHasDepotOrders(v))
@@ -430,9 +430,9 @@ static void ShipEnterDepot(Vehicle *v)
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
- if (t.flags & OF_UNLOAD) {
+ if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
v->cur_order_index++;
- } else if (t.flags & OF_FULL_LOAD) {
+ } else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SetDParam(0, v->unitnumber);
@@ -993,7 +993,10 @@ int32 CmdSendShipToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (v->current_order.type == OT_GOTO_DEPOT) {
if (flags & DC_EXEC) {
- if (v->current_order.flags & OF_UNLOAD) v->cur_order_index++;
+
+ if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
+ v->cur_order_index++;
+
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -1006,7 +1009,7 @@ int32 CmdSendShipToDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
v->dest_tile = depot->xy;
v->current_order.type = OT_GOTO_DEPOT;
- v->current_order.flags = OF_NON_STOP | OF_FULL_LOAD;
+ v->current_order.flags = OF_NON_STOP | OF_HALT_IN_DEPOT;
v->current_order.station = depot->index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
diff --git a/train_cmd.c b/train_cmd.c
index 20946bc78..22b9801d4 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -1353,7 +1353,7 @@ int32 CmdTrainGotoDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (v->current_order.type == OT_GOTO_DEPOT) {
if (flags & DC_EXEC) {
- if (v->current_order.flags & OF_UNLOAD) {
+ if (HASBIT(v->current_order.flags, OF_PART_OF_ORDERS)) {
v->u.rail.days_since_order_progr = 0;
v->cur_order_index++;
}
@@ -2956,10 +2956,10 @@ void TrainEnterDepot(Vehicle *v, uint tile)
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
- if (t.flags & OF_UNLOAD) { // Part of the orderlist?
+ if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) { // Part of the orderlist?
v->u.rail.days_since_order_progr = 0;
v->cur_order_index++;
- } else if (t.flags & OF_FULL_LOAD) { // User initiated?
+ } else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) { // User initiated?
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
SetDParam(0, v->unitnumber);
@@ -2995,7 +2995,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
// Don't interfere with a depot visit scheduled by the user, or a
// depot visit by the order list.
if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_FULL_LOAD | OF_UNLOAD)) != 0)
+ (v->current_order.flags & (OF_HALT_IN_DEPOT | OF_PART_OF_ORDERS)) != 0)
return;
tfdd = FindClosestTrainDepot(v);