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

Method getClosestUnit

bwapi/BWAPILIB/Source/Game.cpp:717–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

715 return this->getUnitsInRectangle(topLeft.x, topLeft.y, bottomRight.x, bottomRight.y, pred);
716 }
717 Unit Game::getClosestUnit(Position center, const UnitFilter &pred, int radius) const
718 {
719 return this->getClosestUnitInRectangle(center,
720 [&](Unit u){ return u->getDistance(center) <= radius && (!pred.isValid() || pred(u));},
721 center.x - radius,
722 center.y - radius,
723 center.x + radius,
724 center.y + radius);
725 }
726 //------------------------------------------ REGIONS -----------------------------------------------
727 BWAPI::Region Game::getRegionAt(BWAPI::Position position) const
728 {

Callers 9

getBuildLocationMethod · 0.95
TaskSpellcasterMethod · 0.45
UseTechOnClosestMethod · 0.45
executeMethod · 0.45
FindNewAttackTargetMethod · 0.45
DecloakCheckMethod · 0.45
DoUnitBehaviourMethod · 0.45
executeMethod · 0.45
onFrameMethod · 0.45

Calls 3

getDistanceMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected