Mercurial > hg > openttd
annotate src/order_base.h @ 11930:b17404281f58 draft
(svn r16333) -Cleanup: remove a bunch of unused wrapper functions.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 17 May 2009 11:18:34 +0000 |
parents | fccc9cea27a7 |
children | afd8caa1ae0d |
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" |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
9 #include "oldpool.h" |
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" |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
15 #include "waypoint_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
|
16 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 DECLARE_OLD_POOL(Order, Order, 6, 1000) |
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
|
18 DECLARE_OLD_POOL(OrderList, OrderList, 4, 4000) |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
19 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
20 /* 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
|
21 * - 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
|
22 * - 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
|
23 * - 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
|
24 */ |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 struct Order : PoolItem<Order, OrderID, &_Order_pool> { |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
26 private: |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
27 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
|
28 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
|
29 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
|
30 |
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
|
31 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
|
32 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
|
33 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
|
34 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
35 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
|
36 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
|
37 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
38 public: |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
39 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
|
40 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
41 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
|
42 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
|
43 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
44 Order() : refit_cargo(CT_NO_REFIT) {} |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
45 ~Order() { this->type = OT_NOTHING; } |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
46 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
47 /** |
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
|
48 * 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
|
49 * @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
|
50 */ |
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 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
|
52 |
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 /** |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
54 * Check if a Order really exists. |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
55 * @return true if the order is valid. |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
56 */ |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
57 inline bool IsValid() const { return this->type != OT_NOTHING; } |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
58 |
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
|
59 /** |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
60 * 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
|
61 * @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
|
62 * @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
|
63 */ |
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
|
64 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
|
65 |
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 * 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
|
68 * @return the order type. |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
69 */ |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
70 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
|
71 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
72 /** |
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
|
73 * '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
|
74 * @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
|
75 */ |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
76 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
|
77 |
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
|
78 /** |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
79 * 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
|
80 * @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
|
81 */ |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
82 void MakeGoToStation(StationID destination); |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
83 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
84 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
85 * 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
|
86 * @param destination the depot to go to. |
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
87 * @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
|
88 * @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
|
89 * @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
|
90 * @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
|
91 * @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
|
92 */ |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11657
diff
changeset
|
93 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
|
94 |
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 * 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
|
97 * @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
|
98 */ |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
99 void MakeGoToWaypoint(WaypointID destination); |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
100 |
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 * 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
|
103 * @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
|
104 */ |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
105 void MakeLoading(bool ordered); |
8836
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 Leave Station 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 MakeLeaveStation(); |
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 /** |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
113 * 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
|
114 */ |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
115 void MakeDummy(); |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
116 |
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8835
diff
changeset
|
117 /** |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
118 * Makes this order an conditional order. |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
119 * @param order the order to jump to. |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
120 */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
121 void MakeConditional(VehicleOrderID order); |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
122 |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
123 /** |
8840
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
124 * 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
|
125 * @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
|
126 * @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
|
127 */ |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
128 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
|
129 |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
130 /** |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
131 * 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
|
132 * @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
|
133 * @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
|
134 */ |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
135 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
|
136 |
c3d2f0eb69a1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium <rubidium@openttd.org>
parents:
8839
diff
changeset
|
137 /** |
8838
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
138 * 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
|
139 * @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
|
140 * @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
|
141 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
142 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
|
143 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
144 /** |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
145 * 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
|
146 * @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
|
147 * @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
|
148 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
149 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
|
150 |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
151 /** |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
152 * 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
|
153 * @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
|
154 * @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
|
155 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
156 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
|
157 |
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 * 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
|
160 * @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
|
161 * @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
|
162 * @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
|
163 */ |
db9c6b0c9f07
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium <rubidium@openttd.org>
parents:
8836
diff
changeset
|
164 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
|
165 |
8843
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
166 /** 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
|
167 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
|
168 /** 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
|
169 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
|
170 /** 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
|
171 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
|
172 /** 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
|
173 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
|
174 /** 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
|
175 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
|
176 /** 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
|
177 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
|
178 /** What variable do we have to compare? */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
179 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
|
180 /** What is the comparator to use? */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
181 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
|
182 /** Get the order to skip to. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
183 inline VehicleOrderID GetConditionSkipToOrder() const { return this->flags; } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
184 /** Get the value to base the skip on. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
185 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
|
186 |
1f412a20da48
(svn r12593) -Codechange: hide Order's flags in most of the code.
rubidium <rubidium@openttd.org>
parents:
8840
diff
changeset
|
187 /** 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
|
188 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
|
189 /** 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
|
190 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
|
191 /** 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
|
192 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
|
193 /** 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
|
194 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
|
195 /** 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
|
196 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
|
197 /** 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
|
198 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
|
199 /** Set variable we have to compare. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
200 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
|
201 /** Set the comparator to use. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
202 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
|
203 /** Get the order to skip to. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
204 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
|
205 /** Set the value to base the skip on. */ |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8881
diff
changeset
|
206 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
|
207 |
8832
870ff040ec3e
(svn r12580) -Codechange: merge some logical related to non-stop orders.
rubidium <rubidium@openttd.org>
parents:
8784
diff
changeset
|
208 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
|
209 |
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
|
210 /** 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
|
211 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
|
212 { |
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
|
213 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
|
214 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
|
215 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
|
216 } |
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
|
217 |
8835
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 * 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
|
220 * @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
|
221 */ |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
222 void AssignOrder(const Order &other); |
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 /** |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
225 * 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
|
226 * @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
|
227 * @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
|
228 */ |
e8296a8dbe93
(svn r12583) -Codechange: make AssignOrder a class function of order.
rubidium <rubidium@openttd.org>
parents:
8834
diff
changeset
|
229 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
|
230 |
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 * 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
|
233 * 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
|
234 * @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
|
235 * @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
|
236 */ |
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
|
237 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
|
238 |
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
|
239 /** |
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
|
240 * 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
|
241 * 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
|
242 */ |
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 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
|
244 }; |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
245 |
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
|
246 /** 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
|
247 * 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
|
248 */ |
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 struct OrderList : PoolItem<OrderList, OrderListID, &_OrderList_pool> { |
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 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
|
251 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
|
252 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
|
253 |
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 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
|
255 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
|
256 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
|
257 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
|
258 |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
259 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
|
260 |
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
|
261 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
|
262 /** Default constructor producing an invalid 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
|
263 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
|
264 : first(NULL), num_orders(INVALID_VEH_ORDER_ID), num_vehicles(0), first_shared(NULL), |
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
|
265 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
|
266 |
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 /** Create an order list with the given order chain for the given vehicle. |
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 * @param chain is the pointer to 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
|
269 * @param v is any vehicle of the shared order vehicle chain (does not need to be the 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
|
270 */ |
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
|
271 OrderList(Order *chain, 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
|
272 |
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
|
273 /** Destructor. Invalidates OrderList for re-usage by the pool. */ |
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 ~OrderList() { this->num_orders = INVALID_VEH_ORDER_ID; } |
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 |
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
|
276 /** Checks, if this is a valid 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
|
277 inline bool IsValid() const { return this->num_orders != INVALID_VEH_ORDER_ID; } |
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
|
278 |
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
|
279 /** |
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
|
280 * 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
|
281 * @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
|
282 */ |
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
|
283 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
|
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 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
|
287 * @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
|
288 * @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
|
289 */ |
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 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
|
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 /** |
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 * 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
|
294 * @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
|
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 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
|
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 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
|
300 * @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
|
301 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
|
302 |
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 * 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
|
305 * @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
|
306 * @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
|
307 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
|
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 * 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
|
311 * @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
|
312 */ |
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 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
|
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 * 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
|
317 * @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
|
318 * @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
|
319 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
|
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 * 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
|
323 * @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
|
324 */ |
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 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
|
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 * 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
|
329 * @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
|
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 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
|
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 * 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
|
335 * @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
|
336 */ |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
337 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
|
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 * 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
|
341 * @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
|
342 */ |
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
|
343 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
|
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 * 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
|
347 * @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
|
348 * @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
|
349 */ |
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 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
|
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 /** |
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 * 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
|
354 * @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
|
355 * 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
|
356 * @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
|
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 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
|
359 |
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 /** |
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 * 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
|
362 * @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
|
363 * @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
|
364 */ |
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 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
|
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 /** |
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 * 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
|
369 * @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
|
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 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
|
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 * 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
|
375 * @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
|
376 */ |
10556
bb3057c7eed7
(svn r14813) -Codechange: use uint instead of 'just' unsigned.
rubidium <rubidium@openttd.org>
parents:
10546
diff
changeset
|
377 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
|
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 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
|
381 * @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
|
382 */ |
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
|
383 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
|
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 * 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
|
387 * @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
|
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 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
|
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 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
|
393 */ |
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 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
|
395 |
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 * 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
|
398 * @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
|
399 * @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
|
400 */ |
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 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
|
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 /** |
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 * 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
|
405 */ |
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 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
|
407 }; |
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 |
11923
ee96e716b842
(svn r16326) -Codechange: replace GetPoolItemPoolSize() by PoolItem::GetPoolSize()
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
409 #define FOR_ALL_ORDERS_FROM(order, start) for (order = Order::Get(start); order != NULL; order = (order->index + 1U < Order::GetPoolSize()) ? Order::Get(order->index + 1U) : NULL) if (order->IsValid()) |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
410 #define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0) |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
411 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
412 |
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
|
413 #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
|
414 |
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
|
415 |
11923
ee96e716b842
(svn r16326) -Codechange: replace GetPoolItemPoolSize() by PoolItem::GetPoolSize()
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
416 #define FOR_ALL_ORDER_LISTS_FROM(ol, start) for (ol = OrderList::Get(start); ol != NULL; ol = (ol->index + 1U < OrderList::GetPoolSize()) ? OrderList::Get(ol->index + 1U) : NULL) if (ol->IsValid()) |
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
|
417 #define FOR_ALL_ORDER_LISTS(ol) FOR_ALL_ORDER_LISTS_FROM(ol, 0) |
8784
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
418 |
6280c0d48a6d
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
419 #endif /* ORDER_H */ |