Mercurial > hg > openttd
annotate src/order_base.h @ 12538:6e39a114ed49 draft
(svn r16976) -Codechange: remove WaypointID and MAX_LENGTH constants in favour of their Station variants
author | rubidium <rubidium@openttd.org> |
---|---|
date | Tue, 28 Jul 2009 21:06:38 +0000 |
parents | 8e20cb543b87 |
children | bc7926153e19 |
rev | line source |
---|---|
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
9111
d48433370037
(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 <rubidium@openttd.org>
parents:
8900
diff
changeset
|
3 /** @file order_base.h Base class for orders. */ |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
4 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
5 #ifndef ORDER_BASE_H |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
6 #define ORDER_BASE_H |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
7 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
8 #include "order_type.h" |
11974
5328e400636a
(svn r16380) -Codechange: rename pool.hpp to pool_type.hpp
smatz <smatz@openttd.org>
parents:
11972
diff
changeset
|
9 #include "core/pool_type.hpp" |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
10 #include "core/bitmath_func.hpp" |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 #include "cargo_type.h" |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
12 #include "depot_type.h" |
8832
870ff040ec3e
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium <rubidium@openttd.org>
parents:
8784
diff
changeset
|
13 #include "station_type.h" |
870ff040ec3e
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium <rubidium@openttd.org>
parents:
8784
diff
changeset
|
14 #include "vehicle_type.h" |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
15 |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
16 typedef Pool<Order, OrderID, 256, 64000> OrderPool; |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
17 typedef Pool<OrderList, OrderListID, 128, 64000> OrderListPool; |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
18 extern OrderPool _order_pool; |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
19 extern OrderListPool _orderlist_pool; |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 /* If you change this, keep in mind that it is saved on 3 places: |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 * - Load_ORDR, all the global orders |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
23 * - Vehicle -> current_order |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 * - REF_ORDER (all REFs are currently limited to 16 bits!!) |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 */ |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
26 struct Order : OrderPool::PoolItem<&_order_pool> { |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
27 private: |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
28 friend const struct SaveLoad *GetVehicleDescription(VehicleType vt); ///< Saving and loading the current order of vehicles. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
29 friend void Load_VEHS(); ///< Loading of ancient vehicles. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
30 friend const struct SaveLoad *GetOrderDescription(); ///< Saving and loading of orders. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
31 |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
32 uint8 type; ///< The type of order + non-stop flags |
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
33 uint8 flags; ///< Load/unload types, depot order/action types. |
8840
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
34 DestinationID dest; ///< The destination of the order. |
8838
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
35 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
36 CargoID refit_cargo; ///< Refit CargoID |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
37 byte refit_subtype; ///< Refit subtype |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
38 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
39 public: |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
40 Order *next; ///< Pointer to next order. If NULL, end of list |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
41 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
42 uint16 wait_time; ///< How long in ticks to wait at the destination. |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
43 uint16 travel_time; ///< How long in ticks the journey to this destination should take. |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
44 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
45 Order() : refit_cargo(CT_NO_REFIT) {} |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
46 ~Order() {} |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
47 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
48 /** |
8839
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
49 * Create an order based on a packed representation of that order. |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
50 * @param packed the packed representation. |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
51 */ |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
52 Order(uint32 packed); |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
53 |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
54 /** |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
55 * Check whether this order is of the given type. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
56 * @param type the type to check against. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
57 * @return true if the order matches. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
58 */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
59 inline bool IsType(OrderType type) const { return this->GetType() == type; } |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
60 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
61 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
62 * Get the type of order of this order. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
63 * @return the order type. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
64 */ |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
65 inline OrderType GetType() const { return (OrderType)GB(this->type, 0, 4); } |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
66 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
67 /** |
8834
a2a57c9df9c9
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium <rubidium@openttd.org>
parents:
8832
diff
changeset
|
68 * 'Free' the order |
a2a57c9df9c9
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium <rubidium@openttd.org>
parents:
8832
diff
changeset
|
69 * @note ONLY use on "current_order" vehicle orders! |
a2a57c9df9c9
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium <rubidium@openttd.org>
parents:
8832
diff
changeset
|
70 */ |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
71 void Free(); |
8834
a2a57c9df9c9
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium <rubidium@openttd.org>
parents:
8832
diff
changeset
|
72 |
a2a57c9df9c9
(svn r12582) -Codechange: move some (needlessly) static inlined functions from order_base.h to order_cmd.cpp.
rubidium <rubidium@openttd.org>
parents:
8832
diff
changeset
|
73 /** |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
74 * Makes this order a Go To Station order. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
75 * @param destsination the station to go to. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
76 */ |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
77 void MakeGoToStation(StationID destination); |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
78 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
79 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
80 * Makes this order a Go To Depot order. |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
81 * @param destination the depot to go to. |
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
82 * @param order is this order a 'default' order, or an overriden vehicle order? |
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
83 * @param non_stop_type how to get to the depot? |
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
84 * @param action what to do in the depot? |
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
85 * @param cargo the cargo type to change to. |
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
86 * @param subtype the subtype to change to. |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
87 */ |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
88 void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type = ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action = ODATF_SERVICE_ONLY, CargoID cargo = CT_NO_REFIT, byte subtype = 0); |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
89 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
90 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
91 * Makes this order a Go To Waypoint order. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
92 * @param destination the waypoint to go to. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
93 */ |
12538
6e39a114ed49
(svn r16976) -Codechange: remove WaypointID and MAX_LENGTH constants in favour of their Station variants
rubidium <rubidium@openttd.org>
parents:
12199
diff
changeset
|
94 void MakeGoToWaypoint(StationID destination); |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
95 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
96 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
97 * Makes this order a Loading order. |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
98 * @param ordered is this an ordered stop? |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
99 */ |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
100 void MakeLoading(bool ordered); |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
101 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
102 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
103 * Makes this order a Leave Station order. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
104 */ |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
105 void MakeLeaveStation(); |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
106 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
107 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
108 * Makes this order a Dummy order. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
109 */ |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
110 void MakeDummy(); |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
111 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
112 /** |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
113 * Makes this order an conditional order. |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
114 * @param order the order to jump to. |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
115 */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
116 void MakeConditional(VehicleOrderID order); |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
117 |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
118 /** |
8840
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
119 * Gets the destination of this order. |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
120 * @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION). |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
121 * @return the destination of the order. |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
122 */ |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
123 inline DestinationID GetDestination() const { return this->dest; } |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
124 |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
125 /** |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
126 * Sets the destination of this order. |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
127 * @param destination the new destination of the order. |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
128 * @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION). |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
129 */ |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
130 inline void SetDestination(DestinationID destination) { this->dest = destination; } |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
131 |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
132 /** |
8838
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
133 * Is this order a refit order. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
134 * @pre IsType(OT_GOTO_DEPOT) |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
135 * @return true if a refit should happen. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
136 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
137 inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO; } |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
138 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
139 /** |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
140 * Get the cargo to to refit to. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
141 * @pre IsType(OT_GOTO_DEPOT) |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
142 * @return the cargo type. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
143 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
144 inline CargoID GetRefitCargo() const { return this->refit_cargo; } |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
145 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
146 /** |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
147 * Get the cargo subtype to to refit to. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
148 * @pre IsType(OT_GOTO_DEPOT) |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
149 * @return the cargo subtype. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
150 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
151 inline byte GetRefitSubtype() const { return this->refit_subtype; } |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
152 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
153 /** |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
154 * Make this depot order also a refit order. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
155 * @param cargo the cargo type to change to. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
156 * @param subtype the subtype to change to. |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
157 * @pre IsType(OT_GOTO_DEPOT). |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
158 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
159 void SetRefit(CargoID cargo, byte subtype = 0); |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
160 |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
161 /** How must the consist be loaded? */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
162 inline OrderLoadFlags GetLoadType() const { return (OrderLoadFlags)GB(this->flags, 4, 4); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
163 /** How must the consist be unloaded? */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
164 inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 4); } |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
165 /** At which stations must we stop? */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
166 inline OrderNonStopFlags GetNonStopType() const { return (OrderNonStopFlags)GB(this->type, 6, 2); } |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
167 /** Where must we stop at the platform? */ |
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
168 inline OrderStopLocation GetStopLocation() const { return (OrderStopLocation)GB(this->type, 4, 2); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
169 /** What caused us going to the depot? */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
170 inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)GB(this->flags, 0, 4); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
171 /** What are we going to do when in the depot. */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
172 inline OrderDepotActionFlags GetDepotActionType() const { return (OrderDepotActionFlags)GB(this->flags, 4, 4); } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
173 /** What variable do we have to compare? */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
174 inline OrderConditionVariable GetConditionVariable() const { return (OrderConditionVariable)GB(this->dest, 11, 5); } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
175 /** What is the comparator to use? */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
176 inline OrderConditionComparator GetConditionComparator() const { return (OrderConditionComparator)GB(this->type, 5, 3); } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
177 /** Get the order to skip to. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
178 inline VehicleOrderID GetConditionSkipToOrder() const { return this->flags; } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
179 /** Get the value to base the skip on. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
180 inline uint16 GetConditionValue() const { return GB(this->dest, 0, 11); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
181 |
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
182 /** Set how the consist must be loaded. */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
183 inline void SetLoadType(OrderLoadFlags load_type) { SB(this->flags, 4, 4, load_type); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
184 /** Set how the consist must be unloaded. */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
185 inline void SetUnloadType(OrderUnloadFlags unload_type) { SB(this->flags, 0, 4, unload_type); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
186 /** Set whether we must stop at stations or not. */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
187 inline void SetNonStopType(OrderNonStopFlags non_stop_type) { SB(this->type, 6, 2, non_stop_type); } |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
188 /** Set where we must stop at the platform. */ |
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
189 inline void SetStopLocation(OrderStopLocation stop_location) { SB(this->type, 4, 2, stop_location); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
190 /** Set the cause to go to the depot. */ |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
191 inline void SetDepotOrderType(OrderDepotTypeFlags depot_order_type) { SB(this->flags, 0, 4, depot_order_type); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
192 /** Set what we are going to do in the depot. */ |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
193 inline void SetDepotActionType(OrderDepotActionFlags depot_service_type) { SB(this->flags, 4, 4, depot_service_type); } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
194 /** Set variable we have to compare. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
195 inline void SetConditionVariable(OrderConditionVariable condition_variable) { SB(this->dest, 11, 5, condition_variable); } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
196 /** Set the comparator to use. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
197 inline void SetConditionComparator(OrderConditionComparator condition_comparator) { SB(this->type, 5, 3, condition_comparator); } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
198 /** Get the order to skip to. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
199 inline void SetConditionSkipToOrder(VehicleOrderID order_id) { this->flags = order_id; } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
200 /** Set the value to base the skip on. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
201 inline void SetConditionValue(uint16 value) { SB(this->dest, 0, 11, value); } |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
202 |
8832
870ff040ec3e
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium <rubidium@openttd.org>
parents:
8784
diff
changeset
|
203 bool ShouldStopAtStation(const Vehicle *v, StationID station) const; |
8835
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
204 |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
205 /** Checks if this order has travel_time and if needed wait_time set. */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
206 inline bool IsCompletelyTimetabled() const |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
207 { |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
208 if (this->travel_time == 0 && !this->IsType(OT_CONDITIONAL)) return false; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
209 if (this->wait_time == 0 && this->IsType(OT_GOTO_STATION) && !(this->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) return false; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
210 return true; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
211 } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
212 |
8835
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
213 /** |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
214 * Assign the given order to this one. |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
215 * @param other the data to copy (except next pointer). |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
216 */ |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
217 void AssignOrder(const Order &other); |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
218 |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
219 /** |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
220 * Does this order have the same type, flags and destination? |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
221 * @param other the second order to compare to. |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
222 * @return true if the type, flags and destination match. |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
223 */ |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
224 bool Equals(const Order &other) const; |
8839
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
225 |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
226 /** |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
227 * Pack this order into a 32 bits integer, or actually only |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
228 * the type, flags and destination. |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
229 * @return the packed representation. |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
230 * @note unpacking is done in the constructor. |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
231 */ |
ebb630745ebc
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium <rubidium@openttd.org>
parents:
8838
diff
changeset
|
232 uint32 Pack() const; |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
233 |
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
234 /** |
12199
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
235 * Pack this order into a 16 bits integer as close to the TTD |
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
236 * representation as possible. |
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
237 * @return the TTD-like packed representation. |
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
238 */ |
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
239 uint16 MapOldOrder() const; |
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
240 |
8e20cb543b87
(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges
yexo <yexo@openttd.org>
parents:
11974
diff
changeset
|
241 /** |
8881
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
242 * Converts this order from an old savegame's version; |
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
243 * it moves all bits to the new location. |
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
244 */ |
4fd35184e35f
(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 <rubidium@openttd.org>
parents:
8873
diff
changeset
|
245 void ConvertFromOldSavegame(); |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
246 }; |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
247 |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
248 /** Shared order list linking together the linked list of orders and the list |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
249 * of vehicles sharing this order list. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
250 */ |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
251 struct OrderList : OrderListPool::PoolItem<&_orderlist_pool> { |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
252 private: |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
253 friend void AfterLoadVehicles(bool part_of_load); ///< For instantiating the shared vehicle chain |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
254 friend const struct SaveLoad *GetOrderListDescription(); ///< Saving and loading of order lists. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
255 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
256 Order *first; ///< First order of the order list |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
257 VehicleOrderID num_orders; ///< NOSAVE: How many orders there are in the list |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
258 uint num_vehicles; ///< NOSAVE: Number of vehicles that share this order list |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
259 Vehicle *first_shared; ///< NOSAVE: pointer to the first vehicle in the shared order chain |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
260 |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
261 uint timetable_duration; ///< NOSAVE: Total duration of the order list |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
262 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
263 public: |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
264 /** Default constructor producing an invalid order list. */ |
11935
afd8caa1ae0d
(svn r16338) -Codechange: split loading of references to two phases
smatz <smatz@openttd.org>
parents:
11930
diff
changeset
|
265 OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID) |
afd8caa1ae0d
(svn r16338) -Codechange: split loading of references to two phases
smatz <smatz@openttd.org>
parents:
11930
diff
changeset
|
266 : first(NULL), num_orders(num_orders), num_vehicles(0), first_shared(NULL), |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
267 timetable_duration(0) { } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
268 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
269 /** Create an order list with the given order chain for the given vehicle. |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
270 * @param chain pointer to the first order of the order chain |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
271 * @param v any vehicle using this orderlist |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
272 */ |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
273 OrderList(Order *chain, Vehicle *v) { this->Initialize(chain, v); } |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
274 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
275 /** Destructor. Invalidates OrderList for re-usage by the pool. */ |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
276 ~OrderList() {} |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
277 |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
278 /** |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
279 * Recomputes everything. |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
280 * @param chain first order in the chain |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
281 * @param v one of vehicle that is using this orderlist |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
282 */ |
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11971
diff
changeset
|
283 void Initialize(Order *chain, Vehicle *v); |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
284 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
285 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
286 * Get the first order of the order chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
287 * @return the first order of the chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
288 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
289 inline Order *GetFirstOrder() const { return this->first; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
290 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
291 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
292 * Get a certain order of the order chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
293 * @param index zero-based index of the order within the chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
294 * @return the order at position index. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
295 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
296 Order *GetOrderAt(int index) const; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
297 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
298 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
299 * Get the last order of the order chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
300 * @return the last order of the chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
301 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
302 inline Order *GetLastOrder() const { return this->GetOrderAt(this->num_orders - 1); } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
303 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
304 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
305 * Get number of orders in the order list. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
306 * @return number of orders in the chain. */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
307 inline VehicleOrderID GetNumOrders() const { return this->num_orders; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
308 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
309 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
310 * Insert a new order into the order chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
311 * @param new_order is the order to insert into the chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
312 * @param index is the position where the order is supposed to be inserted. */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
313 void InsertOrderAt(Order *new_order, int index); |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
314 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
315 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
316 * Remove an order from the order list and delete it. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
317 * @param index is the position of the order which is to be deleted. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
318 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
319 void DeleteOrderAt(int index); |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
320 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
321 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
322 * Move an order to another position within the order list. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
323 * @param from is the zero-based position of the order to move. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
324 * @param to is the zero-based position where the order is moved to. */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
325 void MoveOrder(int from, int to); |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
326 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
327 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
328 * Is this a shared order list? |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
329 * @return whether this order list is shared among multiple vehicles |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
330 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
331 inline bool IsShared() const { return this->num_vehicles > 1; }; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
332 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
333 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
334 * Get the first vehicle of this vehicle chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
335 * @return the first vehicle of the chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
336 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
337 inline Vehicle *GetFirstSharedVehicle() const { return this->first_shared; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
338 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
339 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
340 * Return the number of vehicles that share this orders list |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
341 * @return the count of vehicles that use this shared orders list |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
342 */ |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
343 inline uint GetNumVehicles() const { return this->num_vehicles; } |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
344 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
345 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
346 * Checks whether a vehicle is part of the shared vehicle chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
347 * @param v is the vehicle to search in the shared vehicle chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
348 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
349 bool IsVehicleInSharedOrdersList(const Vehicle *v) const; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
350 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
351 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
352 * Gets the position of the given vehicle within the shared order vehicle list. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
353 * @param v is the vehicle of which to get the position |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
354 * @return position of v within the shared vehicle chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
355 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
356 int GetPositionInSharedOrderList(const Vehicle *v) const; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
357 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
358 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
359 * Adds the given vehicle to this shared order list. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
360 * @note This is supposed to be called after the vehicle has been inserted |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
361 * into the shared vehicle chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
362 * @param v vehicle to add to the list |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
363 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
364 inline void AddVehicle(Vehicle *v) { ++this->num_vehicles; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
365 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
366 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
367 * Removes the vehicle from the shared order list. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
368 * @note This is supposed to be called when the vehicle is still in the chain |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
369 * @param v vehicle to remove from the list |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
370 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
371 void RemoveVehicle(Vehicle *v); |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
372 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
373 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
374 * Checks whether all orders of the list have a filled timetable. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
375 * @return whether all orders have a filled timetable. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
376 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
377 bool IsCompleteTimetable() const; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
378 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
379 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
380 * Gets the total duration of the vehicles timetable or -1 is the timetable is not complete. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
381 * @return total timetable duration or -1 for incomplete timetables |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
382 */ |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
383 inline int GetTimetableTotalDuration() const { return this->IsCompleteTimetable() ? (int)this->timetable_duration : -1; } |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
384 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
385 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
386 * Gets the known duration of the vehicles timetable even if the timetable is not complete. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
387 * @return known timetable duration |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
388 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
389 inline int GetTimetableDurationIncomplete() const { return this->timetable_duration; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
390 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
391 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
392 * Must be called if an order's timetable is changed to update internal book keeping. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
393 * @param delta By how many ticks has the timetable duration changed |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
394 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
395 void UpdateOrderTimetable(int delta) { this->timetable_duration += delta; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
396 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
397 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
398 * Must be called if the whole timetable is cleared to update internal book keeping. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
399 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
400 void ResetOrderTimetable() { this->timetable_duration = 0; } |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
401 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
402 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
403 * Free a complete order chain. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
404 * @param keep_orderlist If this is true only delete the orders, otherwise also delete the OrderList. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
405 * @note do not use on "current_order" vehicle orders! |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
406 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
407 void FreeChain(bool keep_orderlist = false); |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
408 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
409 /** |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
410 * Checks for internal consistency of order list. Triggers assertion if something is wrong. |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
411 */ |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
412 void DebugCheckSanity() const; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
413 }; |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
414 |
11971
9daf69237623
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents:
11935
diff
changeset
|
415 #define FOR_ALL_ORDERS_FROM(var, start) FOR_ALL_ITEMS_FROM(Order, order_index, var, start) |
9daf69237623
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents:
11935
diff
changeset
|
416 #define FOR_ALL_ORDERS(var) FOR_ALL_ORDERS_FROM(var, 0) |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
417 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
418 |
10546
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
419 #define FOR_VEHICLE_ORDERS(v, order) for (order = (v->orders.list == NULL) ? NULL : v->orders.list->GetFirstOrder(); order != NULL; order = order->next) |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
420 |
9ceef3c92be2
(svn r14803) -Codechange: move order list management into it's own class and remove the order count from the savegame as we can easily count that (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10350
diff
changeset
|
421 |
11971
9daf69237623
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents:
11935
diff
changeset
|
422 #define FOR_ALL_ORDER_LISTS_FROM(var, start) FOR_ALL_ITEMS_FROM(OrderList, orderlist_index, var, start) |
9daf69237623
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
smatz <smatz@openttd.org>
parents:
11935
diff
changeset
|
423 #define FOR_ALL_ORDER_LISTS(var) FOR_ALL_ORDER_LISTS_FROM(var, 0) |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
424 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
425 #endif /* ORDER_H */ |