src/order_base.h
author truebrain
Mon, 16 Jun 2008 14:43:19 +0000
branchnoai
changeset 10978 13fd0364b2c6
parent 10455 22c441f5adf9
permissions -rw-r--r--
(svn r13532) [NoAI] -Fix: in MultiPlayer SignID wasn't set correctly, causing weird effects. Code is now more unified, which should avoid simular effects in the future (tnx to glx for initial patch)
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     1
/* $Id$ */
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     2
10455
22c441f5adf9 (svn r12997) [NoAI] -Sync: with trunk r12895:12996.
rubidium
parents: 10142
diff changeset
     3
/** @file order_base.h Base class for orders. */
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     4
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     5
#ifndef ORDER_BASE_H
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     6
#define ORDER_BASE_H
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     7
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     8
#include "order_type.h"
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
     9
#include "oldpool.h"
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    10
#include "core/bitmath_func.hpp"
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    11
#include "cargo_type.h"
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    12
#include "depot_type.h"
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    13
#include "station_type.h"
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    14
#include "vehicle_type.h"
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    15
#include "waypoint_type.h"
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    16
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    17
DECLARE_OLD_POOL(Order, Order, 6, 1000)
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    18
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    19
/* If you change this, keep in mind that it is saved on 3 places:
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    20
 * - Load_ORDR, all the global orders
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    21
 * - Vehicle -> current_order
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    22
 * - REF_ORDER (all REFs are currently limited to 16 bits!!)
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    23
 */
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    24
struct Order : PoolItem<Order, OrderID, &_Order_pool> {
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    25
private:
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    26
	friend const struct SaveLoad *GetVehicleDescription(VehicleType vt); ///< Saving and loading the current order of vehicles.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    27
	friend void Load_VEHS();                                             ///< Loading of ancient vehicles.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    28
	friend const struct SaveLoad *GetOrderDescription();                 ///< Saving and loading of orders.
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    29
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
    30
	uint8 type;           ///< The type of order + non-stop flags
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
    31
	uint8 flags;          ///< Load/unload types, depot order/action types.
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    32
	DestinationID dest;   ///< The destination of the order.
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    33
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    34
	CargoID refit_cargo;  ///< Refit CargoID
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    35
	byte refit_subtype;   ///< Refit subtype
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    36
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    37
public:
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    38
	Order *next;          ///< Pointer to next order. If NULL, end of list
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    39
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    40
	uint16 wait_time;    ///< How long in ticks to wait at the destination.
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    41
	uint16 travel_time;  ///< How long in ticks the journey to this destination should take.
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    42
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    43
	Order() : refit_cargo(CT_NO_REFIT) {}
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    44
	~Order() { this->type = OT_NOTHING; }
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    45
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    46
	/**
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    47
	 * Create an order based on a packed representation of that order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    48
	 * @param packed the packed representation.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    49
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    50
	Order(uint32 packed);
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    51
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    52
	/**
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    53
	 * Check if a Order really exists.
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    54
	 * @return true if the order is valid.
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    55
	 */
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    56
	inline bool IsValid() const { return this->type != OT_NOTHING; }
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    57
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    58
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    59
	 * Check whether this order is of the given type.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    60
	 * @param type the type to check against.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    61
	 * @return true if the order matches.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    62
	 */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
    63
	inline bool IsType(OrderType type) const { return this->GetType() == type; }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    64
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    65
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    66
	 * Get the type of order of this order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    67
	 * @return the order type.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    68
	 */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
    69
	inline OrderType GetType() const { return (OrderType)GB(this->type, 0, 4); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    70
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    71
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    72
	 * 'Free' the order
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    73
	 * @note ONLY use on "current_order" vehicle orders!
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    74
	 */
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
    75
	void Free();
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    76
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    77
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    78
	 * Makes this order a Go To Station order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    79
	 * @param destsination the station to go to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    80
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    81
	void MakeGoToStation(StationID destination);
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    82
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    83
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    84
	 * Makes this order a Go To Depot order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    85
	 * @param destination the depot to go to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    86
	 * @param order       is this order a 'default' order, or an overriden vehicle order?
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    87
	 * @param cargo       the cargo type to change to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    88
	 * @param subtype     the subtype to change to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    89
	 */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
    90
	void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, CargoID cargo = CT_NO_REFIT, byte subtype = 0);
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    91
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    92
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    93
	 * Makes this order a Go To Waypoint order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    94
	 * @param destination the waypoint to go to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    95
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    96
	void MakeGoToWaypoint(WaypointID destination);
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    97
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    98
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
    99
	 * Makes this order a Loading order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   100
	 * @param ordered is this an ordered stop?
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   101
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   102
	void MakeLoading(bool ordered);
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   103
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   104
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   105
	 * Makes this order a Leave Station order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   106
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   107
	void MakeLeaveStation();
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   108
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   109
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   110
	 * Makes this order a Dummy order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   111
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   112
	void MakeDummy();
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   113
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   114
	/**
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   115
	 * Makes this order an conditional order.
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   116
	 * @param order the order to jump to.
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   117
	 */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   118
	void MakeConditional(VehicleOrderID order);
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   119
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   120
	/**
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   121
	 * Free a complete order chain.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   122
	 * @note do not use on "current_order" vehicle orders!
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   123
	 */
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   124
	void FreeChain();
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   125
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   126
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   127
	 * Gets the destination of this order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   128
	 * @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   129
	 * @return the destination of the order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   130
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   131
	inline DestinationID GetDestination() const { return this->dest; }
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   132
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   133
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   134
	 * Sets the destination of this order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   135
	 * @param destination the new destination of the order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   136
	 * @pre IsType(OT_GOTO_WAYPOINT) || IsType(OT_GOTO_DEPOT) || IsType(OT_GOTO_STATION).
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   137
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   138
	inline void SetDestination(DestinationID destination) { this->dest = destination; }
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   139
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   140
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   141
	 * Is this order a refit order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   142
	 * @pre IsType(OT_GOTO_DEPOT)
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   143
	 * @return true if a refit should happen.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   144
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   145
	inline bool IsRefit() const { return this->refit_cargo < NUM_CARGO; }
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   146
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   147
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   148
	 * Get the cargo to to refit to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   149
	 * @pre IsType(OT_GOTO_DEPOT)
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   150
	 * @return the cargo type.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   151
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   152
	inline CargoID GetRefitCargo() const { return this->refit_cargo; }
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   153
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   154
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   155
	 * Get the cargo subtype to to refit to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   156
	 * @pre IsType(OT_GOTO_DEPOT)
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   157
	 * @return the cargo subtype.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   158
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   159
	inline byte GetRefitSubtype() const { return this->refit_subtype; }
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   160
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   161
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   162
	 * Make this depot order also a refit order.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   163
	 * @param cargo   the cargo type to change to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   164
	 * @param subtype the subtype to change to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   165
	 * @pre IsType(OT_GOTO_DEPOT).
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   166
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   167
	void SetRefit(CargoID cargo, byte subtype = 0);
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   168
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   169
	/** How must the consist be loaded? */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   170
	inline OrderLoadFlags GetLoadType() const { return (OrderLoadFlags)GB(this->flags, 4, 4); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   171
	/** How must the consist be unloaded? */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   172
	inline OrderUnloadFlags GetUnloadType() const { return (OrderUnloadFlags)GB(this->flags, 0, 4); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   173
	/** Where must we stop? */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   174
	inline OrderNonStopFlags GetNonStopType() const { return (OrderNonStopFlags)GB(this->type, 6, 2); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   175
	/** What caused us going to the depot? */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   176
	inline OrderDepotTypeFlags GetDepotOrderType() const { return (OrderDepotTypeFlags)GB(this->flags, 0, 4); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   177
	/** What are we going to do when in the depot. */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   178
	inline OrderDepotActionFlags GetDepotActionType() const { return (OrderDepotActionFlags)GB(this->flags, 4, 4); }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   179
	/** What variable do we have to compare? */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   180
	inline OrderConditionVariable GetConditionVariable() const { return (OrderConditionVariable)GB(this->dest, 11, 5); }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   181
	/** What is the comparator to use? */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   182
	inline OrderConditionComparator GetConditionComparator() const { return (OrderConditionComparator)GB(this->type, 5, 3); }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   183
	/** Get the order to skip to. */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   184
	inline VehicleOrderID GetConditionSkipToOrder() const { return this->flags; }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   185
	/** Get the value to base the skip on. */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   186
	inline uint16 GetConditionValue() const { return GB(this->dest, 0, 11); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   187
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   188
	/** Set how the consist must be loaded. */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   189
	inline void SetLoadType(OrderLoadFlags load_type) { SB(this->flags, 4, 4, load_type); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   190
	/** Set how the consist must be unloaded. */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   191
	inline void SetUnloadType(OrderUnloadFlags unload_type) { SB(this->flags, 0, 4, unload_type); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   192
	/** Set whether we must stop at stations or not. */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   193
	inline void SetNonStopType(OrderNonStopFlags non_stop_type) { SB(this->type, 6, 2, non_stop_type); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   194
	/** Set the cause to go to the depot. */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   195
	inline void SetDepotOrderType(OrderDepotTypeFlags depot_order_type) { SB(this->flags, 0, 4, depot_order_type); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   196
	/** Set what we are going to do in the depot. */
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   197
	inline void SetDepotActionType(OrderDepotActionFlags depot_service_type) { SB(this->flags, 4, 4, depot_service_type); }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   198
	/** Set variable we have to compare. */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   199
	inline void SetConditionVariable(OrderConditionVariable condition_variable) { SB(this->dest, 11, 5, condition_variable); }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   200
	/** Set the comparator to use. */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   201
	inline void SetConditionComparator(OrderConditionComparator condition_comparator) { SB(this->type, 5, 3, condition_comparator); }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   202
	/** Get the order to skip to. */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   203
	inline void SetConditionSkipToOrder(VehicleOrderID order_id) { this->flags = order_id; }
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   204
	/** Set the value to base the skip on. */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   205
	inline void SetConditionValue(uint16 value) { SB(this->dest, 0, 11, value); }
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   206
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   207
	bool ShouldStopAtStation(const Vehicle *v, StationID station) const;
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   208
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   209
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   210
	 * Assign the given order to this one.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   211
	 * @param other the data to copy (except next pointer).
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   212
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   213
	void AssignOrder(const Order &other);
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   214
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   215
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   216
	 * Does this order have the same type, flags and destination?
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   217
	 * @param other the second order to compare to.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   218
	 * @return true if the type, flags and destination match.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   219
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   220
	bool Equals(const Order &other) const;
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   221
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   222
	/**
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   223
	 * Pack this order into a 32 bits integer, or actually only
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   224
	 * the type, flags and destination.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   225
	 * @return the packed representation.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   226
	 * @note unpacking is done in the constructor.
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   227
	 */
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   228
	uint32 Pack() const;
10142
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   229
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   230
	/**
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   231
	 * Converts this order from an old savegame's version;
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   232
	 * it moves all bits to the new location.
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   233
	 */
56ee7da4ad56 (svn r12673) [NoAI] -Sync: with trunk r12596:12672. Note that due to the order rewrite AIOrder.ChangeOrder does currently not work as expected.
rubidium
parents: 9869
diff changeset
   234
	void ConvertFromOldSavegame();
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   235
};
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   236
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   237
static inline VehicleOrderID GetMaxOrderIndex()
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   238
{
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   239
	/* TODO - This isn't the real content of the function, but
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   240
	 *  with the new pool-system this will be replaced with one that
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   241
	 *  _really_ returns the highest index. Now it just returns
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   242
	 *  the next safe value we are sure about everything is below.
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   243
	 */
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   244
	return GetOrderPoolSize() - 1;
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   245
}
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   246
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   247
static inline VehicleOrderID GetNumOrders()
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   248
{
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   249
	return GetOrderPoolSize();
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   250
}
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   251
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   252
#define FOR_ALL_ORDERS_FROM(order, start) for (order = GetOrder(start); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) if (order->IsValid())
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   253
#define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0)
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   254
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   255
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   256
#define FOR_VEHICLE_ORDERS(v, order) for (order = v->orders; order != NULL; order = order->next)
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   257
9869
6404afe43575 (svn r12597) [NoAI] -Sync: with trunk r12501:12596.
rubidium
parents: 9837
diff changeset
   258
/* (Un)pack routines */
9837
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   259
Order UnpackOldOrder(uint16 packed);
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   260
c9ec4f82e0d0 (svn r12503) [NoAI] -Sync: with trunk r12461:12501.
rubidium
parents:
diff changeset
   261
#endif /* ORDER_H */