29 friend uint32 PackOrder(const Order *order); ///< 'Compressing' an order. |
29 friend uint32 PackOrder(const Order *order); ///< 'Compressing' an order. |
30 friend Order UnpackOrder(uint32 packed); ///< 'Uncompressing' an order. |
30 friend Order UnpackOrder(uint32 packed); ///< 'Uncompressing' an order. |
31 friend Order UnpackOldOrder(uint16 packed); ///< 'Uncompressing' a loaded old order. |
31 friend Order UnpackOldOrder(uint16 packed); ///< 'Uncompressing' a loaded old order. |
32 friend Order UnpackVersion4Order(uint16 packed); ///< 'Uncompressing' a loaded ancient order. |
32 friend Order UnpackVersion4Order(uint16 packed); ///< 'Uncompressing' a loaded ancient order. |
33 |
33 |
34 OrderTypeByte type; |
34 OrderTypeByte type; ///< The type of order |
|
35 |
|
36 CargoID refit_cargo; ///< Refit CargoID |
|
37 byte refit_subtype; ///< Refit subtype |
35 |
38 |
36 public: |
39 public: |
37 Order *next; ///< Pointer to next order. If NULL, end of list |
40 Order *next; ///< Pointer to next order. If NULL, end of list |
38 |
41 |
39 uint8 flags; |
42 uint8 flags; |
40 DestinationID dest; ///< The destionation of the order. |
43 DestinationID dest; ///< The destionation of the order. |
41 |
|
42 CargoID refit_cargo; // Refit CargoID |
|
43 byte refit_subtype; // Refit subtype |
|
44 |
44 |
45 uint16 wait_time; ///< How long in ticks to wait at the destination. |
45 uint16 wait_time; ///< How long in ticks to wait at the destination. |
46 uint16 travel_time; ///< How long in ticks the journey to this destination should take. |
46 uint16 travel_time; ///< How long in ticks the journey to this destination should take. |
47 |
47 |
48 Order() : refit_cargo(CT_NO_REFIT) {} |
48 Order() : refit_cargo(CT_NO_REFIT) {} |
81 |
81 |
82 /** |
82 /** |
83 * Makes this order a Go To Depot order. |
83 * Makes this order a Go To Depot order. |
84 * @param destination the depot to go to. |
84 * @param destination the depot to go to. |
85 * @param order is this order a 'default' order, or an overriden vehicle order? |
85 * @param order is this order a 'default' order, or an overriden vehicle order? |
|
86 * @param cargo the cargo type to change to. |
|
87 * @param subtype the subtype to change to. |
86 */ |
88 */ |
87 void MakeGoToDepot(DepotID destination, bool order); |
89 void MakeGoToDepot(DepotID destination, bool order, CargoID cargo = CT_NO_REFIT, byte subtype = 0); |
88 |
90 |
89 /** |
91 /** |
90 * Makes this order a Go To Waypoint order. |
92 * Makes this order a Go To Waypoint order. |
91 * @param destination the waypoint to go to. |
93 * @param destination the waypoint to go to. |
92 */ |
94 */ |
110 /** |
112 /** |
111 * Free a complete order chain. |
113 * Free a complete order chain. |
112 * @note do not use on "current_order" vehicle orders! |
114 * @note do not use on "current_order" vehicle orders! |
113 */ |
115 */ |
114 void FreeChain(); |
116 void FreeChain(); |
|
117 |
|
118 /** |
|
119 * Is this order a refit order. |
|
120 * @pre IsType(OT_GOTO_DEPOT) |
|
121 * @return true if a refit should happen. |
|
122 */ |
|
123 inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO; } |
|
124 |
|
125 /** |
|
126 * Get the cargo to to refit to. |
|
127 * @pre IsType(OT_GOTO_DEPOT) |
|
128 * @return the cargo type. |
|
129 */ |
|
130 inline CargoID GetRefitCargo() const { return this->refit_cargo; } |
|
131 |
|
132 /** |
|
133 * Get the cargo subtype to to refit to. |
|
134 * @pre IsType(OT_GOTO_DEPOT) |
|
135 * @return the cargo subtype. |
|
136 */ |
|
137 inline byte GetRefitSubtype() const { return this->refit_subtype; } |
|
138 |
|
139 /** |
|
140 * Make this depot order also a refit order. |
|
141 * @param cargo the cargo type to change to. |
|
142 * @param subtype the subtype to change to. |
|
143 * @pre IsType(OT_GOTO_DEPOT). |
|
144 */ |
|
145 void SetRefit(CargoID cargo, byte subtype = 0); |
115 |
146 |
116 bool ShouldStopAtStation(const Vehicle *v, StationID station) const; |
147 bool ShouldStopAtStation(const Vehicle *v, StationID station) const; |
117 |
148 |
118 /** |
149 /** |
119 * Assign the given order to this one. |
150 * Assign the given order to this one. |