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

Method SendBehaviour

engine/Poseidon/AI/AIGroupCmd.cpp:416–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416void AIGroup::SendBehaviour(CombatMode mode, PackedBoolArray list)
417{
418 AIUnit* leader = Leader();
419 for (int i = 0; i < MAX_UNITS_PER_GROUP; i++)
420 {
421 if (!list.Get(i))
422 {
423 continue;
424 }
425 AIUnit* unit = UnitWithID(i + 1);
426 if (!unit)
427 {
428 list.Set(i, false);
429 continue;
430 }
431
432 if (!leader || unit == leader)
433 {
434 unit->SetCombatModeMajor(mode);
435 list.Set(i, false);
436 continue;
437 }
438
439 // check radio channel
440 int index = INT_MAX;
441 while (true)
442 {
443 RadioMessage* msg = GetRadio().FindPrevMessage(RMTBehaviour, index);
444 if (!msg)
445 {
446 break;
447 }
448 AI_ERROR(dynamic_cast<RadioMessageBehaviour*>(msg));
449 RadioMessageBehaviour* msgSem = static_cast<RadioMessageBehaviour*>(msg);
450 AI_ERROR(msgSem);
451 AI_ERROR(msgSem->GetFrom() == this);
452 if (msgSem->IsTo(unit))
453 {
454 if (msgSem->GetBehaviour() == mode)
455 {
456 list.Set(i, false);
457 goto SendBehaviourForContinue;
458 }
459 else
460 {
461 msgSem->DeleteTo(unit);
462 break;
463 }
464 }
465 else if (msgSem->GetBehaviour() == mode)
466 {
467 msgSem->AddTo(unit);
468 list.Set(i, false);
469 goto SendBehaviourForContinue;
470 }
471 }
472
473 {

Callers 2

SetFormModeFunction · 0.80
ProcessMenuMethod · 0.80

Calls 14

GetCenterFunction · 0.85
GetBehaviourMethod · 0.80
DeleteToMethod · 0.80
AddToMethod · 0.80
GetActualMessageMethod · 0.80
GetCombatModeMajorMethod · 0.80
GetMethod · 0.45
SetMethod · 0.45
SetCombatModeMajorMethod · 0.45
GetFromMethod · 0.45
IsToMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected