author | rubidium |
Sun, 25 May 2008 19:17:03 +0000 | |
changeset 9354 | 845e07db4549 |
parent 9111 | 48ce04029fe4 |
child 10350 | a0b562efddd1 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8900
diff
changeset
|
3 |
/** @file order_base.h Base class for orders. */ |
2214
056bbc3c8236
(svn r2732) -Codechange: Cleaned the order flags some more. Hit some inconsistencies while trying to locate bug 1244167
celestar
parents:
2186
diff
changeset
|
4 |
|
8784
c2e9d649a9ce
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents:
8771
diff
changeset
|
5 |
#ifndef ORDER_BASE_H |
c2e9d649a9ce
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents:
8771
diff
changeset
|
6 |
#define ORDER_BASE_H |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
7 |
|
8771
cab6fdd47703
(svn r12470) -Codechange: split order related types from order.h (and openttd.h) to order_type.h.
rubidium
parents:
8770
diff
changeset
|
8 |
#include "order_type.h" |
5216
8bd14ee39af2
(svn r7331) - Codechange: Rename all memory pool macro's and types to "old pool", so the new pool implementation can be committed alongside it.
matthijs
parents:
4977
diff
changeset
|
9 |
#include "oldpool.h" |
8113
31b7784db761
(svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents:
7653
diff
changeset
|
10 |
#include "core/bitmath_func.hpp" |
8119
52b48108425a
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8113
diff
changeset
|
11 |
#include "cargo_type.h" |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
12 |
#include "depot_type.h" |
8832
6d8cc04d39a4
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium
parents:
8784
diff
changeset
|
13 |
#include "station_type.h" |
6d8cc04d39a4
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium
parents:
8784
diff
changeset
|
14 |
#include "vehicle_type.h" |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
15 |
#include "waypoint_type.h" |
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
16 |
|
7391
8c87aec393c7
(svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents:
7375
diff
changeset
|
17 |
DECLARE_OLD_POOL(Order, Order, 6, 1000) |
8c87aec393c7
(svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents:
7375
diff
changeset
|
18 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
19 |
/* If you change this, keep in mind that it is saved on 3 places: |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3347
diff
changeset
|
20 |
* - Load_ORDR, all the global orders |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3347
diff
changeset
|
21 |
* - Vehicle -> current_order |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6263
diff
changeset
|
22 |
* - REF_ORDER (all REFs are currently limited to 16 bits!!) |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
3347
diff
changeset
|
23 |
*/ |
7391
8c87aec393c7
(svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents:
7375
diff
changeset
|
24 |
struct Order : PoolItem<Order, OrderID, &_Order_pool> { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
25 |
private: |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
26 |
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt); ///< Saving and loading the current order of vehicles. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
27 |
friend void Load_VEHS(); ///< Loading of ancient vehicles. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
28 |
friend const struct SaveLoad *GetOrderDescription(); ///< Saving and loading of orders. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
29 |
|
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
30 |
uint8 type; ///< The type of order + non-stop flags |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
31 |
uint8 flags; ///< Load/unload types, depot order/action types. |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
32 |
DestinationID dest; ///< The destination of the order. |
8838
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
33 |
|
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
34 |
CargoID refit_cargo; ///< Refit CargoID |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
35 |
byte refit_subtype; ///< Refit subtype |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
36 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
37 |
public: |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
38 |
Order *next; ///< Pointer to next order. If NULL, end of list |
5938 | 39 |
|
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6263
diff
changeset
|
40 |
uint16 wait_time; ///< How long in ticks to wait at the destination. |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6263
diff
changeset
|
41 |
uint16 travel_time; ///< How long in ticks the journey to this destination should take. |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6263
diff
changeset
|
42 |
|
7391
8c87aec393c7
(svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents:
7375
diff
changeset
|
43 |
Order() : refit_cargo(CT_NO_REFIT) {} |
8c87aec393c7
(svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents:
7375
diff
changeset
|
44 |
~Order() { this->type = OT_NOTHING; } |
8c87aec393c7
(svn r10760) -Codechange: make the order struct use the pool item class as super class.
rubidium
parents:
7375
diff
changeset
|
45 |
|
7496
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7391
diff
changeset
|
46 |
/** |
8839
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
47 |
* Create an order based on a packed representation of that order. |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
48 |
* @param packed the packed representation. |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
49 |
*/ |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
50 |
Order(uint32 packed); |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
51 |
|
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
52 |
/** |
7496
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7391
diff
changeset
|
53 |
* Check if a Order really exists. |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
54 |
* @return true if the order is valid. |
7496
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7391
diff
changeset
|
55 |
*/ |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7391
diff
changeset
|
56 |
inline bool IsValid() const { return this->type != OT_NOTHING; } |
49cec492627b
(svn r11009) -Codechange: unvirtualise IsValid as that isn't needed with templates. This gives up to 10% performance increase in games with lots of vehicles.
rubidium
parents:
7391
diff
changeset
|
57 |
|
8834
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
58 |
/** |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
59 |
* Check whether this order is of the given type. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
60 |
* @param type the type to check against. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
61 |
* @return true if the order matches. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
62 |
*/ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
63 |
inline bool IsType(OrderType type) const { return this->GetType() == type; } |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
64 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
65 |
/** |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
66 |
* Get the type of order of this order. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
67 |
* @return the order type. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
68 |
*/ |
8900
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
69 |
inline OrderType GetType() const { return (OrderType)GB(this->type, 0, 4); } |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
70 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
71 |
/** |
8834
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
72 |
* 'Free' the order |
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
73 |
* @note ONLY use on "current_order" vehicle orders! |
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
74 |
*/ |
6263
6bd0726c74e2
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6248
diff
changeset
|
75 |
void Free(); |
8834
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
76 |
|
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
77 |
/** |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
78 |
* Makes this order a Go To Station order. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
79 |
* @param destsination the station to go to. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
80 |
*/ |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
81 |
void MakeGoToStation(StationID destination); |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
82 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
83 |
/** |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
84 |
* Makes this order a Go To Depot order. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
85 |
* @param destination the depot to go to. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
86 |
* @param order is this order a 'default' order, or an overriden vehicle order? |
8838
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
87 |
* @param cargo the cargo type to change to. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
88 |
* @param subtype the subtype to change to. |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
89 |
*/ |
8853
3266f0374302
(svn r12615) -Codechange: rename some enums related to depot orders to make it more clear that they are no loading/unloading flags. Also add more type strictness.
rubidium
parents:
8848
diff
changeset
|
90 |
void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, CargoID cargo = CT_NO_REFIT, byte subtype = 0); |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
91 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
92 |
/** |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
93 |
* Makes this order a Go To Waypoint order. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
94 |
* @param destination the waypoint to go to. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
95 |
*/ |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
96 |
void MakeGoToWaypoint(WaypointID destination); |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
97 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
98 |
/** |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
99 |
* Makes this order a Loading order. |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
100 |
* @param ordered is this an ordered stop? |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
101 |
*/ |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
102 |
void MakeLoading(bool ordered); |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
103 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
104 |
/** |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
105 |
* Makes this order a Leave Station order. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
106 |
*/ |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
107 |
void MakeLeaveStation(); |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
108 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
109 |
/** |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
110 |
* Makes this order a Dummy order. |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
111 |
*/ |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
112 |
void MakeDummy(); |
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
113 |
|
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8835
diff
changeset
|
114 |
/** |
8900
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
115 |
* Makes this order an conditional order. |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
116 |
* @param order the order to jump to. |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
117 |
*/ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
118 |
void MakeConditional(VehicleOrderID order); |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
119 |
|
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
120 |
/** |
8834
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
121 |
* Free a complete order chain. |
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
122 |
* @note do not use on "current_order" vehicle orders! |
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
123 |
*/ |
6263
6bd0726c74e2
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6248
diff
changeset
|
124 |
void FreeChain(); |
8832
6d8cc04d39a4
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium
parents:
8784
diff
changeset
|
125 |
|
8838
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
126 |
/** |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
127 |
* Gets the destination of this order. |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
128 |
* @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION). |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
129 |
* @return the destination of the order. |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
130 |
*/ |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
131 |
inline DestinationID GetDestination() const { return this->dest; } |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
132 |
|
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
133 |
/** |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
134 |
* Sets the destination of this order. |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
135 |
* @param destination the new destination of the order. |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
136 |
* @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION). |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
137 |
*/ |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
138 |
inline void SetDestination(DestinationID destination) { this->dest = destination; } |
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
139 |
|
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
140 |
/** |
8838
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
141 |
* Is this order a refit order. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
142 |
* @pre IsType(OT_GOTO_DEPOT) |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
143 |
* @return true if a refit should happen. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
144 |
*/ |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
145 |
inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO; } |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
146 |
|
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
147 |
/** |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
148 |
* Get the cargo to to refit to. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
149 |
* @pre IsType(OT_GOTO_DEPOT) |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
150 |
* @return the cargo type. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
151 |
*/ |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
152 |
inline CargoID GetRefitCargo() const { return this->refit_cargo; } |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
153 |
|
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
154 |
/** |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
155 |
* Get the cargo subtype to to refit to. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
156 |
* @pre IsType(OT_GOTO_DEPOT) |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
157 |
* @return the cargo subtype. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
158 |
*/ |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
159 |
inline byte GetRefitSubtype() const { return this->refit_subtype; } |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
160 |
|
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
161 |
/** |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
162 |
* Make this depot order also a refit order. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
163 |
* @param cargo the cargo type to change to. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
164 |
* @param subtype the subtype to change to. |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
165 |
* @pre IsType(OT_GOTO_DEPOT). |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
166 |
*/ |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
167 |
void SetRefit(CargoID cargo, byte subtype = 0); |
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
168 |
|
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
169 |
/** How must the consist be loaded? */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
170 |
inline OrderLoadFlags GetLoadType() const { return (OrderLoadFlags)GB(this->flags, 4, 4); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
171 |
/** How must the consist be unloaded? */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
172 |
inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 4); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
173 |
/** Where must we stop? */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
174 |
inline OrderNonStopFlags GetNonStopType() const { return (OrderNonStopFlags)GB(this->type, 6, 2); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
175 |
/** What caused us going to the depot? */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
176 |
inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)GB(this->flags, 0, 4); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
177 |
/** What are we going to do when in the depot. */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
178 |
inline OrderDepotActionFlags GetDepotActionType() const { return (OrderDepotActionFlags)GB(this->flags, 4, 4); } |
8900
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
179 |
/** What variable do we have to compare? */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
180 |
inline OrderConditionVariable GetConditionVariable() const { return (OrderConditionVariable)GB(this->dest, 11, 5); } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
181 |
/** What is the comparator to use? */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
182 |
inline OrderConditionComparator GetConditionComparator() const { return (OrderConditionComparator)GB(this->type, 5, 3); } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
183 |
/** Get the order to skip to. */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
184 |
inline VehicleOrderID GetConditionSkipToOrder() const { return this->flags; } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
185 |
/** Get the value to base the skip on. */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
186 |
inline uint16 GetConditionValue() const { return GB(this->dest, 0, 11); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
187 |
|
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
188 |
/** Set how the consist must be loaded. */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
189 |
inline void SetLoadType(OrderLoadFlags load_type) { SB(this->flags, 4, 4, load_type); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
190 |
/** Set how the consist must be unloaded. */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
191 |
inline void SetUnloadType(OrderUnloadFlags unload_type) { SB(this->flags, 0, 4, unload_type); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
192 |
/** Set whether we must stop at stations or not. */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
193 |
inline void SetNonStopType(OrderNonStopFlags non_stop_type) { SB(this->type, 6, 2, non_stop_type); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
194 |
/** Set the cause to go to the depot. */ |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
195 |
inline void SetDepotOrderType(OrderDepotTypeFlags depot_order_type) { SB(this->flags, 0, 4, depot_order_type); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
196 |
/** Set what we are going to do in the depot. */ |
8900
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
197 |
inline void SetDepotActionType(OrderDepotActionFlags depot_service_type) { SB(this->flags, 4, 4, depot_service_type); } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
198 |
/** Set variable we have to compare. */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
199 |
inline void SetConditionVariable(OrderConditionVariable condition_variable) { SB(this->dest, 11, 5, condition_variable); } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
200 |
/** Set the comparator to use. */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
201 |
inline void SetConditionComparator(OrderConditionComparator condition_comparator) { SB(this->type, 5, 3, condition_comparator); } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
202 |
/** Get the order to skip to. */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
203 |
inline void SetConditionSkipToOrder(VehicleOrderID order_id) { this->flags = order_id; } |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
204 |
/** Set the value to base the skip on. */ |
a49f442299b8
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
8881
diff
changeset
|
205 |
inline void SetConditionValue(uint16 value) { SB(this->dest, 0, 11, value); } |
8843
45fdf630deaa
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium
parents:
8840
diff
changeset
|
206 |
|
8832
6d8cc04d39a4
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium
parents:
8784
diff
changeset
|
207 |
bool ShouldStopAtStation(const Vehicle *v, StationID station) const; |
8835
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
208 |
|
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
209 |
/** |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
210 |
* Assign the given order to this one. |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
211 |
* @param other the data to copy (except next pointer). |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
212 |
*/ |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
213 |
void AssignOrder(const Order &other); |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
214 |
|
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
215 |
/** |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
216 |
* Does this order have the same type, flags and destination? |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
217 |
* @param other the second order to compare to. |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
218 |
* @return true if the type, flags and destination match. |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
219 |
*/ |
8fa962d90b63
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium
parents:
8834
diff
changeset
|
220 |
bool Equals(const Order &other) const; |
8839
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
221 |
|
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
222 |
/** |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
223 |
* Pack this order into a 32 bits integer, or actually only |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
224 |
* the type, flags and destination. |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
225 |
* @return the packed representation. |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
226 |
* @note unpacking is done in the constructor. |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
227 |
*/ |
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
228 |
uint32 Pack() const; |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
229 |
|
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
230 |
/** |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
231 |
* Converts this order from an old savegame's version; |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
232 |
* it moves all bits to the new location. |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
233 |
*/ |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8873
diff
changeset
|
234 |
void ConvertFromOldSavegame(); |
6248
e4a2ed7e5613
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6247
diff
changeset
|
235 |
}; |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
236 |
|
6247 | 237 |
static inline VehicleOrderID GetMaxOrderIndex() |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
238 |
{ |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
239 |
/* TODO - This isn't the real content of the function, but |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
240 |
* with the new pool-system this will be replaced with one that |
5247
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5216
diff
changeset
|
241 |
* _really_ returns the highest index. Now it just returns |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
242 |
* the next safe value we are sure about everything is below. |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
243 |
*/ |
5247
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5216
diff
changeset
|
244 |
return GetOrderPoolSize() - 1; |
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5216
diff
changeset
|
245 |
} |
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5216
diff
changeset
|
246 |
|
6247 | 247 |
static inline VehicleOrderID GetNumOrders() |
5247
1f982de55b88
(svn r7372) - CodeChange: Rename all GetXXXArraySize() functions to GetNumXXX() and add GetMaxXXXIndex() functions. This prepares for the new pool interface.
matthijs
parents:
5216
diff
changeset
|
248 |
{ |
4354
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
249 |
return GetOrderPoolSize(); |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
250 |
} |
10f4ce894eb1
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
truelight
parents:
4351
diff
changeset
|
251 |
|
6263
6bd0726c74e2
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6248
diff
changeset
|
252 |
#define FOR_ALL_ORDERS_FROM(order, start) for (order = GetOrder(start); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) if (order->IsValid()) |
1314
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
253 |
#define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0) |
10c3417e9c22
(svn r1818) -Add: Dynamic orders (up to 64k orders)
truelight
parents:
1093
diff
changeset
|
254 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
255 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
256 |
#define FOR_VEHICLE_ORDERS(v, order) for (order = v->orders; order != NULL; order = order->next) |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
257 |
|
8834
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
258 |
/* (Un)pack routines */ |
136909dfc958
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium
parents:
8832
diff
changeset
|
259 |
Order UnpackOldOrder(uint16 packed); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
260 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
diff
changeset
|
261 |
#endif /* ORDER_H */ |