src/order_type.h
author convert-repo
Mon, 07 Apr 2008 16:21:55 +0000
changeset 10076 dfd70e42c4ae
parent 9344 1be7ac6bd504
child 10079 99aba130db3c
permissions -rw-r--r--
update tags
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2159
diff changeset
     2
9267
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
     3
/** @file order_type.h Types related to orders. */
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
     4
9267
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
     5
#ifndef ORDER_TYPE_H
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
     6
#define ORDER_TYPE_H
1314
d6a253cf92c3 (svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents: 1093
diff changeset
     7
9267
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
     8
#include "core/enum_type.hpp"
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
     9
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
    10
typedef byte VehicleOrderID;  ///< The index of an order within its current vehicle (not pool related)
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
    11
typedef uint16 OrderID;
9272
83630e52b5fe (svn r12475) -Codechange: cleanup coding style in news_gui.cpp.
rubidium
parents: 9267
diff changeset
    12
typedef uint16 DestinationID;
9263
0f1ba0ce5839 (svn r12466) -Codechange: move DestinationID to a more logical location.
rubidium
parents: 9146
diff changeset
    13
4408
84ec2899adfa (svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents: 4392
diff changeset
    14
enum {
4712
273ec3b182bf (svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents: 4549
diff changeset
    15
	INVALID_VEH_ORDER_ID = 0xFF,
4408
84ec2899adfa (svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents: 4392
diff changeset
    16
};
84ec2899adfa (svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents: 4392
diff changeset
    17
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    18
static const OrderID INVALID_ORDER = 0xFFFF;
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    19
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    20
/* Order types */
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    21
enum OrderType {
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    22
	OT_BEGIN         = 0,
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    23
	OT_NOTHING       = 0,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    24
	OT_GOTO_STATION  = 1,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    25
	OT_GOTO_DEPOT    = 2,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    26
	OT_LOADING       = 3,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    27
	OT_LEAVESTATION  = 4,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    28
	OT_DUMMY         = 5,
4421
edb874ed70b1 (svn r6176) -Fix r6052: I assumed an typedefd enum would be an uint8, which is a really stupid thing to assume.
truelight
parents: 4414
diff changeset
    29
	OT_GOTO_WAYPOINT = 6,
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    30
	OT_END
4421
edb874ed70b1 (svn r6176) -Fix r6052: I assumed an typedefd enum would be an uint8, which is a really stupid thing to assume.
truelight
parents: 4414
diff changeset
    31
};
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    32
4421
edb874ed70b1 (svn r6176) -Fix r6052: I assumed an typedefd enum would be an uint8, which is a really stupid thing to assume.
truelight
parents: 4414
diff changeset
    33
/* It needs to be 8bits, because we save and load it as such */
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    34
/** Define basic enum properties */
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    35
template <> struct EnumPropsT<OrderType> : MakeEnumPropsT<OrderType, byte, OT_BEGIN, OT_END, OT_END> {};
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    36
typedef TinyEnumT<OrderType> OrderTypeByte;
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5726
diff changeset
    37
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    38
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    39
/* Order flags -- please use OF instead OF and use HASBIT/SETBIT/CLEARBIT */
1615
cee18da24b41 (svn r2119) - Fix: [ 1172878 ] Trains "Go to depot" button: click twice skip to next order (patch by Loic GUILLOUX). I also added short explanation of OF_/OFB_ difference to order.h.
pasky
parents: 1530
diff changeset
    40
2214
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    41
/** Order flag masks - these are for direct bit operations */
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    42
enum OrderFlagMasks {
1530
caa16c506a22 (svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents: 1314
diff changeset
    43
	//Flags for stations:
2214
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    44
	/** vehicle will transfer cargo (i. e. not deliver to nearby industry/town even if accepted there) */
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    45
	OFB_TRANSFER           = 0x1,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    46
	/** If OFB_TRANSFER is not set, drop any cargo loaded. If accepted, deliver, otherwise cargo remains at the station.
2214
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    47
      * No new cargo is loaded onto the vehicle whatsoever */
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    48
	OFB_UNLOAD             = 0x2,
2214
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    49
	/** Wait for full load of all vehicles, or of at least one cargo type, depending on patch setting
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    50
	  * @todo make this two different flags */
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    51
	OFB_FULL_LOAD          = 0x4,
1530
caa16c506a22 (svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents: 1314
diff changeset
    52
caa16c506a22 (svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents: 1314
diff changeset
    53
	//Flags for depots:
2214
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    54
	/** The current depot-order was initiated because it was in the vehicle's order list */
9339
daaa2adbaf99 (svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents: 9272
diff changeset
    55
	OFB_MANUAL_ORDER       = 0x0,
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    56
	OFB_PART_OF_ORDERS     = 0x2,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    57
	/** if OFB_PART_OF_ORDERS is not set, this will cause the vehicle to be stopped in the depot */
9339
daaa2adbaf99 (svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents: 9272
diff changeset
    58
 	OFB_NORMAL_ACTION      = 0x0,
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    59
	OFB_HALT_IN_DEPOT      = 0x4,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    60
	/** if OFB_PART_OF_ORDERS is set, this will cause the order only be come active if the vehicle needs servicing */
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    61
	OFB_SERVICE_IF_NEEDED  = 0x4, //used when OFB_PART_OF_ORDERS is set.
9344
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    62
};
1530
caa16c506a22 (svn r2034) -Codechange: Replaced the rather meaningless LOAD and UNLOAD flags for depots by something more meaningful
celestar
parents: 1314
diff changeset
    63
9344
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    64
/**
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    65
 * Non-stop order flags.
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    66
 */
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    67
enum OrderNonStopFlags {
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    68
	ONSF_STOP_EVERYWHERE                  = 0,
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    69
	ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS = 1,
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    70
	ONSF_NO_STOP_AT_DESTINATION_STATION   = 2,
1be7ac6bd504 (svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents: 9339
diff changeset
    71
	ONSF_NO_STOP_AT_ANY_STATION           = 3
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    72
};
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    73
2214
75d037f8dcc4 (svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents: 2186
diff changeset
    74
/** Order flags bits - these are for the *BIT macros
4077
d3022f976946 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 3347
diff changeset
    75
 * for descrption of flags, see OrderFlagMasks
d3022f976946 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 3347
diff changeset
    76
 * @see OrderFlagMasks
d3022f976946 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 3347
diff changeset
    77
 */
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    78
enum {
8798
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    79
	OF_TRANSFER          = 0,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    80
	OF_UNLOAD            = 1,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    81
	OF_FULL_LOAD         = 2,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    82
	OF_PART_OF_ORDERS    = 1,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    83
	OF_HALT_IN_DEPOT     = 2,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    84
	OF_SERVICE_IF_NEEDED = 2,
eea3a465bd86 (svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents: 8764
diff changeset
    85
	OF_NON_STOP          = 3
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    86
};
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    87
1615
cee18da24b41 (svn r2119) - Fix: [ 1172878 ] Trains "Go to depot" button: click twice skip to next order (patch by Loic GUILLOUX). I also added short explanation of OF_/OFB_ difference to order.h.
pasky
parents: 1530
diff changeset
    88
1024
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    89
/* Possible clone options */
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    90
enum {
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    91
	CO_SHARE   = 0,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    92
	CO_COPY    = 1,
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    93
	CO_UNSHARE = 2
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    94
};
9b06b01490a4 (svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff changeset
    95
7887
5740662fc5ce (svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents: 7871
diff changeset
    96
struct Order;
4384
293c0d26294c (svn r6137) -Codechange: some very minor cleanups:
truelight
parents: 4354
diff changeset
    97
9267
71cf88230dc1 (svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents: 9266
diff changeset
    98
#endif /* ORDER_TYPE_H */