MCPcopy Create free account
hub / github.com/bwapi/bwapi / canIssueCommand

Function canIssueCommand

bwapi/Shared/Templates.h:2798–2945  ·  view source on GitHub ↗

------------------------------------------- CAN ISSUE COMMAND ------------------------------------------

Source from the content-addressed store, hash-verified

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

Callers 3

canIssueCommandMethod · 0.85
issueCommandMethod · 0.85
issueCommandMethod · 0.85

Calls 15

canCommandFunction · 0.85
canIssueCommandTypeFunction · 0.85
canAttackUnitFunction · 0.85
canBuildFunction · 0.85
canBuildAddonFunction · 0.85
canTrainFunction · 0.85
canMorphFunction · 0.85
canSetRallyUnitFunction · 0.85
canFollowFunction · 0.85
canGatherFunction · 0.85
canRepairFunction · 0.85
canLandFunction · 0.85

Tested by

no test coverage detected