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

Method ProcessGetOut

engine/Poseidon/AI/AIUnitImpl.cpp:827–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

825bool AIUnit::ProcessGetOut(bool parachute)
826{
827 if (!IsLocal())
828 {
829 return false;
830 }
831 if (IsFreeSoldier())
832 {
833 return false;
834 }
835 if (GetLifeState() != AIUnit::LSAlive)
836 {
837 return false;
838 }
839
840 Transport* veh = GetVehicleIn();
841 if (!veh)
842 {
843 return false;
844 }
845
846 if (veh->IsLocal())
847 {
848 DoGetOut(veh, parachute);
849 }
850 else
851 {
852 GetNetworkManager().AskForGetOut(GetPerson(), veh, parachute);
853
854 // actions on unit's side
855 if (veh->DriverBrain() == this) // driver
856 {
857 if (GetGroup())
858 {
859 GetGroup()->CalculateMaximalStrength();
860 }
861 }
862 if (_state == InCargo)
863 {
864 _state = Wait;
865 ClearOperativePlan();
866 }
867 }
868
869 // rearm if possible
870 if (GetSubgroup())
871 {
872 if (IsGroupLeader() && !IsSubgroupLeader())
873 {
874 GetSubgroup()->SelectLeader(this);
875 }
876
877 GetSubgroup()->RefreshPlan();
878 }
879
880 return true;
881}
882
883void AIUnit::SendAnswer(Answer answer)
884{

Callers 8

KilledByMethod · 0.80
SimulateMethod · 0.80
PerformActionMethod · 0.80
EjectMethod · 0.80
EjectMethod · 0.80
EjectMethod · 0.80
SendAnswerMethod · 0.80
CheckGetInGetOutMethod · 0.80

Calls 7

GetGroupFunction · 0.85
DriverBrainMethod · 0.80
RefreshPlanMethod · 0.80
IsLocalMethod · 0.45
AskForGetOutMethod · 0.45
SelectLeaderMethod · 0.45

Tested by

no test coverage detected