------------------------------------------- CAN ISSUE COMMAND ------------------------------------------
| 2796 | } |
| 2797 | //------------------------------------------- CAN ISSUE COMMAND ------------------------------------------ |
| 2798 | static inline bool canIssueCommand(Unit thisUnit, UnitCommand c, bool checkCanUseTechPositionOnPositions = true, bool checkCanUseTechUnitOnUnits = true, bool checkCanBuildUnitType = true, bool checkCanTargetUnit = true, bool checkCanIssueCommandType = true, bool checkCommandibility = true) |
| 2799 | { |
| 2800 | if ( !checkCommandibility ) |
| 2801 | Broodwar->setLastError(); |
| 2802 | else if ( !canCommand(thisUnit) ) |
| 2803 | return false; |
| 2804 | |
| 2805 | BWAPI::UnitCommandType ct = c.type; |
| 2806 | if ( checkCanIssueCommandType && !canIssueCommandType(thisUnit, ct, false) ) |
| 2807 | return false; |
| 2808 | |
| 2809 | switch (ct) |
| 2810 | { |
| 2811 | case UnitCommandTypes::Enum::Attack_Move: |
| 2812 | return true; |
| 2813 | |
| 2814 | case UnitCommandTypes::Enum::Attack_Unit: |
| 2815 | return canAttackUnit(thisUnit, c.target, checkCanTargetUnit, false, false); |
| 2816 | |
| 2817 | case UnitCommandTypes::Enum::Build: |
| 2818 | return canBuild(thisUnit, c.getUnitType(), BWAPI::TilePosition(c.x, c.y), checkCanBuildUnitType, false, false); |
| 2819 | |
| 2820 | case UnitCommandTypes::Enum::Build_Addon: |
| 2821 | return canBuildAddon(thisUnit, c.getUnitType(), false, false); |
| 2822 | |
| 2823 | case UnitCommandTypes::Enum::Train: |
| 2824 | return canTrain(thisUnit, c.getUnitType(), false, false); |
| 2825 | |
| 2826 | case UnitCommandTypes::Enum::Morph: |
| 2827 | return canMorph(thisUnit, c.getUnitType(), false, false); |
| 2828 | |
| 2829 | case UnitCommandTypes::Enum::Research: |
| 2830 | return Broodwar->canResearch(c.getTechType(), thisUnit, false); |
| 2831 | |
| 2832 | case UnitCommandTypes::Enum::Upgrade: |
| 2833 | return Broodwar->canUpgrade(c.getUpgradeType(), thisUnit, false); |
| 2834 | |
| 2835 | case UnitCommandTypes::Enum::Set_Rally_Position: |
| 2836 | return true; |
| 2837 | |
| 2838 | case UnitCommandTypes::Enum::Set_Rally_Unit: |
| 2839 | return canSetRallyUnit(thisUnit, c.target, checkCanTargetUnit, false, false); |
| 2840 | |
| 2841 | case UnitCommandTypes::Enum::Move: |
| 2842 | return true; |
| 2843 | |
| 2844 | case UnitCommandTypes::Enum::Patrol: |
| 2845 | return true; |
| 2846 | |
| 2847 | case UnitCommandTypes::Enum::Hold_Position: |
| 2848 | return true; |
| 2849 | |
| 2850 | case UnitCommandTypes::Enum::Stop: |
| 2851 | return true; |
| 2852 | |
| 2853 | case UnitCommandTypes::Enum::Follow: |
| 2854 | return canFollow(thisUnit, c.target, checkCanTargetUnit, false, false); |
| 2855 |
no test coverage detected