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

Method AssertValid

engine/Poseidon/AI/AIUnitImpl.cpp:2788–2824  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2786bool AIUnit::AssertValid() const
2787{
2788 bool ok = true;
2789 if (!GetPerson())
2790 {
2791 // all units must be represented by some soldier
2792 Fail("no person");
2793 ok = false;
2794 }
2795
2796 AISubgroup* subgrp = GetSubgroup();
2797 if (subgrp)
2798 {
2799 AIGroup* grp = subgrp->GetGroup();
2800 if (grp)
2801 {
2802 AICenter* center = grp->GetCenter();
2803 if (!center)
2804 {
2805 Fail("no center");
2806 ok = false;
2807 }
2808 }
2809 else
2810 {
2811 Fail("no group");
2812 ok = false;
2813 }
2814 }
2815 else
2816 {
2817 Fail("no subgroup");
2818 ok = false;
2819 }
2820
2821 return ok;
2822}
2823
2824void AIUnit::Dump(int indent) const {}

Callers 4

CheckVehicleStructureMethod · 0.45
ProcessJoinGroupsFunction · 0.45
JoinGroupsFunction · 0.45
AssertAIValidFunction · 0.45

Calls 2

GetGroupMethod · 0.45
GetCenterMethod · 0.45

Tested by

no test coverage detected