|
1 /* $Id$ */ |
|
2 |
|
3 /** @file order_type.h Types related to orders. */ |
|
4 |
|
5 #ifndef ORDER_TYPE_H |
|
6 #define ORDER_TYPE_H |
|
7 |
|
8 #include "core/enum_type.hpp" |
|
9 |
|
10 typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related) |
|
11 typedef uint16 OrderID; |
|
12 |
|
13 enum { |
|
14 INVALID_VEH_ORDER_ID = 0xFF, |
|
15 }; |
|
16 |
|
17 static const OrderID INVALID_ORDER = 0xFFFF; |
|
18 |
|
19 /* Order types */ |
|
20 enum OrderType { |
|
21 OT_BEGIN = 0, |
|
22 OT_NOTHING = 0, |
|
23 OT_GOTO_STATION = 1, |
|
24 OT_GOTO_DEPOT = 2, |
|
25 OT_LOADING = 3, |
|
26 OT_LEAVESTATION = 4, |
|
27 OT_DUMMY = 5, |
|
28 OT_GOTO_WAYPOINT = 6, |
|
29 OT_END |
|
30 }; |
|
31 |
|
32 /* It needs to be 8bits, because we save and load it as such */ |
|
33 /** Define basic enum properties */ |
|
34 template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BEGIN, OT_END, OT_END> {}; |
|
35 typedef TinyEnumT<OrderType> OrderTypeByte; |
|
36 |
|
37 |
|
38 /* Order flags -- please use OF instead OF and use HASBIT/SETBIT/CLEARBIT */ |
|
39 |
|
40 /** Order flag masks - these are for direct bit operations */ |
|
41 enum OrderFlagMasks { |
|
42 //Flags for stations: |
|
43 /** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */ |
|
44 OFB_TRANSFER = 0x1, |
|
45 /** If OFB_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station. |
|
46 * No new cargo is loaded onto the vehicle whatsoever */ |
|
47 OFB_UNLOAD = 0x2, |
|
48 /** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting |
|
49 * @todo make this two different flags */ |
|
50 OFB_FULL_LOAD = 0x4, |
|
51 |
|
52 //Flags for depots: |
|
53 /** The current depot-order was initiated because it was in the vehicle's order list */ |
|
54 OFB_PART_OF_ORDERS = 0x2, |
|
55 /** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */ |
|
56 OFB_HALT_IN_DEPOT = 0x4, |
|
57 /** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */ |
|
58 OFB_SERVICE_IF_NEEDED = 0x4, //used when OFB_PART_OF_ORDERS is set. |
|
59 |
|
60 //Common flags |
|
61 /** This causes the vehicle not to stop at intermediate OR the destination station (depending on patch settings) |
|
62 * @todo make this two different flags */ |
|
63 OFB_NON_STOP = 0x8 |
|
64 }; |
|
65 |
|
66 /** Order flags bits - these are for the *BIT macros |
|
67 * for descrption of flags, see OrderFlagMasks |
|
68 * @see OrderFlagMasks |
|
69 */ |
|
70 enum { |
|
71 OF_TRANSFER = 0, |
|
72 OF_UNLOAD = 1, |
|
73 OF_FULL_LOAD = 2, |
|
74 OF_PART_OF_ORDERS = 1, |
|
75 OF_HALT_IN_DEPOT = 2, |
|
76 OF_SERVICE_IF_NEEDED = 2, |
|
77 OF_NON_STOP = 3 |
|
78 }; |
|
79 |
|
80 |
|
81 /* Possible clone options */ |
|
82 enum { |
|
83 CO_SHARE = 0, |
|
84 CO_COPY = 1, |
|
85 CO_UNSHARE = 2 |
|
86 }; |
|
87 |
|
88 struct Order; |
|
89 |
|
90 #endif /* ORDER_TYPE_H */ |