| 825 | bool 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 | |
| 883 | void AIUnit::SendAnswer(Answer answer) |
| 884 | { |
no test coverage detected