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

Function canTargetUnit

bwapi/Shared/Templates.h:471–490  ·  view source on GitHub ↗

------------------------------------------- CAN TARGET -------------------------------------------------

Source from the content-addressed store, hash-verified

469 }
470 //------------------------------------------- CAN TARGET -------------------------------------------------
471 static inline bool canTargetUnit(Unit targetUnit)
472 {
473 if ( !targetUnit || !targetUnit->exists() )
474 return Broodwar->setLastError(Errors::Unit_Does_Not_Exist);
475 if ( !targetUnit->isVisible() && !Broodwar->isFlagEnabled(Flag::CompleteMapInformation) )
476 return false;
477 if ( !targetUnit->isCompleted() &&
478 !targetUnit->getType().isBuilding() &&
479 !targetUnit->isMorphing() &&
480 targetUnit->getType() != UnitTypes::Protoss_Archon &&
481 targetUnit->getType() != UnitTypes::Protoss_Dark_Archon )
482 return Broodwar->setLastError(Errors::Incompatible_State);
483 if ( targetUnit->getType() == UnitTypes::Spell_Scanner_Sweep ||
484 targetUnit->getType() == UnitTypes::Spell_Dark_Swarm ||
485 targetUnit->getType() == UnitTypes::Spell_Disruption_Web ||
486 targetUnit->getType() == UnitTypes::Special_Map_Revealer )
487 return Broodwar->setLastError(Errors::Incompatible_UnitType);
488
489 return true;
490 }
491 static inline bool canTargetUnit(Unit thisUnit, Unit targetUnit, bool checkCommandibility = true)
492 {
493 if ( !checkCommandibility )

Callers 13

canAttackUnitFunction · 0.85
canAttackUnitGroupedFunction · 0.85
canSetRallyUnitFunction · 0.85
canFollowFunction · 0.85
canGatherFunction · 0.85
canRepairFunction · 0.85
canLoadFunction · 0.85
canUnloadFunction · 0.85
canRightClickUnitFunction · 0.85
canRightClickUnitGroupedFunction · 0.85
canUseTechUnitFunction · 0.85
isTargetableMethod · 0.85

Calls 9

canCommandFunction · 0.85
setLastErrorMethod · 0.80
isCompletedMethod · 0.80
isBuildingMethod · 0.80
isMorphingMethod · 0.80
existsMethod · 0.45
isVisibleMethod · 0.45
isFlagEnabledMethod · 0.45
getTypeMethod · 0.45

Tested by

no test coverage detected