author | rubidium |
Tue, 08 Apr 2008 07:19:02 +0000 | |
branch | noai |
changeset 10093 | b3849a19d137 |
parent 9838 | 0839682a601b |
child 10096 | 780921b39016 |
permissions | -rw-r--r-- |
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" |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
9 |
#include "ai_error.hpp" |
9500
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 |
/** |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
12 |
* Class that handles all order related functions. |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
13 |
*/ |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
14 |
class AIOrder : public AIObject { |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
15 |
public: |
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
16 |
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
|
17 |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
18 |
enum ErrorMessages { |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
19 |
/** Base for all order related errors */ |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
20 |
ERR_ORDER_BASE = AIError::ERR_CAT_ORDER << AIError::ERR_CAT_BIT_SIZE, |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
21 |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
22 |
/** No more space for orders */ |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
23 |
ERR_ORDER_TOO_MANY, // [STR_8831_NO_MORE_SPACE_FOR_ORDERS] |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
24 |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
25 |
/** Destination of new order is to far away from the previous order */ |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
26 |
ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, // [STR_0210_TOO_FAR_FROM_PREVIOUS_DESTINATIO] |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
27 |
}; |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
28 |
|
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
29 |
/** |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
30 |
* Flags that can be used to modify the behaviour of orders. |
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 |
enum AIOrderFlags { |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
33 |
/** 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
|
34 |
AIOF_NONE = 0, |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
35 |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
36 |
/** Transfer instead of deliver the goods; only for stations. */ |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
37 |
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
|
38 |
/** 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
|
39 |
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
|
40 |
/** 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
|
41 |
AIOF_FULL_LOAD = 1 << 2, |
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 |
/** 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
|
44 |
AIOF_SERVICE_IF_NEEDED = 1 << 2, |
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 |
/** 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
|
47 |
AIOF_NON_STOP = 1 << 3, |
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 |
/** For marking invalid order flags */ |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
50 |
AIOF_INVALID = 0xFFFF, |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
51 |
}; |
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 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
|
55 |
* @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
|
56 |
* @param order_id The order index to check. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
57 |
* @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
|
58 |
* @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
|
59 |
*/ |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
60 |
static bool IsValidVehicleOrder(VehicleID vehicle_id, uint32 order_id); |
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 |
/** |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
63 |
* 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
|
64 |
* @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
|
65 |
* @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
|
66 |
* @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
|
67 |
*/ |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
68 |
static bool AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags); |
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 |
* 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
|
72 |
* @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
|
73 |
* @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
|
74 |
* @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
|
75 |
* value when the vehicle does not exist. |
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 int32 GetNumberOfOrders(VehicleID vehicle_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 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
|
81 |
* @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
|
82 |
* @param order_id The order to get the destination for. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
83 |
* @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
|
84 |
* @return The destination tile of the order. |
9500
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 TileIndex GetOrderDestination(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 |
* 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
|
90 |
* @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
|
91 |
* @param order_id The order to get the destination for. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
92 |
* @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
|
93 |
* @return The AIOrderFlags of the order. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
94 |
*/ |
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
|
95 |
static AIOrderFlags GetOrderFlags(VehicleID vehicle_id, uint32 order_id); |
9500
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 |
/** |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
98 |
* 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
|
99 |
* @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
|
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 AIVehicle::IsValidVehicle(vehicle_id). |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
103 |
* @pre AreOrderFlagsValid(destination, order_flags). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
104 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
105 |
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
106 |
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_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
|
107 |
* @return True if and only if the order was appended. |
9500
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 AppendOrder(VehicleID vehicle_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 |
* 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
|
113 |
* @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
|
114 |
* @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
|
115 |
* @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
|
116 |
* @param order_flags The flags given to the order. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
117 |
* @pre IsValidVehicleOrder(vehicle_id, order_id). |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
118 |
* @pre AreOrderFlagsValid(destination, order_flags). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
119 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
120 |
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
121 |
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_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
|
122 |
* @return True if and only if the order was inserted. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
123 |
*/ |
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
|
124 |
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
|
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 |
* 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
|
128 |
* @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
|
129 |
* @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
|
130 |
* @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_id). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
131 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
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
|
132 |
* @return True if and only if the order was removed. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
133 |
*/ |
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
|
134 |
static bool RemoveOrder(VehicleID vehicle_id, uint32 order_id); |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
135 |
|
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 |
* 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
|
138 |
* @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
|
139 |
* @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
|
140 |
* @param order_flags The new flags given to the order. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
141 |
* @pre IsValidVehicleOrder(vehicle_id, order_id). |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
142 |
* @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_id), order_flags). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
143 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
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 |
* @return True if and only if the order was changed. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
145 |
*/ |
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
|
146 |
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
|
147 |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
148 |
/** |
9707
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
149 |
* 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
|
150 |
* @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
|
151 |
* @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
|
152 |
* @param order_id_target The target order |
9707
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
153 |
* @pre IsValidVehicleOrder(vehicle_id, order_id_move). |
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
154 |
* @pre IsValidVehicleOrder(vehicle_id, order_id_target). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
155 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
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
|
156 |
* @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
|
157 |
* @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
|
158 |
* 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
|
159 |
* 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
|
160 |
* downwards (e.g. 8). |
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
161 |
*/ |
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
|
162 |
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
|
163 |
|
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
164 |
/** |
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
|
165 |
* 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
|
166 |
* 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
|
167 |
* @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
|
168 |
* @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
|
169 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
170 |
* @pre AIVehicle::IsValidVehicle(main_vehicle_id). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
171 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
172 |
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE |
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
|
173 |
* @return True if and only if the copying succeeded. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
174 |
*/ |
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
|
175 |
static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
176 |
|
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 |
* Shares the orders between two vehicles. The orders of the main |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
179 |
* 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
|
180 |
* @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
|
181 |
* @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
|
182 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
183 |
* @pre AIVehicle::IsValidVehicle(main_vehicle_id). |
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
184 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
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
|
185 |
* @return True if and only if the sharing succeeded. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
186 |
*/ |
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
|
187 |
static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
188 |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
189 |
/** |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
190 |
* 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
|
191 |
* @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
|
192 |
* @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
|
193 |
* @return True if and only if the unsharing succeeded. |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
194 |
*/ |
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
|
195 |
static bool UnshareOrders(VehicleID vehicle_id); |
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
196 |
}; |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
197 |
DECLARE_ENUM_AS_BIT_SET(AIOrder::AIOrderFlags); |
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
198 |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
199 |
#endif /* AI_ORDER_HPP */ |