| author | truebrain |
| Mon, 30 Jun 2008 12:15:10 +0000 | |
| branch | noai |
| changeset 11097 | 6967c52c78c5 |
| parent 11029 | 776c7cc8bda5 |
| 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 |
|
|
10096
780921b39016
(svn r12627) [NoAI] -Fix: last few commits missed some comments around enums
truebrain
parents:
10093
diff
changeset
|
18 |
/** |
|
780921b39016
(svn r12627) [NoAI] -Fix: last few commits missed some comments around enums
truebrain
parents:
10093
diff
changeset
|
19 |
* All order related error messages. |
|
780921b39016
(svn r12627) [NoAI] -Fix: last few commits missed some comments around enums
truebrain
parents:
10093
diff
changeset
|
20 |
*/ |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
21 |
enum ErrorMessages {
|
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
22 |
/** Base for all order related errors */ |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
23 |
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
|
24 |
|
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
25 |
/** No more space for orders */ |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
26 |
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
|
27 |
|
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
28 |
/** 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
|
29 |
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
|
30 |
}; |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
31 |
|
|
9529
5f26f4bc574b
(svn r9450) [NoAI] -Fix: don't allow static-method calls from SQ to non-static functions
truelight
parents:
9526
diff
changeset
|
32 |
/** |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
33 |
* Flags that can be used to modify the behaviour of orders. |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
34 |
*/ |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
35 |
enum AIOrderFlags {
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
36 |
/** 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
|
37 |
AIOF_NONE = 0, |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
38 |
|
|
10181
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10149
diff
changeset
|
39 |
/** Do not stop at the stations that are passed when going to the destination. Only for trains and road vehicles. */ |
|
10149
a273c164cfab
(svn r12680) [NoAI] -Fix [API CHANGE]: don't use very very long AIOF_NON_STOP flags, but AIOF_NON_STOP_INTERMEDIATE / AIOF_NON_STOP_DESTINATION instead
truebrain
parents:
10146
diff
changeset
|
40 |
AIOF_NON_STOP_INTERMEDIATE = 1 << 0, |
|
10181
54df587fef5d
(svn r12712) [NoAI] -Sync with trunk r12672:12711.
rubidium
parents:
10149
diff
changeset
|
41 |
/** Do not stop at the destionation station. Only for trains and road vehicles. */ |
|
10149
a273c164cfab
(svn r12680) [NoAI] -Fix [API CHANGE]: don't use very very long AIOF_NON_STOP flags, but AIOF_NON_STOP_INTERMEDIATE / AIOF_NON_STOP_DESTINATION instead
truebrain
parents:
10146
diff
changeset
|
42 |
AIOF_NON_STOP_DESTINATION = 1 << 1, |
|
10146
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
43 |
|
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
44 |
/** Always unload the vehicle; only for stations. Cannot be set when AIOF_TRANSFER or AIOF_NO_UNLOAD is set. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
45 |
AIOF_UNLOAD = 1 << 2, |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
46 |
/** Transfer instead of deliver the goods; only for stations. Cannot be set when AIOF_UNLOAD or AIOF_NO_UNLOAD is set. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
47 |
AIOF_TRANSFER = 1 << 3, |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
48 |
/** Never unload the vehicle; only for stations. Cannot be set when AIOF_UNLOAD, AIOF_TRANSFER or AIOF_NO_LOAD is set. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
49 |
AIOF_NO_UNLOAD = 1 << 4, |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
50 |
|
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
51 |
/** Wait till the vehicle is fully loaded; only for stations. Cannot be set when AIOF_NO_LOAD is set. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
52 |
AIOF_FULL_LOAD = 2 << 5, |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
53 |
/** Wait till at least one cargo of the vehicle is fully loaded; only for stations. Cannot be set when AIOF_NO_LOAD is set. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
54 |
AIOF_FULL_LOAD_ANY = 3 << 5, |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
55 |
/** Do not load any cargo; only for stations. Cannot be set when AIOF_NO_UNLOAD, AIOF_FULL_LOAD or AIOF_FULL_LOAD_ANY is set. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
56 |
AIOF_NO_LOAD = 1 << 7, |
|
9500
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 |
/** 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
|
59 |
AIOF_SERVICE_IF_NEEDED = 1 << 2, |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
60 |
|
|
10146
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
61 |
/** All flags related to non-stop settings. */ |
|
10149
a273c164cfab
(svn r12680) [NoAI] -Fix [API CHANGE]: don't use very very long AIOF_NON_STOP flags, but AIOF_NON_STOP_INTERMEDIATE / AIOF_NON_STOP_DESTINATION instead
truebrain
parents:
10146
diff
changeset
|
62 |
AIOF_NON_STOP_FLAGS = AIOF_NON_STOP_INTERMEDIATE | AIOF_NON_STOP_DESTINATION, |
|
10146
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
63 |
/** All flags related to unloading. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
64 |
AIOF_UNLOAD_FLAGS = AIOF_TRANSFER | AIOF_UNLOAD | AIOF_NO_UNLOAD, |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
65 |
/** All flags related to loading. */ |
|
ddbb8d2ae3ea
(svn r12677) [NoAI] -Change [API CHANGE]: rework of the OrderFlags to support the new order possibilities in OpenTTD. As a result of this the following has changed:
rubidium
parents:
10096
diff
changeset
|
66 |
AIOF_LOAD_FLAGS = AIOF_FULL_LOAD | AIOF_FULL_LOAD_ANY | AIOF_NO_LOAD, |
|
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 |
/** For marking invalid order flags */ |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
69 |
AIOF_INVALID = 0xFFFF, |
|
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 |
|
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
72 |
/** Different constants related to the OrderPosition */ |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
73 |
enum OrderPosition {
|
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
74 |
CURRENT_ORDER = 0xFF, //!< Constant that gets resolved to the current order. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
75 |
INVALID_ORDER = -1, //!< An invalid order. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
76 |
}; |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
77 |
|
|
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 |
* 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
|
80 |
* @param vehicle_id The vehicle to check the order index for. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
81 |
* @param order_position The order index to check. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
82 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
83 |
* @return True if and only if the order_position is valid for the given vehicle. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
84 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
85 |
static bool IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position); |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
86 |
|
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
87 |
/** |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
88 |
* Resolves the given order index to the correct index for the given vehicle. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
89 |
* If the order index was CURRENT_ORDER it will be resolved to the index of |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
90 |
* the current order (as shown in the order list). If the order with the |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
91 |
* given index does not exist it will return INVALID_ORDER. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
92 |
* @param vehicle_id The vehicle to check the order index for. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
93 |
* @param order_position The order index to resolve. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
94 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
95 |
* @return The resolved order index. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
96 |
*/ |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
97 |
static OrderPosition ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position); |
|
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 |
* 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
|
101 |
* @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
|
102 |
* @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
|
103 |
* @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
|
104 |
*/ |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
105 |
static bool AreOrderFlagsValid(TileIndex destination, AIOrderFlags order_flags); |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
106 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
107 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
108 |
* 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
|
109 |
* @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
|
110 |
* @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
|
111 |
* @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
|
112 |
* value when the vehicle does not exist. |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
113 |
*/ |
|
10844
affb2821fb9f
(svn r13395) [NoAI] -Fix [API CHANGE]: Rename AIOrder::GetNumberOfORders to AIOrder::GetOrderCount
truebrain
parents:
10181
diff
changeset
|
114 |
static int32 GetOrderCount(VehicleID vehicle_id); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
115 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
116 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
117 |
* 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
|
118 |
* @param vehicle_id The vehicle to get the destination for. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
119 |
* @param order_position The order to get the destination for. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
120 |
* @pre IsValidVehicleOrder(vehicle_id, order_position). |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
121 |
* @note Giving CURRENT_ORDER as order_position will give the order that is |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
122 |
* currently being executed by the vehicle. This is not necessarily the |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
123 |
* current order as given by ResolveOrderPosition (the current index in the |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
124 |
* order list) as manual or autoservicing depot orders do not show up |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
125 |
* in the orderlist, but they can be the current order of a 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
|
126 |
* @return The destination tile of the order. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
127 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
128 |
static TileIndex GetOrderDestination(VehicleID vehicle_id, OrderPosition order_position); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
129 |
|
|
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 |
* 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
|
132 |
* @param vehicle_id The vehicle to get the destination for. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
133 |
* @param order_position The order to get the destination for. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
134 |
* @pre IsValidVehicleOrder(vehicle_id, order_position). |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
135 |
* @note Giving CURRENT_ORDER as order_position will give the order that is |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
136 |
* currently being executed by the vehicle. This is not necessarily the |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
137 |
* current order as given by ResolveOrderPosition (the current index in the |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
138 |
* order list) as manual or autoservicing depot orders do not show up |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
139 |
* in the orderlist, but they can be the current order of a 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
|
140 |
* @return The AIOrderFlags of the order. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
141 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
142 |
static AIOrderFlags GetOrderFlags(VehicleID vehicle_id, OrderPosition order_position); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
143 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
144 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
145 |
* 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
|
146 |
* @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
|
147 |
* @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
|
148 |
* @param order_flags The flags given to the order. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
149 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
150 |
* @pre AreOrderFlagsValid(destination, order_flags). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
151 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
152 |
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
153 |
* @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
|
154 |
* @return True if and only if the order was appended. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
155 |
*/ |
|
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
|
156 |
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
|
157 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
158 |
/** |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
159 |
* Inserts an order before the given order_position 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
|
160 |
* @param vehicle_id The vehicle to add the order to. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
161 |
* @param order_position The order to place the new order before. |
|
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
|
162 |
* @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
|
163 |
* @param order_flags The flags given to the order. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
164 |
* @pre IsValidVehicleOrder(vehicle_id, order_position). |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
165 |
* @pre AreOrderFlagsValid(destination, order_flags). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
166 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
167 |
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
168 |
* @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
|
169 |
* @return True if and only if the order was inserted. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
170 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
171 |
static bool InsertOrder(VehicleID vehicle_id, OrderPosition order_position, TileIndex destination, AIOrderFlags order_flags); |
|
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 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
174 |
* 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
|
175 |
* @param vehicle_id The vehicle to remove the order from. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
176 |
* @param order_position The order to remove from the order list. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
177 |
* @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_position). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
178 |
* @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
|
179 |
* @return True if and only if the order was removed. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
180 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
181 |
static bool RemoveOrder(VehicleID vehicle_id, OrderPosition order_position); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
182 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
183 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
184 |
* 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
|
185 |
* @param vehicle_id The vehicle to change the order of. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
186 |
* @param order_position The order to change. |
|
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
|
187 |
* @param order_flags The new flags given to the order. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
188 |
* @pre IsValidVehicleOrder(vehicle_id, order_position). |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
189 |
* @pre AreOrderFlagsValid(GetOrderDestination(vehicle_id, order_position), order_flags). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
190 |
* @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
|
191 |
* @return True if and only if the order was changed. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
192 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
193 |
static bool ChangeOrder(VehicleID vehicle_id, OrderPosition order_position, AIOrderFlags order_flags); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
194 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
195 |
/** |
|
9707
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
196 |
* 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
|
197 |
* @param vehicle_id The vehicle to move the orders. |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
198 |
* @param order_position_move The order to move. |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
199 |
* @param order_position_target The target order |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
200 |
* @pre IsValidVehicleOrder(vehicle_id, order_position_move). |
|
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
201 |
* @pre IsValidVehicleOrder(vehicle_id, order_position_target). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
202 |
* @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
|
203 |
* @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
|
204 |
* @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
|
205 |
* 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
|
206 |
* 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
|
207 |
* downwards (e.g. 8). |
|
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
208 |
*/ |
|
11029
776c7cc8bda5
(svn r13585) [NoAI] -Add: possibility to get information/perform order changes based on the current order of a vehicle.
rubidium
parents:
10844
diff
changeset
|
209 |
static bool MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target); |
|
9707
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
210 |
|
|
a5f233287295
(svn r11273) [NoAI] -Add: added AIOrder::MoveOrder (dynaxo)
truelight
parents:
9596
diff
changeset
|
211 |
/** |
|
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
|
212 |
* 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
|
213 |
* 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
|
214 |
* @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
|
215 |
* @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
|
216 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
217 |
* @pre AIVehicle::IsValidVehicle(main_vehicle_id). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
218 |
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY |
|
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
219 |
* @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
|
220 |
* @return True if and only if the copying succeeded. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
221 |
*/ |
|
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
|
222 |
static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
223 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
224 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
225 |
* Shares the orders between two vehicles. The orders of the main |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
226 |
* 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
|
227 |
* @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
|
228 |
* @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
|
229 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
230 |
* @pre AIVehicle::IsValidVehicle(main_vehicle_id). |
|
10093
b3849a19d137
(svn r12623) [NoAI] -Add: support for GetLastError in AIOrder.
rubidium
parents:
9838
diff
changeset
|
231 |
* @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
|
232 |
* @return True if and only if the sharing succeeded. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
233 |
*/ |
|
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
|
234 |
static bool ShareOrders(VehicleID vehicle_id, VehicleID main_vehicle_id); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
235 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
236 |
/** |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
237 |
* 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
|
238 |
* @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
|
239 |
* @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
|
240 |
* @return True if and only if the unsharing succeeded. |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
241 |
*/ |
|
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
|
242 |
static bool UnshareOrders(VehicleID vehicle_id); |
|
9500
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
243 |
}; |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
244 |
DECLARE_ENUM_AS_BIT_SET(AIOrder::AIOrderFlags); |
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
245 |
|
|
d67653613da4
(svn r9374) [NoAI] -Add: functionality to modify orders.
rubidium
parents:
diff
changeset
|
246 |
#endif /* AI_ORDER_HPP */ |