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