summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2005-07-28 06:09:15 +0000
committercelestar <celestar@openttd.org>2005-07-28 06:09:15 +0000
commit1e67dfffe7523043855bd200b693b7cbc2309d1a (patch)
treea3a79741bdf384fae93ccb6c2ddb7d60f13ac1e5
parent692b226bb6dd2d630c8d5e2569b73813d3ec5646 (diff)
downloadopenttd-1e67dfffe7523043855bd200b693b7cbc2309d1a.tar.xz
(svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
-rw-r--r--aircraft_cmd.c2
-rw-r--r--order.h48
-rw-r--r--roadveh_cmd.c2
-rw-r--r--ship_cmd.c2
-rw-r--r--train_cmd.c2
5 files changed, 37 insertions, 19 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 9053d0e99..6642ba09d 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -1124,7 +1124,7 @@ static void ProcessAircraftOrder(Vehicle *v)
}
if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
+ (v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
!VehicleNeedsService(v)) {
v->cur_order_index++;
}
diff --git a/order.h b/order.h
index eac4d3efb..e2000231d 100644
--- a/order.h
+++ b/order.h
@@ -1,5 +1,8 @@
/* $Id$ */
+/** @file order.h
+ */
+
#ifndef ORDER_H
#define ORDER_H
@@ -19,29 +22,44 @@ enum {
/* Order flags -- please use OFB instead OF and use HASBIT/SETBIT/CLEARBIT */
-/* Order flag masks - these are for direct bit operations */
-enum {
+/** Order flag masks - these are for direct bit operations */
+enum OrderFlagMasks {
//Flags for stations:
- OF_TRANSFER = 0x1,
- OF_UNLOAD = 0x2,
- OF_FULL_LOAD = 0x4, // Also used when to force an aircraft into a depot
+ /** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */
+ OF_TRANSFER = 0x1,
+ /** If OF_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station.
+ * No new cargo is loaded onto the vehicle whatsoever */
+ OF_UNLOAD = 0x2,
+ /** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting
+ * @todo make this two different flags */
+ OF_FULL_LOAD = 0x4,
//Flags for depots:
- OF_PART_OF_ORDERS = 0x2,
- OF_HALT_IN_DEPOT = 0x4,
+ /** The current depot-order was initiated because it was in the vehicle's order list */
+ OF_PART_OF_ORDERS = 0x2,
+ /** if OF_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
+ OF_HALT_IN_DEPOT = 0x4,
+ /** if OF_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
+ OF_SERVICE_IF_NEEDED = 0x4, //used when OF_PART_OF_ORDERS is set.
//Common flags
- OF_NON_STOP = 0x8
+ /** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings)
+ * @todo make this two different flags */
+ OF_NON_STOP = 0x8
};
-/* Order flags bits - these are for the *BIT macros */
+/** Order flags bits - these are for the *BIT macros
+ * for descrption of flags, see OrderFlagMasks
+ * @see OrderFlagMasks
+ */
enum {
- OFB_TRANSFER = 0,
- OFB_UNLOAD = 1,
- OFB_FULL_LOAD = 2,
- OFB_PART_OF_ORDERS = 1,
- OFB_HALT_IN_DEPOT = 2,
- OFB_NON_STOP = 3
+ OFB_TRANSFER = 0,
+ OFB_UNLOAD = 1,
+ OFB_FULL_LOAD = 2,
+ OFB_PART_OF_ORDERS = 1,
+ OFB_HALT_IN_DEPOT = 2,
+ OFB_SERVICE_IF_NEEDED = 2,
+ OFB_NON_STOP = 3
};
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index cf017a982..e4fe8a275 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -630,7 +630,7 @@ static void ProcessRoadVehOrder(Vehicle *v)
}
if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
+ (v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
!VehicleNeedsService(v)) {
v->cur_order_index++;
}
diff --git a/ship_cmd.c b/ship_cmd.c
index 4a794ea49..cc14449c4 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -220,7 +220,7 @@ static void ProcessShipOrder(Vehicle *v)
}
if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
+ (v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
!VehicleNeedsService(v)) {
v->cur_order_index++;
}
diff --git a/train_cmd.c b/train_cmd.c
index 9dd649376..89477110e 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -2156,7 +2156,7 @@ static bool ProcessTrainOrder(Vehicle *v)
}
if (v->current_order.type == OT_GOTO_DEPOT &&
- (v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
+ (v->current_order.flags & (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED)) == (OF_PART_OF_ORDERS | OF_SERVICE_IF_NEEDED) &&
!VehicleNeedsService(v)) {
v->cur_order_index++;
}