author | truebrain |
Fri, 18 Jul 2008 00:15:14 +0000 | |
branch | noai |
changeset 11165 | a725845fcc01 |
parent 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.cpp Implementation of AIGroup. */ |
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 |
#include "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 |
#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
|
7 |
#include "ai_engine.hpp" |
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 "../../openttd.h" |
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 "../../player_func.h" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
10 |
#include "../../group.h" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
11 |
#include "../../string_func.h" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
12 |
#include "../../strings_func.h" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
13 |
#include "../../core/alloc_func.hpp" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
14 |
#include "../../command_func.h" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
15 |
#include "../../autoreplace_func.h" |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
16 |
#include "table/strings.h" |
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 |
/* static */ bool AIGroup::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
|
19 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
20 |
return ::IsValidGroupID(group_id) && ::GetGroup(group_id)->owner == _current_player; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
21 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
22 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
23 |
/* static */ AIGroup::GroupID AIGroup::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
|
24 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
25 |
/* Reset the internal NewGroupID in case we are in TestMode */ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
26 |
AIObject::SetNewGroupID(0); |
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 |
bool ret = AIObject::DoCommand(0, (::VehicleType)vehicle_type, 0, CMD_CREATE_GROUP); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
29 |
return ret ? (GroupID)AIObject::GetNewGroupID() : INVALID_GROUP; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
30 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
31 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
32 |
/* static */ bool AIGroup::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
|
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 |
EnforcePrecondition(false, 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
|
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 |
return AIObject::DoCommand(0, group_id, 0, CMD_DELETE_GROUP); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
37 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
38 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
39 |
/* static */ AIVehicle::VehicleType AIGroup::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
|
40 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
41 |
if (!IsValidGroup(group_id)) return AIVehicle::VEHICLE_INVALID; |
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 |
return (AIVehicle::VehicleType)((::VehicleType)::GetGroup(group_id)->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 |
/* static */ bool AIGroup::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
|
47 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
48 |
EnforcePrecondition(false, 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
|
49 |
EnforcePrecondition(false, !::StrEmpty(name)); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
50 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
51 |
_cmd_text = name; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
52 |
return AIObject::DoCommand(0, group_id, 0, CMD_RENAME_GROUP); |
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 |
/* static */ char *AIGroup::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
|
56 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
57 |
if (!IsValidGroup(group_id)) return NULL; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
58 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
59 |
static const int len = 64; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
60 |
char *group_name = MallocT<char>(len); |
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 |
::SetDParam(0, 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
|
63 |
::GetString(group_name, STR_GROUP_NAME, &group_name[len - 1]); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
64 |
return group_name; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
65 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
66 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
67 |
/* static */ bool AIGroup::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
|
68 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
69 |
EnforcePrecondition(false, 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
|
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 |
return AIObject::DoCommand(0, group_id, enable ? 1 : 0, CMD_SET_GROUP_REPLACE_PROTECTION); |
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 |
/* static */ bool AIGroup::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
|
75 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
76 |
if (!IsValidGroup(group_id)) return false; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
77 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
78 |
return ::GetGroup(group_id)->replace_protection; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
79 |
} |
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 |
/* static */ int32 AIGroup::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
|
82 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
83 |
if (!IsValidGroup(group_id) && group_id != DEFAULT_GROUP && group_id != ALL_GROUP) return -1; |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
84 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
85 |
return GetGroupNumEngines(_current_player, group_id, 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
|
86 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
87 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
88 |
/* static */ bool AIGroup::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
|
89 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
90 |
EnforcePrecondition(false, 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
|
91 |
EnforcePrecondition(false, 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
|
92 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
93 |
return AIObject::DoCommand(0, group_id, vehicle_id, CMD_ADD_VEHICLE_GROUP); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
94 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
95 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
96 |
/* static */ bool AIGroup::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
|
97 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
98 |
EnforcePrecondition(false, 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
|
99 |
EnforcePrecondition(false, 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
|
100 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
101 |
return AIObject::DoCommand(0, 3 | (group_id << 16), (engine_id_new << 16) | engine_id_old, CMD_SET_AUTOREPLACE); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
102 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
103 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
104 |
/* static */ EngineID AIGroup::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
|
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 |
if (!IsValidGroup(group_id) && group_id != ALL_GROUP) return ::INVALID_ENGINE; |
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 |
return ::EngineReplacementForPlayer(GetPlayer(_current_player), engine_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
|
109 |
} |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
110 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
111 |
/* static */ bool AIGroup::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
|
112 |
{ |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
113 |
EnforcePrecondition(false, 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
|
114 |
|
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
115 |
return AIObject::DoCommand(0, 3 | (group_id << 16), (::INVALID_ENGINE << 16) | engine_id, CMD_SET_AUTOREPLACE); |
188a9ca6d8de
(svn r13614) [NoAI] -Add: AIGroup which allows an AI to manage its vehicle in the context of groups.
rubidium
parents:
diff
changeset
|
116 |
} |