src/ai/api/ai_order.hpp
author truebrain
Fri, 22 Feb 2008 12:30:17 +0000
branchnoai
changeset 9737 ee408edf3851
parent 9707 a5f233287295
child 9829 80fbe02a4184
permissions -rw-r--r--
(svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
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
	/**
9529
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    16
	 * The name of the class, needed by several sub-processes.
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    17
	 */
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    18
	static const char *GetClassName() { return "AIOrder"; }
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    19
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    20
	/**
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    21
	 * Flags that can be used to modify the behaviour of orders.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    22
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    23
	enum AIOrderFlags {
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    24
		/** 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
    25
		AIOF_NONE              = 0,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    26
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    27
		/** Transfer instead of deliver the goods; only for stations. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    28
		AIOF_TRANSFER          = 1 << 0,
9548
9f9f003dd9b5 (svn r9479) [NoAI] -Fix: AIOrder::ChangeOrder didn't work as expected, or rather CMD_MODIFY_ORDER didn't.
rubidium
parents: 9547
diff changeset
    29
		/** Always unload the vehicle; only for stations. Cannot be set when AIOF_FULL_LOAD is set. */
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    30
		AIOF_UNLOAD            = 1 << 1,
9548
9f9f003dd9b5 (svn r9479) [NoAI] -Fix: AIOrder::ChangeOrder didn't work as expected, or rather CMD_MODIFY_ORDER didn't.
rubidium
parents: 9547
diff changeset
    31
		/** Wait till the the vehicle is fully loaded; only for stations. Cannot be set when AIOF_UNLOAD is set. */
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    32
		AIOF_FULL_LOAD         = 1 << 2,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    33
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    34
		/** 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
    35
		AIOF_SERVICE_IF_NEEDED = 1 << 2,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    36
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    37
		/** 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
    38
		AIOF_NON_STOP          = 1 << 3,
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
		/** For marking invalid order flags */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    41
		AIOF_INVALID           = 0xFFFF,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    42
	};
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    43
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    44
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    45
	 * 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
    46
	 * @param vehicle_id the vehicle to check the order index for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    47
	 * @param order_id   the order index to check.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    48
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    49
	 * @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
    50
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    51
	static bool IsValidVehicleOrder(VehicleID vehicle_id, uint32 order_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    52
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
	 * 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
    55
	 * @param destination the destination of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    56
	 * @param order_flags the flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    57
	 * @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
    58
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    59
	static bool AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    60
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    61
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    62
	 * Returns the number of orders for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    63
	 * @param vehicle_id the vehicle to get the order count of.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    64
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    65
	 * @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
    66
	 *   value when the vehicle does not exist.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    67
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
    68
	static int32 GetNumberOfOrders(VehicleID vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    69
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    70
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    71
	 * Gets the destination of the given order for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    72
	 * @param vehicle_id the vehicle to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    73
	 * @param order_id   the order to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    74
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    75
	 * @return the destination tile of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    76
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
    77
	static TileIndex GetOrderDestination(VehicleID vehicle_id, uint32 order_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    78
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    79
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    80
	 * Gets the AIOrderFlags of the given order for the given vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    81
	 * @param vehicle_id the vehicle to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    82
	 * @param order_id   the order to get the destination for.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    83
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    84
	 * @return the AIOrderFlags of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    85
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
    86
	static AIOrderFlags GetOrderFlags(VehicleID vehicle_id, uint32 order_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    87
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    88
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    89
	 * 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
    90
	 * @param vehicle_id  the vehicle to append the order to.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    91
	 * @param destination the destination of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    92
	 * @param order_flags the flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    93
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    94
	 * @pre AreOrderFlagsValid(destination, order_flags).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    95
	 * @return true if and only if the order was appended.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    96
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
    97
	static bool AppendOrder(VehicleID vehicle_id, TileIndex destination, AIOrderFlags order_flags);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    98
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    99
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   100
	 * 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
   101
	 * @param vehicle_id  the vehicle to add the order to.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   102
	 * @param order_id    the order to place the new order before.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   103
	 * @param destination the destination of the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   104
	 * @param order_flags the flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   105
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   106
	 * @pre AreOrderFlagsValid(destination, order_flags).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   107
	 * @return true if and only if the order was inserted.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   108
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   109
	static bool InsertOrder(VehicleID vehicle_id, uint32 order_id, TileIndex destination, AIOrderFlags order_flags);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   110
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   111
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   112
	 * Removes an order from the vehicle's order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   113
	 * @param vehicle_id  the vehicle to remove the order from.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   114
	 * @param order_id    the order to remove from the order list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   115
	 * @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   116
	 * @return true if and only if the order was removed.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   117
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   118
	static bool RemoveOrder(VehicleID vehicle_id, uint32 order_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   119
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   120
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   121
	 * Changes the order flags of the given order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   122
	 * @param vehicle_id  the vehicle to change the order of.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   123
	 * @param order_id    the order to change.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   124
	 * @param order_flags the new flags given to the order.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   125
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   126
	 * @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_id), order_flags).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   127
	 * @return true if and only if the order was changed.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   128
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   129
	static bool ChangeOrder(VehicleID vehicle_id, uint32 order_id, AIOrderFlags order_flags);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   130
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   131
	/**
9707
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   132
	 * Move an order inside the orderlist
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   133
	 * @param vehicle_id  the vehicle to move the orders.
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   134
	 * @param order_id_move    the order to move.
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   135
	 * @param order_id_target  the target order
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   136
	 * @pre IsValidVehicleOrder(vehicle_id, order_id_move).
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   137
	 * @pre IsValidVehicleOrder(vehicle_id, order_id_target).
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   138
	 * @return true if and only if the order was moved.
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   139
	 * @note If the order is moved to a lower place (e.g. from 7 to 2)
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   140
	 *  the target order is moved upwards (e.g. 3). If the order is moved
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   141
	 *  to a higher place (e.g. from 7 to 9) the target will be moved
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   142
	 *  downwards (e.g. 8).
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   143
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   144
	static bool MoveOrder(VehicleID vehicle_id, uint32 order_id_move, uint32 order_id_target);
9707
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   145
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   146
	/**
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   147
	 * Copies the orders from another vehicle. The orders of the main
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   148
	 * vehicle are going to be the orders of the changed vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   149
	 * @param vehicle_id      the vehicle to copy the orders to.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   150
	 * @param main_vehicle_id the vehicle to copy the orders from.
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
	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   153
	 * @return true if and only if the copying succeeded.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   154
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   155
	static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   156
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
	 * Shares the orders between two vehicles. The orders of the main
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   159
	 * vehicle are going to be the orders of the changed vehicle.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   160
	 * @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
   161
	 * @param main_vehicle_id the vehicle to share the orders with.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   162
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   163
	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   164
	 * @return true if and only if the sharing succeeded.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   165
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   166
	static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   167
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   168
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   169
	 * Removes the given vehicle from a shared orders list.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   170
	 * @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
   171
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   172
	 * @return true if and only if the unsharing succeeded.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   173
	 */
9737
ee408edf3851 (svn r12216) [NoAI] -Codechange: made most functions 'static', which removes the need to create an instance to get, for example, engine information, and therefor heavily simplifying AI creation (Morloth)
truebrain
parents: 9707
diff changeset
   174
	static bool UnshareOrders(VehicleID vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   175
};
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   176
DECLARE_ENUM_AS_BIT_SET(AIOrder::AIOrderFlags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   177
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   178
#endif /* AI_ORDER_HPP */