MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / Flee

Function Flee

engine/Poseidon/AI/AIArcade.cpp:201–231  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

199};
200
201void Flee(AIGroupContext* context)
202{
203 AIGroup* group = context->_group;
204 AI_ERROR(group);
205
206 // reset radio messages to be able to react quickly
207 group->GetRadio().CancelAllMessages();
208 // reset all commands, join all subgroups
209 for (int i = 0; i < group->NSubgroups();)
210 {
211 AISubgroup* subgrp = group->GetSubgroup(i);
212 AI_ERROR(subgrp); // RefArray
213 if (subgrp == group->MainSubgroup())
214 {
215 subgrp->ClearAllCommands();
216 i++;
217 }
218 else
219 {
220 int nSubgroups = group->NSubgroups();
221 subgrp->JoinToSubgroup(group->MainSubgroup());
222 if (group->NSubgroups() >= nSubgroups)
223 {
224 Fail("Subgroup not joined");
225 i++;
226 }
227 }
228 }
229
230 context->_fsm->SetState(SArcadeFlee, context);
231}
232
233void Unflee(AIGroupContext* context)
234{

Callers 2

ThinkMethod · 0.85
FleeMethod · 0.85

Calls 7

CancelAllMessagesMethod · 0.80
NSubgroupsMethod · 0.80
MainSubgroupMethod · 0.80
ClearAllCommandsMethod · 0.80
JoinToSubgroupMethod · 0.80
GetSubgroupMethod · 0.45
SetStateMethod · 0.45

Tested by

no test coverage detected