author | rubidium |
Mon, 23 Jun 2008 12:46:38 +0000 | |
branch | noai |
changeset 11057 | 188a9ca6d8de |
permissions | -rw-r--r-- |
11057
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
2 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
3 |
/** @file ai_group.hpp Everything to put vehicles into groups. */ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
4 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
5 |
#ifndef AI_GROUP_HPP |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
6 |
#define AI_GROUP_HPP |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
7 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
8 |
#include "ai_object.hpp" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
9 |
#include "ai_vehicle.hpp" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
10 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
11 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
12 |
* Class that handles all group related functions. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
13 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
14 |
class AIGroup : public AIObject { |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
15 |
public: |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
16 |
static const char *GetClassName() { return "AIGroup"; } |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
17 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
18 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
19 |
* The group IDs of some special groups. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
20 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
21 |
enum GroupID { |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
22 |
/* Values are important, as they represent the internal state of the game (see group_type.h). */ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
23 |
ALL_GROUP = 0xFFFD, //!< All vehicles are in this group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
24 |
DEFAULT_GROUP = 0xFFFE, //!< Vehicles not put in any other group are in this one. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
25 |
INVALID_GROUP = 0xFFFF, //!< An invalid group id. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
26 |
}; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
27 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
28 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
29 |
* Checks whether the given group is valid. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
30 |
* @param group_id The group to check. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
31 |
* @pre group_id != DEFAULT_GROUP && group_id != ALL_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
32 |
* @return True if and only if the group is valid. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
33 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
34 |
static bool IsValidGroup(GroupID group_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
35 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
36 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
37 |
* Create a new group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
38 |
* @param vehicle_type The type of vehicle to create a group for. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
39 |
* @return The GroupID of the new group, or an invalid GroupID when |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
40 |
* it failed. Check the return value using IsValidGroup(). In test-mode |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
41 |
* 0 is returned if it was successful; any other value indicates failure. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
42 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
43 |
static GroupID CreateGroup(AIVehicle::VehicleType vehicle_type); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
44 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
45 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
46 |
* Delete the given group. When the deletion succeeds all vehicles in the |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
47 |
* given group will move to the DEFAULT_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
48 |
* @param group_id The group to delete. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
49 |
* @pre IsValidGroup(group_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
50 |
* @return True if and only if the group was succesfully deleted. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
51 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
52 |
static bool DeleteGroup(GroupID group_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
53 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
54 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
55 |
* Get the vehicle type of a group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
56 |
* @param group_id The group to get the type from. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
57 |
* @pre IsValidGroup(group_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
58 |
* @return The vehicletype of the given group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
59 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
60 |
static AIVehicle::VehicleType GetVehicleType(GroupID group_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
61 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
62 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
63 |
* Set the name of a group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
64 |
* @param group_id The group to set the name for. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
65 |
* @param name The name for the group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
66 |
* @pre IsValidGroup(group_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
67 |
* @pre Name has to be unique. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
68 |
* @pre Name has to be at least one character long. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
69 |
* @return True if and only if the name was changed. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
70 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
71 |
static bool SetName(GroupID group_id, const char *name); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
72 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
73 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
74 |
* Get the name of a group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
75 |
* @param group_id The group to get the name of. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
76 |
* @pre IsValidGroup(group_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
77 |
* @return The name the group has. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
78 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
79 |
static char *GetName(GroupID group_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
80 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
81 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
82 |
* Enable or disable autoreplace protected. If the protection is |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
83 |
* enabled, global autoreplace won't affect vehicles in this group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
84 |
* @param group_id The group to change the protection for. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
85 |
* @param enable True if protection should be enabled. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
86 |
* @pre IsValidGroup(group_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
87 |
* @return True if and only if the protection was succesfully changed. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
88 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
89 |
static bool EnableAutoReplaceProtection(GroupID group_id, bool enable); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
90 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
91 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
92 |
* Get the autoreplace protection status. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
93 |
* @param group_id The group to get the protection status for. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
94 |
* @pre IsValidGroup(group_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
95 |
* @return The autoreplace protection status for the given group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
96 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
97 |
static bool GetAutoReplaceProtection(GroupID group_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
98 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
99 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
100 |
* Get the number of engines in a given group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
101 |
* @param group_id The group to get the number of engines in. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
102 |
* @param engine_id The engine id to count. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
103 |
* @pre IsValidGroup(group_id) || group_id == ALL_GROUP || group_id == DEFAULT_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
104 |
* @return The number of engines with id engine_id in the group with id group_id. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
105 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
106 |
static int32 GetNumEngines(GroupID group_id, EngineID engine_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
107 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
108 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
109 |
* Move a vehicle to a group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
110 |
* @param group_id The group to move the vehicel to. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
111 |
* @param vehicle_id The vehicle to move to the group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
112 |
* @pre IsValidGroup(group_id) || group_id == DEFAULT_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
113 |
* @pre AIVehicle::IsValidVehicle(vehicle_id). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
114 |
* @return True if and only if the vehicle was succesfully moved to the group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
115 |
* @note A vehicle can be in only one group at the same time. To remove it from |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
116 |
* a group, move it to another or to DEFAULT_GROUP. Moving the vehicle to the |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
117 |
* given group means removing it from another group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
118 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
119 |
static bool MoveVehicle(GroupID group_id, VehicleID vehicle_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
120 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
121 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
122 |
* Start replacing all vehicles with a specified engine with another engine. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
123 |
* @param group_id The group to replace vehicles from. Use ALL_GROUP to replace |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
124 |
* vehicles from all groups that haven't set autoreplace protection. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
125 |
* @param engine_id_old The engine id to start replacing. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
126 |
* @param engine_id_new The engine id to replace with. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
127 |
* @pre IsValidGroup(group_id) || group_id == ALL_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
128 |
* @pre AIEngine.IsValidEngine(engine_id_new). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
129 |
* @note To stop autoreplacing engine_id_old, call StopAutoReplace(group_id, engine_id_old). |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
130 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
131 |
static bool SetAutoReplace(GroupID group_id, EngineID engine_id_old, EngineID engine_id_new); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
132 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
133 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
134 |
* Get the EngineID the given EngineID is replaced with. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
135 |
* @param group_id The group to get the replacement from. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
136 |
* @param engine_id The engine that is being replaced. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
137 |
* @pre IsValidGroup(group_id) || group_id == ALL_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
138 |
* @return The EngineID that is replacing engine_id or an invalid EngineID |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
139 |
* in case engine_id is not begin replaced. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
140 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
141 |
static EngineID GetEngineReplacement(GroupID group_id, EngineID engine_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
142 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
143 |
/** |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
144 |
* Stop replacing a certain engine in the specified group. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
145 |
* @param group_id The group to stop replacing the engine in. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
146 |
* @param engine_id The engine id to stop replacing with another engine. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
147 |
* @pre IsValidGroup(group_id) || group_id == ALL_GROUP. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
148 |
* @return True if and if the replacing was succesfully stopped. |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
149 |
*/ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
150 |
static bool StopAutoReplace(GroupID group_id, EngineID engine_id); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
151 |
}; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
152 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
153 |
#endif /* AI_GROUP_HPP */ |