src/ai/api/ai_order.hpp
author truelight
Thu, 22 Mar 2007 09:10:00 +0000
branchnoai
changeset 9510 261d33fbabb8
parent 9501 15689f09d1f5
child 9520 f7cf8bea10db
permissions -rw-r--r--
(svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
-Fix: merged squirrel_helper.cpp to squirrel_helper.hpp, as that was a silly attempt of TrueLight (KUDr)
-Fix: put all Squirrel conversion code in a namespace instead of a class (to avoid G++ bitching) (KUDr)
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     1
/* $Id$ */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     2
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     3
/** @file ai_order.hpp Everything to query and build Orders */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     4
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     5
#ifndef AI_ORDER_HPP
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     6
#define AI_ORDER_HPP
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     7
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     8
#include "ai_object.hpp"
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
     9
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    10
/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    11
 * Class that handles all order related functions.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    12
 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    13
class AIOrder : public AIObject {
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    14
public:
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    15
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    16
	 * Flags that can be used to modify the behaviour of orders.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    17
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    18
	enum AIOrderFlags {
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    19
		/** Just go to the station/depot, stop unload if possible and load if needed. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    20
		AIOF_NONE              = 0,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    21
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    22
		/** Transfer instead of deliver the goods; only for stations. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    23
		AIOF_TRANSFER          = 1 << 0,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    24
		/** Always unload the vehicle; only for stations. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    25
		AIOF_UNLOAD            = 1 << 1,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    26
		/** Wait till the the vehicle is fully loaded; only for stations. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    27
		AIOF_FULL_LOAD         = 1 << 2,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    28
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    29
		/** Service the vehicle when needed, otherwise skip this order; only for depots. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    30
		AIOF_SERVICE_IF_NEEDED = 1 << 2,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    31
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    32
		/** Do not stop at the stations that are passed when going to the destination. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    33
		AIOF_NON_STOP          = 1 << 3,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    34
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    35
		/** For marking invalid order flags */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    36
		AIOF_INVALID           = 0xFFFF,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    37
	};
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    38
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    39
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    40
	 * Checks whether the given order id is valid for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    41
	 * @param vehicle_id the vehicle to check the order index for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    42
	 * @param order_id   the order index to check.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    43
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    44
	 * @return true if and only if the order_id is valid for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    45
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    46
	static bool IsValidVehicleOrder(VehicleID vehicle_id, uint32 order_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    47
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    48
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    49
	 * Checks whether the given order flags are valid for the given destination.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    50
	 * @param destination the destination of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    51
	 * @param order_flags the flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    52
	 * @return true if and only if the order_flags are valid for the given location.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    53
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    54
	static bool AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    55
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    56
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    57
	 * Returns the number of orders for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    58
	 * @param vehicle_id the vehicle to get the order count of.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    59
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    60
	 * @return the number of orders for the given vehicle or a negative
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    61
	 *   value when the vehicle does not exist.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    62
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    63
	int32 GetNumberOfOrders(VehicleID vehicle_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    64
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    65
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    66
	 * Gets the destination of the given order for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    67
	 * @param vehicle_id the vehicle to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    68
	 * @param order_id   the order to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    69
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    70
	 * @return the destination tile of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    71
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    72
	TileIndex GetOrderDestination(VehicleID vehicle_id, uint32 order_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    73
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    74
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    75
	 * Gets the AIOrderFlags of the given order for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    76
	 * @param vehicle_id the vehicle to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    77
	 * @param order_id   the order to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    78
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    79
	 * @return the AIOrderFlags of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    80
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    81
	AIOrderFlags GetOrderFlags(VehicleID vehicle_id, uint32 order_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    82
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    83
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    84
	 * Appends an order to the end of the vehicle's order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    85
	 * @param vehicle_id  the vehicle to append the order to.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    86
	 * @param destination the destination of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    87
	 * @param order_flags the flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    88
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    89
	 * @pre AreOrderFlagsValid(destination, order_flags).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    90
	 * @return true if and only if the order was appended.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    91
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    92
	bool AppendOrder(VehicleID vehicle_id, TileIndex destination, AIOrderFlags order_flags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    93
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    94
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    95
	 * Inserts an order before the given order_id into the vehicle's order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    96
	 * @param vehicle_id  the vehicle to add the order to.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    97
	 * @param order_id    the order to place the new order before.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    98
	 * @param destination the destination of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    99
	 * @param order_flags the flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   100
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   101
	 * @pre AreOrderFlagsValid(destination, order_flags).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   102
	 * @return true if and only if the order was inserted.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   103
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   104
	bool InsertOrder(VehicleID vehicle_id, uint32 order_id, TileIndex destination, AIOrderFlags order_flags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   105
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   106
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   107
	 * Removes an order from the vehicle's order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   108
	 * @param vehicle_id  the vehicle to remove the order from.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   109
	 * @param order_id    the order to remove from the order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   110
	 * @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   111
	 * @return true if and only if the order was removed.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   112
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   113
	bool RemoveOrder(VehicleID vehicle_id, uint32 order_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   114
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   115
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   116
	 * Changes the order flags of the given order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   117
	 * @param vehicle_id  the vehicle to change the order of.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   118
	 * @param order_id    the order to change.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   119
	 * @param order_flags the new flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   120
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   121
	 * @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_id), order_flags).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   122
	 * @return true if and only if the order was changed.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   123
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   124
	bool ChangeOrder(VehicleID vehicle_id, uint32 order_id, AIOrderFlags order_flags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   125
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   126
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   127
	 * Copies the orders from another vehicle. The orders of the main
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   128
	 * vehicle are going to be the orders of the changed vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   129
	 * @param vehicle_id      the vehicle to copy the orders to.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   130
	 * @param main_vehicle_id the vehicle to copy the orders from.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   131
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   132
	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   133
	 * @return true if and only if the copying succeeded.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   134
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   135
	bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   136
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   137
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   138
	 * Shares the orders between two vehicles. The orders of the main
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   139
	 * vehicle are going to be the orders of the changed vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   140
	 * @param vehicle_id      the vehicle to add to the shared order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   141
	 * @param main_vehicle_id the vehicle to share the orders with.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   142
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   143
	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   144
	 * @return true if and only if the sharing succeeded.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   145
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   146
	bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   147
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   148
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   149
	 * Removes the given vehicle from a shared orders list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   150
	 * @param vehicle_id the vehicle to remove from the shared order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   151
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   152
	 * @return true if and only if the unsharing succeeded.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   153
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   154
	bool UnshareOrders(VehicleID vehicle_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   155
};
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   156
DECLARE_ENUM_AS_BIT_SET(AIOrder::AIOrderFlags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   157
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   158
#ifdef DEFINE_SQUIRREL_CLASS
9510
261d33fbabb8 (svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents: 9501
diff changeset
   159
9501
15689f09d1f5 (svn r9375) [NoAI] -Fix r9374: make AIOrder() work for SQ (enums not yet)
truelight
parents: 9500
diff changeset
   160
/* Custom template to allow AIOrderFlags as param */
9510
261d33fbabb8 (svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents: 9501
diff changeset
   161
namespace SQConvert {
261d33fbabb8 (svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents: 9501
diff changeset
   162
	template <> AIOrder::AIOrderFlags GetParam(ForceType<AIOrder::AIOrderFlags>, HSQUIRRELVM vm, int index) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIOrder::AIOrderFlags)tmp; }
261d33fbabb8 (svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents: 9501
diff changeset
   163
	template <> int Return<AIOrder::AIOrderFlags>(HSQUIRRELVM vm, AIOrder::AIOrderFlags res) { sq_pushinteger(vm, (int32)res); return 1; }
261d33fbabb8 (svn r9406) [NoAI] -Fix: made the detection of 'void' against 'non-void' functions for the class->SQ convertor via templates (as MSVC failed to understand the other method) (KUDr)
truelight
parents: 9501
diff changeset
   164
}; // namespace SQConvert
9501
15689f09d1f5 (svn r9375) [NoAI] -Fix r9374: make AIOrder() work for SQ (enums not yet)
truelight
parents: 9500
diff changeset
   165
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   166
void SQAIOrderRegister(Squirrel *engine) {
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   167
	DefSQClass <AIOrder> SQAIOrder("AIOrder");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   168
	SQAIOrder.PreRegister(engine);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   169
	SQAIOrder.AddConstructor(engine);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   170
	SQAIOrder.DefSQFunction(engine, &AIOrder::IsValidVehicleOrder, "IsValidVehicleOrder");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   171
	SQAIOrder.DefSQFunction(engine, &AIOrder::ShareOrders,         "ShareOrders");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   172
	SQAIOrder.DefSQFunction(engine, &AIOrder::UnshareOrders,       "UnshareOrders");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   173
	SQAIOrder.DefSQFunction(engine, &AIOrder::AreOrderFlagsValid,  "AreOrderFlagsValid");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   174
	SQAIOrder.DefSQFunction(engine, &AIOrder::GetNumberOfOrders,   "GetNumberOfOrders");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   175
	SQAIOrder.DefSQFunction(engine, &AIOrder::GetOrderDestination, "GetOrderDestination");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   176
	SQAIOrder.DefSQFunction(engine, &AIOrder::GetOrderFlags,       "GetOrderFlags");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   177
	SQAIOrder.DefSQFunction(engine, &AIOrder::AppendOrder,         "AppendOrder");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   178
	SQAIOrder.DefSQFunction(engine, &AIOrder::InsertOrder,         "InsertOrder");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   179
	SQAIOrder.DefSQFunction(engine, &AIOrder::RemoveOrder,         "RemoveOrder");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   180
	SQAIOrder.DefSQFunction(engine, &AIOrder::ChangeOrder,         "ChangeOrder");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   181
	SQAIOrder.DefSQFunction(engine, &AIOrder::CopyOrders,          "CopyOrders");
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   182
	SQAIOrder.PostRegister(engine);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   183
}
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   184
#endif /* SQUIRREL_CLASS */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   185
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   186
#endif /* AI_ORDER_HPP */