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

Method SendOpenFire

engine/Poseidon/AI/AIGroupCmd.cpp:613–712  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

611}
612
613void AIGroup::SendOpenFire(OpenFireState open, PackedBoolArray list)
614{
615 AIUnit* leader = Leader();
616 for (int i = 0; i < MAX_UNITS_PER_GROUP; i++)
617 {
618 if (!list.Get(i))
619 {
620 continue;
621 }
622 AIUnit* unit = UnitWithID(i + 1);
623 if (!unit)
624 {
625 list.Set(i, false);
626 continue;
627 }
628
629 if (!leader || unit == leader)
630 {
631 AI::Semaphore s = unit->GetSemaphore();
632 s = ApplyOpenFire(s, open);
633 unit->SetSemaphore(s);
634 list.Set(i, false);
635 continue;
636 }
637
638 // check radio channel
639 int index = INT_MAX;
640 while (true)
641 {
642 RadioMessage* msg = GetRadio().FindPrevMessage(RMTOpenFire, index);
643 if (!msg)
644 {
645 break;
646 }
647 AI_ERROR(dynamic_cast<RadioMessageOpenFire*>(msg));
648 RadioMessageOpenFire* msgSem = static_cast<RadioMessageOpenFire*>(msg);
649 AI_ERROR(msgSem);
650 AI_ERROR(msgSem->GetFrom() == this);
651 if (msgSem->IsTo(unit))
652 {
653 if (msgSem->GetOpenFireState() == open)
654 {
655 list.Set(i, false);
656 goto SendOpenFireForContinue;
657 }
658 else
659 {
660 msgSem->DeleteTo(unit);
661 break;
662 }
663 }
664 else if (msgSem->GetOpenFireState() == open)
665 {
666 msgSem->AddTo(unit);
667 list.Set(i, false);
668 goto SendOpenFireForContinue;
669 }
670 }

Callers 1

ProcessMenuMethod · 0.80

Calls 15

ApplyOpenFireFunction · 0.85
GetCenterFunction · 0.85
GetOpenFireStateMethod · 0.80
DeleteToMethod · 0.80
AddToMethod · 0.80
GetActualMessageMethod · 0.80
GetMethod · 0.45
SetMethod · 0.45
GetSemaphoreMethod · 0.45
SetSemaphoreMethod · 0.45
GetFromMethod · 0.45
IsToMethod · 0.45

Tested by

no test coverage detected