OpenTTD
order_base.h
Go to the documentation of this file.
1 /* $Id: order_base.h 26547 2014-05-01 14:49:16Z fonsinchen $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef ORDER_BASE_H
13 #define ORDER_BASE_H
14 
15 #include "order_type.h"
16 #include "core/pool_type.hpp"
17 #include "core/bitmath_func.hpp"
18 #include "cargo_type.h"
19 #include "depot_type.h"
20 #include "station_type.h"
21 #include "vehicle_type.h"
22 #include "date_type.h"
23 
26 extern OrderPool _order_pool;
27 extern OrderListPool _orderlist_pool;
28 
29 /* If you change this, keep in mind that it is saved on 3 places:
30  * - Load_ORDR, all the global orders
31  * - Vehicle -> current_order
32  * - REF_ORDER (all REFs are currently limited to 16 bits!!)
33  */
34 struct Order : OrderPool::PoolItem<&_order_pool> {
35 private:
36  friend const struct SaveLoad *GetVehicleDescription(VehicleType vt);
37  friend void Load_VEHS();
38  friend const struct SaveLoad *GetOrderDescription();
39 
40  uint8 type;
41  uint8 flags;
42  DestinationID dest;
43 
45 
46  uint16 wait_time;
47  uint16 travel_time;
48  uint16 max_speed;
49 
50 public:
52 
53  Order() : refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {}
54  ~Order();
55 
56  Order(uint32 packed);
57 
63  inline bool IsType(OrderType type) const { return this->GetType() == type; }
64 
69  inline OrderType GetType() const { return (OrderType)GB(this->type, 0, 4); }
70 
71  void Free();
72 
73  void MakeGoToStation(StationID destination);
75  void MakeGoToWaypoint(StationID destination);
76  void MakeLoading(bool ordered);
77  void MakeLeaveStation();
78  void MakeDummy();
79  void MakeConditional(VehicleOrderID order);
80  void MakeImplicit(StationID destination);
81 
86  inline bool IsGotoOrder() const
87  {
88  return IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION);
89  }
90 
96  inline DestinationID GetDestination() const { return this->dest; }
97 
103  inline void SetDestination(DestinationID destination) { this->dest = destination; }
104 
110  inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO || this->refit_cargo == CT_AUTO_REFIT; }
111 
117  inline bool IsAutoRefit() const { return this->refit_cargo == CT_AUTO_REFIT; }
118 
124  inline CargoID GetRefitCargo() const { return this->refit_cargo; }
125 
126  void SetRefit(CargoID cargo);
127 
129  inline OrderLoadFlags GetLoadType() const { return (OrderLoadFlags)GB(this->flags, 4, 3); }
131  inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 3); }
133  inline OrderNonStopFlags GetNonStopType() const { return (OrderNonStopFlags)GB(this->type, 6, 2); }
135  inline OrderStopLocation GetStopLocation() const { return (OrderStopLocation)GB(this->type, 4, 2); }
137  inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)GB(this->flags, 0, 3); }
139  inline OrderDepotActionFlags GetDepotActionType() const { return (OrderDepotActionFlags)GB(this->flags, 4, 3); }
141  inline OrderConditionVariable GetConditionVariable() const { return (OrderConditionVariable)GB(this->dest, 11, 5); }
143  inline OrderConditionComparator GetConditionComparator() const { return (OrderConditionComparator)GB(this->type, 5, 3); }
145  inline VehicleOrderID GetConditionSkipToOrder() const { return this->flags; }
147  inline uint16 GetConditionValue() const { return GB(this->dest, 0, 11); }
148 
150  inline void SetLoadType(OrderLoadFlags load_type) { SB(this->flags, 4, 3, load_type); }
152  inline void SetUnloadType(OrderUnloadFlags unload_type) { SB(this->flags, 0, 3, unload_type); }
154  inline void SetNonStopType(OrderNonStopFlags non_stop_type) { SB(this->type, 6, 2, non_stop_type); }
156  inline void SetStopLocation(OrderStopLocation stop_location) { SB(this->type, 4, 2, stop_location); }
158  inline void SetDepotOrderType(OrderDepotTypeFlags depot_order_type) { SB(this->flags, 0, 3, depot_order_type); }
160  inline void SetDepotActionType(OrderDepotActionFlags depot_service_type) { SB(this->flags, 4, 3, depot_service_type); }
162  inline void SetConditionVariable(OrderConditionVariable condition_variable) { SB(this->dest, 11, 5, condition_variable); }
164  inline void SetConditionComparator(OrderConditionComparator condition_comparator) { SB(this->type, 5, 3, condition_comparator); }
166  inline void SetConditionSkipToOrder(VehicleOrderID order_id) { this->flags = order_id; }
168  inline void SetConditionValue(uint16 value) { SB(this->dest, 0, 11, value); }
169 
170  /* As conditional orders write their "skip to" order all over the flags, we cannot check the
171  * flags to find out if timetabling is enabled. However, as conditional orders are never
172  * autofilled we can be sure that any non-zero values for their wait_time and travel_time are
173  * explicitly set (but travel_time is actually unused for conditionals). */
174 
176  inline bool IsWaitTimetabled() const { return this->IsType(OT_CONDITIONAL) ? this->wait_time > 0 : HasBit(this->flags, 3); }
178  inline bool IsTravelTimetabled() const { return this->IsType(OT_CONDITIONAL) ? this->travel_time > 0 : HasBit(this->flags, 7); }
179 
181  inline uint16 GetTimetabledWait() const { return this->IsWaitTimetabled() ? this->wait_time : 0; }
183  inline uint16 GetTimetabledTravel() const { return this->IsTravelTimetabled() ? this->travel_time : 0; }
185  inline uint16 GetWaitTime() const { return this->wait_time; }
187  inline uint16 GetTravelTime() const { return this->travel_time; }
188 
194  inline uint16 GetMaxSpeed() const { return this->max_speed; }
195 
197  inline void SetWaitTimetabled(bool timetabled) { if (!this->IsType(OT_CONDITIONAL)) SB(this->flags, 3, 1, timetabled ? 1 : 0); }
199  inline void SetTravelTimetabled(bool timetabled) { if (!this->IsType(OT_CONDITIONAL)) SB(this->flags, 7, 1, timetabled ? 1 : 0); }
200 
205  inline void SetWaitTime(uint16 time) { this->wait_time = time; }
206 
211  inline void SetTravelTime(uint16 time) { this->travel_time = time; }
212 
218  inline void SetMaxSpeed(uint16 speed) { this->max_speed = speed; }
219 
220  bool ShouldStopAtStation(const Vehicle *v, StationID station) const;
221  bool CanLoadOrUnload() const;
222  bool CanLeaveWithCargo(bool has_cargo) const;
223 
224  TileIndex GetLocation(const Vehicle *v, bool airport = false) const;
225 
227  inline bool IsCompletelyTimetabled() const
228  {
229  if (!this->IsTravelTimetabled() && !this->IsType(OT_CONDITIONAL)) return false;
230  if (!this->IsWaitTimetabled() && this->IsType(OT_GOTO_STATION) &&
232  return false;
233  }
234  return true;
235  }
236 
237  void AssignOrder(const Order &other);
238  bool Equals(const Order &other) const;
239 
240  uint32 Pack() const;
241  uint16 MapOldOrder() const;
242  void ConvertFromOldSavegame();
243 };
244 
245 void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord);
246 void DeleteOrder(Vehicle *v, VehicleOrderID sel_ord);
247 
252 struct OrderList : OrderListPool::PoolItem<&_orderlist_pool> {
253 private:
254  friend void AfterLoadVehicles(bool part_of_load);
255  friend const struct SaveLoad *GetOrderListDescription();
256 
257  StationID GetBestLoadableNext(const Vehicle *v, const Order *o1, const Order *o2) const;
258 
264 
267 
268 public:
271  : first(NULL), num_orders(num_orders), num_manual_orders(0), num_vehicles(0), first_shared(NULL),
272  timetable_duration(0), total_duration(0) { }
273 
279  OrderList(Order *chain, Vehicle *v) { this->Initialize(chain, v); }
280 
283 
284  void Initialize(Order *chain, Vehicle *v);
285 
290  inline Order *GetFirstOrder() const { return this->first; }
291 
292  Order *GetOrderAt(int index) const;
293 
298  inline Order *GetLastOrder() const { return this->GetOrderAt(this->num_orders - 1); }
299 
306  inline const Order *GetNext(const Order *curr) const { return (curr->next == NULL) ? this->GetFirstOrder() : curr->next; }
307 
312  inline VehicleOrderID GetNumOrders() const { return this->num_orders; }
313 
318  inline VehicleOrderID GetNumManualOrders() const { return this->num_manual_orders; }
319 
320  StationIDStack GetNextStoppingStation(const Vehicle *v, const Order *first = NULL, uint hops = 0) const;
321  const Order *GetNextDecisionNode(const Order *next, uint hops) const;
322 
323  void InsertOrderAt(Order *new_order, int index);
324  void DeleteOrderAt(int index);
325  void MoveOrder(int from, int to);
326 
331  inline bool IsShared() const { return this->num_vehicles > 1; };
332 
337  inline Vehicle *GetFirstSharedVehicle() const { return this->first_shared; }
338 
343  inline uint GetNumVehicles() const { return this->num_vehicles; }
344 
345  bool IsVehicleInSharedOrdersList(const Vehicle *v) const;
346  int GetPositionInSharedOrderList(const Vehicle *v) const;
347 
354  inline void AddVehicle(Vehicle *v) { ++this->num_vehicles; }
355 
356  void RemoveVehicle(Vehicle *v);
357 
358  bool IsCompleteTimetable() const;
359 
364  inline Ticks GetTimetableTotalDuration() const { return this->IsCompleteTimetable() ? this->timetable_duration : INVALID_TICKS; }
365 
370  inline Ticks GetTimetableDurationIncomplete() const { return this->timetable_duration; }
371 
376  inline Ticks GetTotalDuration() const { return this->total_duration; }
377 
382  void UpdateTimetableDuration(Ticks delta) { this->timetable_duration += delta; }
383 
388  void UpdateTotalDuration(Ticks delta) { this->total_duration += delta; }
389 
390  void FreeChain(bool keep_orderlist = false);
391 
392  void DebugCheckSanity() const;
393 };
394 
395 #define FOR_ALL_ORDERS_FROM(var, start) FOR_ALL_ITEMS_FROM(Order, order_index, var, start)
396 #define FOR_ALL_ORDERS(var) FOR_ALL_ORDERS_FROM(var, 0)
397 
398 
399 #define FOR_VEHICLE_ORDERS(v, order) for (order = (v->orders.list == NULL) ? NULL : v->orders.list->GetFirstOrder(); order != NULL; order = order->next)
400 
401 
402 #define FOR_ALL_ORDER_LISTS_FROM(var, start) FOR_ALL_ITEMS_FROM(OrderList, orderlist_index, var, start)
403 #define FOR_ALL_ORDER_LISTS(var) FOR_ALL_ORDER_LISTS_FROM(var, 0)
404 
405 #endif /* ORDER_BASE_H */
OrderConditionVariable
Variables (of a vehicle) to &#39;cause&#39; skipping on.
Definition: order_type.h:118
VehicleOrderID num_orders
NOSAVE: How many orders there are in the list.
Definition: order_base.h:260
uint16 DepotID
Type for the unique identifier of depots.
Definition: depot_type.h:15
uint16 GetTravelTime() const
Get the time in ticks a vehicle will probably take to reach the destination (timetabled or not)...
Definition: order_base.h:187
Automatically choose cargo type when doing auto refitting.
Definition: cargo_type.h:68
Minimal stack that uses a pool to avoid pointers.
Types related to orders.
bool IsGotoOrder() const
Is this a &#39;goto&#39; order with a real destination?
Definition: order_base.h:86
OrderConditionComparator GetConditionComparator() const
What is the comparator to use?
Definition: order_base.h:143
void SetConditionValue(uint16 value)
Set the value to base the skip on.
Definition: order_base.h:168
Ticks GetTimetableTotalDuration() const
Gets the total duration of the vehicles timetable or INVALID_TICKS is the timetable is not complete...
Definition: order_base.h:364
void UpdateTimetableDuration(Ticks delta)
Must be called if an order&#39;s timetable is changed to update internal book keeping.
Definition: order_base.h:382
VehicleOrderID GetConditionSkipToOrder() const
Get the order to skip to.
Definition: order_base.h:145
void SetWaitTime(uint16 time)
Set the time in ticks to wait at the destination.
Definition: order_base.h:205
static const VehicleOrderID INVALID_VEH_ORDER_ID
Invalid vehicle order index (sentinel)
Definition: order_type.h:23
OrderList(VehicleOrderID num_orders=INVALID_VEH_ORDER_ID)
Default constructor producing an invalid order list.
Definition: order_base.h:270
Ticks GetTotalDuration() const
Gets the known duration of the vehicles orders, timetabled or not.
Definition: order_base.h:376
void SetDepotOrderType(OrderDepotTypeFlags depot_order_type)
Set the cause to go to the depot.
Definition: order_base.h:158
static const Ticks INVALID_TICKS
Representation of an invalid number of ticks.
Definition: date_type.h:111
void SetDepotActionType(OrderDepotActionFlags depot_service_type)
Set what we are going to do in the depot.
Definition: order_base.h:160
bool IsTravelTimetabled() const
Does this order have an explicit travel time set?
Definition: order_base.h:178
Vehicle data structure.
Definition: vehicle_base.h:212
void SetRefit(CargoID cargo)
Make this depot/station order also a refit order.
Definition: order_cmd.cpp:166
Only service the vehicle.
Definition: order_type.h:109
VehicleOrderID GetNumManualOrders() const
Get number of manually added orders in the order list.
Definition: order_base.h:318
Ticks total_duration
NOSAVE: Total (timetabled or not) duration of the order list.
Definition: order_base.h:266
Tindex index
Index of this pool item.
Definition: pool_type.hpp:147
Functions related to bit mathematics.
CargoID refit_cargo
Refit CargoID.
Definition: order_base.h:44
OrderNonStopFlags
Non-stop order flags.
Definition: order_type.h:78
void SetUnloadType(OrderUnloadFlags unload_type)
Set how the consist must be unloaded.
Definition: order_base.h:152
void SetConditionComparator(OrderConditionComparator condition_comparator)
Set the comparator to use.
Definition: order_base.h:164
~Order()
Clean everything up.
Definition: order_cmd.cpp:48
uint16 MapOldOrder() const
Pack this order into a 16 bits integer as close to the TTD representation as possible.
Definition: order_cmd.cpp:209
void SetConditionVariable(OrderConditionVariable condition_variable)
Set variable we have to compare.
Definition: order_base.h:162
Vehicle * GetFirstSharedVehicle() const
Get the first vehicle of this vehicle chain.
Definition: order_base.h:337
Types related to cargoes...
Defintion of Pool, structure used to access PoolItems, and PoolItem, base structure for Vehicle...
TileIndex GetLocation(const Vehicle *v, bool airport=false) const
Returns a tile somewhat representing the order destination (not suitable for pathfinding).
Definition: order_cmd.cpp:670
bool CanLeaveWithCargo(bool has_cargo) const
A vehicle can leave the current station with cargo if:
Definition: order_cmd.cpp:2283
void SetMaxSpeed(uint16 speed)
Set the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination...
Definition: order_base.h:218
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
OrderDepotActionFlags GetDepotActionType() const
What are we going to do when in the depot.
Definition: order_base.h:139
The vehicle will stop at any station it passes except the destination.
Definition: order_type.h:81
Order * next
Pointer to next order. If NULL, end of list.
Definition: order_base.h:51
bool IsAutoRefit() const
Is this order a auto-refit order.
Definition: order_base.h:117
void SetConditionSkipToOrder(VehicleOrderID order_id)
Get the order to skip to.
Definition: order_base.h:166
Ticks timetable_duration
NOSAVE: Total timetabled duration of the order list.
Definition: order_base.h:265
DestinationID dest
The destination of the order.
Definition: order_base.h:42
uint16 travel_time
How long in ticks the journey to this destination should take.
Definition: order_base.h:47
void MakeConditional(VehicleOrderID order)
Makes this order an conditional order.
Definition: order_cmd.cpp:144
bool ShouldStopAtStation(const Vehicle *v, StationID station) const
Check whether the given vehicle should stop at the given station based on this order and the non-stop...
Definition: order_cmd.cpp:2259
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
Definition: order_base.h:252
OrderDepotTypeFlags GetDepotOrderType() const
What caused us going to the depot?
Definition: order_base.h:137
Header files for depots (not hangars)
OrderConditionVariable GetConditionVariable() const
What variable do we have to compare?
Definition: order_base.h:141
Types related to stations.
uint8 type
The type of order + non-stop flags.
Definition: order_base.h:40
void SetNonStopType(OrderNonStopFlags non_stop_type)
Set whether we must stop at stations or not.
Definition: order_base.h:154
void MakeImplicit(StationID destination)
Makes this order an implicit order.
Definition: order_cmd.cpp:155
~OrderList()
Destructor.
Definition: order_base.h:282
bool IsRefit() const
Is this order a refit order.
Definition: order_base.h:110
Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
Definition: cargo_type.h:69
void MakeDummy()
Makes this order a Dummy order.
Definition: order_cmd.cpp:134
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
bool IsType(OrderType type) const
Check whether this order is of the given type.
Definition: order_base.h:63
friend const struct SaveLoad * GetOrderDescription()
Saving and loading of orders.
Definition: order_sl.cpp:104
void DeleteOrder(Vehicle *v, VehicleOrderID sel_ord)
Delete an order but skip the parameter validation.
Definition: order_cmd.cpp:1081
VehicleOrderID num_manual_orders
NOSAVE: How many manually added orders are there in the list.
Definition: order_base.h:261
void MakeLoading(bool ordered)
Makes this order a Loading order.
Definition: order_cmd.cpp:116
OrderDepotActionFlags
Actions that can be performed when the vehicle enters the depot.
Definition: order_type.h:108
uint8 flags
Load/unload types, depot order/action types.
Definition: order_base.h:41
bool IsWaitTimetabled() const
Does this order have an explicit wait time set?
Definition: order_base.h:176
uint16 GetTimetabledTravel() const
Get the time in ticks a vehicle should take to reach the destination or 0 if it&#39;s not timetabled...
Definition: order_base.h:183
bool IsShared() const
Is this a shared order list?
Definition: order_base.h:331
Order * GetFirstOrder() const
Get the first order of the order chain.
Definition: order_base.h:290
OrderConditionComparator
Comparator for the skip reasoning.
Definition: order_type.h:132
OrderLoadFlags GetLoadType() const
How must the consist be loaded?
Definition: order_base.h:129
void SetWaitTimetabled(bool timetabled)
Set if the wait time is explicitly timetabled (unless the order is conditional).
Definition: order_base.h:197
bool Equals(const Order &other) const
Does this order have the same type, flags and destination?
Definition: order_cmd.cpp:176
Order * GetLastOrder() const
Get the last order of the order chain.
Definition: order_base.h:298
Order * first
First order of the order list.
Definition: order_base.h:259
Base class for all PoolItems.
Definition: pool_type.hpp:146
OrderType
Order types.
Definition: order_type.h:37
friend void Load_VEHS()
Loading of ancient vehicles.
Definition: vehicle_sl.cpp:883
Base class for all pools.
Definition: pool_type.hpp:83
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
Definition: order_base.h:131
const Order * GetNext(const Order *curr) const
Get the order after the given one or the first one, if the given one is the last one.
Definition: order_base.h:306
void SetLoadType(OrderLoadFlags load_type)
Set how the consist must be loaded.
Definition: order_base.h:150
Maximal number of cargo types in a game.
Definition: cargo_type.h:66
OrderUnloadFlags
Flags related to the unloading order.
Definition: order_type.h:58
uint16 GetWaitTime() const
Get the time in ticks a vehicle will probably wait at the destination (timetabled or not)...
Definition: order_base.h:185
void AddVehicle(Vehicle *v)
Adds the given vehicle to this shared order list.
Definition: order_base.h:354
OrderStopLocation
Where to stop the trains.
Definition: order_type.h:89
uint16 GetTimetabledWait() const
Get the time in ticks a vehicle should wait at the destination or 0 if it&#39;s not timetabled.
Definition: order_base.h:181
Ticks GetTimetableDurationIncomplete() const
Gets the known duration of the vehicles timetable even if the timetable is not complete.
Definition: order_base.h:370
DestinationID GetDestination() const
Gets the destination of this order.
Definition: order_base.h:96
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)
Makes this order a Go To Depot order.
Definition: order_cmd.cpp:91
OrderStopLocation GetStopLocation() const
Where must we stop at the platform?
Definition: order_base.h:135
uint32 TileIndex
The index/ID of a Tile.
Definition: tile_type.h:80
OrderLoadFlags
Flags related to the loading order.
Definition: order_type.h:68
void MakeLeaveStation()
Makes this order a Leave Station order.
Definition: order_cmd.cpp:125
void InsertOrder(Vehicle *v, Order *new_o, VehicleOrderID sel_ord)
Insert a new order but skip the validation.
Definition: order_cmd.cpp:953
uint num_vehicles
NOSAVE: Number of vehicles that share this order list.
Definition: order_base.h:262
uint16 wait_time
How long in ticks to wait at the destination.
Definition: order_base.h:46
int32 Ticks
The type to store ticks in.
Definition: date_type.h:18
void Free()
&#39;Free&#39; the order
Definition: order_cmd.cpp:64
uint16 GetConditionValue() const
Get the value to base the skip on.
Definition: order_base.h:147
Types related to vehicles.
OrderList(Order *chain, Vehicle *v)
Create an order list with the given order chain for the given vehicle.
Definition: order_base.h:279
void SetTravelTimetabled(bool timetabled)
Set if the travel time is explicitly timetabled (unless the order is conditional).
Definition: order_base.h:199
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
void AfterLoadVehicles(bool part_of_load)
Called after load to update coordinates.
Definition: vehicle_sl.cpp:249
void AssignOrder(const Order &other)
Assign data to an order (from another order) This function makes sure that the index is maintained co...
Definition: order_cmd.cpp:274
The vehicle will not stop at any stations it passes except the destination.
Definition: order_type.h:80
void UpdateTotalDuration(Ticks delta)
Must be called if an order&#39;s timetable is changed to update internal book keeping.
Definition: order_base.h:388
void SetDestination(DestinationID destination)
Sets the destination of this order.
Definition: order_base.h:103
Types related to the dates in OpenTTD.
void MakeGoToWaypoint(StationID destination)
Makes this order a Go To Waypoint order.
Definition: order_cmd.cpp:105
SaveLoad type struct.
Definition: saveload.h:208
uint GetNumVehicles() const
Return the number of vehicles that share this orders list.
Definition: order_base.h:343
byte VehicleOrderID
The index of an order within its current vehicle (not pool related)
Definition: order_type.h:17
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
uint32 Pack() const
Pack this order into a 32 bits integer, or actually only the type, flags and destination.
Definition: order_cmd.cpp:199
OrderType GetType() const
Get the type of order of this order.
Definition: order_base.h:69
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
uint16 GetMaxSpeed() const
Get the maxmimum speed in km-ish/h a vehicle is allowed to reach on the way to the destination...
Definition: order_base.h:194
void ConvertFromOldSavegame()
Converts this order from an old savegame&#39;s version; it moves all bits to the new location.
Definition: order_sl.cpp:25
friend const struct SaveLoad * GetVehicleDescription(VehicleType vt)
Saving and loading the current order of vehicles.
Definition: vehicle_sl.cpp:574
void SetTravelTime(uint16 time)
Set the time in ticks to take for travelling to the destination.
Definition: order_base.h:211
Vehicle * first_shared
NOSAVE: pointer to the first vehicle in the shared order chain.
Definition: order_base.h:263
uint16 max_speed
How fast the vehicle may go on the way to the destination.
Definition: order_base.h:48
void SetStopLocation(OrderStopLocation stop_location)
Set where we must stop at the platform.
Definition: order_base.h:156
OrderNonStopFlags GetNonStopType() const
At which stations must we stop?
Definition: order_base.h:133
bool IsCompletelyTimetabled() const
Checks if travel_time and wait_time apply to this order and if they are timetabled.
Definition: order_base.h:227
VehicleOrderID GetNumOrders() const
Get number of orders in the order list.
Definition: order_base.h:312
void MakeGoToStation(StationID destination)
Makes this order a Go To Station order.
Definition: order_cmd.cpp:76
OrderDepotTypeFlags
Reasons that could cause us to go to the depot.
Definition: order_type.h:99
CargoID GetRefitCargo() const
Get the cargo to to refit to.
Definition: order_base.h:124