| 2786 | bool 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 | |
| 2824 | void AIUnit::Dump(int indent) const {} |
no test coverage detected