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

Method PerformAI

engine/Poseidon/World/WorldImpl.cpp:411–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

409#endif
410
411void World::PerformAI(float deltaT, float noAccDeltaT)
412{
413 auto& input = InputSubsystem::Instance();
414#if _ENABLE_CHEATS
415 if (input.GetCheat2ToDo(SDL_SCANCODE_T))
416 {
417 disableAI = !disableAI;
418 GlobalShowMessage(500, "Group AI %s", disableAI ? "Off" : "On");
419 }
420 if (input.GetCheat2ToDo(SDL_SCANCODE_U))
421 {
422 disableUnitAI = !disableUnitAI;
423 GlobalShowMessage(500, "Unit AI %s", disableUnitAI ? "Off" : "On");
424 }
425 if (input.GetCheat2ToDo(SDL_SCANCODE_I))
426 {
427 disableSimpleSim = !disableSimpleSim;
428 GlobalShowMessage(500, "Simple sim %s", disableSimpleSim ? "Off" : "On");
429 }
430#endif
431 if (deltaT > 0
432#if _ENABLE_CHEATS
433 && !disableAI
434#endif
435 )
436 {
437 GetRadio().Simulate(deltaT);
438 if (_eastCenter)
439 {
440 _eastCenter->GetRadio().Simulate(deltaT);
441 _eastCenter->Think();
442 int i;
443 for (i = 0; i < _eastCenter->NGroups(); i++)
444 {
445 AIGroup* grp = _eastCenter->GetGroup(i);
446 if (grp)
447 {
448 grp->GetRadio().Simulate(deltaT);
449 }
450 }
451 }
452 if (_westCenter)
453 {
454 _westCenter->GetRadio().Simulate(deltaT);
455 _westCenter->Think();
456 int i;
457 for (i = 0; i < _westCenter->NGroups(); i++)
458 {
459 AIGroup* grp = _westCenter->GetGroup(i);
460 if (grp)
461 {
462 grp->GetRadio().Simulate(deltaT);
463 }
464 }
465 }
466 if (_guerrilaCenter)
467 {
468 _guerrilaCenter->GetRadio().Simulate(deltaT);

Callers

nothing calls this directly

Calls 13

GlobalShowMessageFunction · 0.85
GetCheat2ToDoMethod · 0.80
NGroupsMethod · 0.80
BrainMethod · 0.80
GetLifeStateMethod · 0.80
SimulateMethod · 0.45
ThinkMethod · 0.45
GetGroupMethod · 0.45
CheatActivatedMethod · 0.45
CheatServedMethod · 0.45
SizeMethod · 0.45
GetActionMethod · 0.45

Tested by

no test coverage detected