src/ai/api/ai_order.hpp
author truebrain
Mon, 31 Mar 2008 08:42:20 +0000
branchnoai
changeset 9838 0839682a601b
parent 9829 80fbe02a4184
child 10093 b3849a19d137
permissions -rw-r--r--
(svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
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
9829
80fbe02a4184 (svn r12491) [NoAI] -Documentation: made parts of the comments more uniform (@file header and class header)
truebrain
parents: 9737
diff changeset
     3
/** @file ai_order.hpp Everything to query and build orders. */
9500
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:
9529
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    15
	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
    16
5f26f4bc574b (svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents: 9526
diff changeset
    17
	/**
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    18
	 * Flags that can be used to modify the behaviour of orders.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    19
	 */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    20
	enum AIOrderFlags {
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    21
		/** 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
    22
		AIOF_NONE              = 0,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    23
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    24
		/** Transfer instead of deliver the goods; only for stations. */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    25
		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
    26
		/** 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
    27
		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
    28
		/** 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
    29
		AIOF_FULL_LOAD         = 1 << 2,
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    30
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    31
		/** 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
    32
		AIOF_SERVICE_IF_NEEDED = 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
		/** 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
    35
		AIOF_NON_STOP          = 1 << 3,
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
		/** For marking invalid order flags */
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    38
		AIOF_INVALID           = 0xFFFF,
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
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    41
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    42
	 * Checks whether the given order id is valid for the given vehicle.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    43
	 * @param vehicle_id The vehicle to check the order index for.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    44
	 * @param order_id The order index to check.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    45
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    46
	 * @return True if and only if the order_id is valid for the given vehicle.
9500
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
	static bool IsValidVehicleOrder(VehicleID vehicle_id, uint32 order_id);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    49
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
	 * Checks whether the given order flags are valid for the given destination.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    52
	 * @param destination The destination of the order.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    53
	 * @param order_flags The flags given to the order.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    54
	 * @return True if and only if the order_flags are valid for the given location.
9500
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
	static bool AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    57
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
	 * Returns the number of orders for the given vehicle.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    60
	 * @param vehicle_id The vehicle to get the order count of.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    61
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    62
	 * @return The number of orders for the given vehicle or a negative
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    63
	 *   value when the vehicle does not exist.
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    64
	 */
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
    65
	static int32 GetNumberOfOrders(VehicleID vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    66
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    67
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    68
	 * Gets the destination of the given order for the given vehicle.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    69
	 * @param vehicle_id The vehicle to get the destination for.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    70
	 * @param order_id The order to get the destination for.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    71
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    72
	 * @return The destination tile of the order.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    73
	 */
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
    74
	static TileIndex GetOrderDestination(VehicleID vehicle_id, uint32 order_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    75
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    76
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    77
	 * Gets the AIOrderFlags of the given order for the given vehicle.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    78
	 * @param vehicle_id The vehicle to get the destination for.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    79
	 * @param order_id The order to get the destination for.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    80
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    81
	 * @return The AIOrderFlags of the order.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    82
	 */
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
    83
	static AIOrderFlags GetOrderFlags(VehicleID vehicle_id, uint32 order_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    84
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    85
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    86
	 * Appends an order to the end of the vehicle's order list.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    87
	 * @param vehicle_id The vehicle to append the order to.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    88
	 * @param destination The destination of the order.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    89
	 * @param order_flags The flags given to the order.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    90
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    91
	 * @pre AreOrderFlagsValid(destination, order_flags).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    92
	 * @return True if and only if the order was appended.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    93
	 */
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
    94
	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
    95
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    96
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
    97
	 * Inserts an order before the given order_id into the vehicle's order list.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    98
	 * @param vehicle_id The vehicle to add the order to.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
    99
	 * @param order_id The order to place the new order before.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   100
	 * @param destination The destination of the order.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   101
	 * @param order_flags The flags given to the order.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   102
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   103
	 * @pre AreOrderFlagsValid(destination, order_flags).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   104
	 * @return True if and only if the order was inserted.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   105
	 */
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
   106
	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
   107
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   108
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   109
	 * Removes an order from the vehicle's order list.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   110
	 * @param vehicle_id The vehicle to remove the order from.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   111
	 * @param order_id The order to remove from the order list.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   112
	 * @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   113
	 * @return True if and only if the order was removed.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   114
	 */
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
   115
	static bool RemoveOrder(VehicleID vehicle_id, uint32 order_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   116
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   117
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   118
	 * Changes the order flags of the given order.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   119
	 * @param vehicle_id The vehicle to change the order of.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   120
	 * @param order_id The order to change.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   121
	 * @param order_flags The new flags given to the order.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   122
	 * @pre IsValidVehicleOrder(vehicle_id, order_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   123
	 * @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_id), order_flags).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   124
	 * @return True if and only if the order was changed.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   125
	 */
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
   126
	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
   127
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   128
	/**
9707
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   129
	 * Move an order inside the orderlist
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   130
	 * @param vehicle_id The vehicle to move the orders.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   131
	 * @param order_id_move The order to move.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   132
	 * @param order_id_target The target order
9707
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   133
	 * @pre IsValidVehicleOrder(vehicle_id, order_id_move).
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   134
	 * @pre IsValidVehicleOrder(vehicle_id, order_id_target).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   135
	 * @return True if and only if the order was moved.
9707
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   136
	 * @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
   137
	 *  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
   138
	 *  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
   139
	 *  downwards (e.g. 8).
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   140
	 */
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
   141
	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
   142
a5f233287295 (svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents: 9596
diff changeset
   143
	/**
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   144
	 * Copies the orders from another vehicle. The orders of the main vehicle
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   145
	 *  are going to be the orders of the changed vehicle.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   146
	 * @param vehicle_id The vehicle to copy the orders to.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   147
	 * @param main_vehicle_id The vehicle to copy the orders from.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   148
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   149
	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   150
	 * @return True if and only if the copying succeeded.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   151
	 */
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
   152
	static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
9500
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
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   155
	 * Shares the orders between two vehicles. The orders of the main
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   156
	 * vehicle are going to be the orders of the changed vehicle.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   157
	 * @param vehicle_id The vehicle to add to the shared order list.
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   158
	 * @param main_vehicle_id The vehicle to share the orders with.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   159
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   160
	 * @pre AIVehicle::IsValidVehicle(main_vehicle_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   161
	 * @return True if and only if the sharing succeeded.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   162
	 */
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
   163
	static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   164
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   165
	/**
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   166
	 * Removes the given vehicle from a shared orders list.
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   167
	 * @param vehicle_id The vehicle to remove from the shared order list.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   168
	 * @pre AIVehicle::IsValidVehicle(vehicle_id).
9838
0839682a601b (svn r12504) [NoAI] -Documentation: the last few files which now are consistent in their comments (anyway, so I hope :))
truebrain
parents: 9829
diff changeset
   169
	 * @return True if and only if the unsharing succeeded.
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   170
	 */
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
   171
	static bool UnshareOrders(VehicleID vehicle_id);
9500
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   172
};
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   173
DECLARE_ENUM_AS_BIT_SET(AIOrder::AIOrderFlags);
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   174
d67653613da4 (svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff changeset
   175
#endif /* AI_ORDER_HPP */