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

Method getUnitsInRadius

bwapi/BWAPILIB/Source/Unit.cpp:18–29  ·  view source on GitHub ↗

------------------------------------------------ GET UNITS IN RADIUS -------------------------------------

Source from the content-addressed store, hash-verified

16{
17 //------------------------------------------------ GET UNITS IN RADIUS -------------------------------------
18 Unitset UnitInterface::getUnitsInRadius(int radius, const UnitFilter &pred) const
19 {
20 // Return if this unit does not exist
21 if ( !this->exists() )
22 return Unitset::none;
23
24 return Broodwar->getUnitsInRectangle(this->getLeft() - radius,
25 this->getTop() - radius,
26 this->getRight() + radius,
27 this->getBottom() + radius,
28 [&](Unit u){ return this != u && this->getDistance(u) <= radius && (!pred.isValid() || pred(u)); });
29 }
30
31 Unit UnitInterface::getClosestUnit(const UnitFilter &pred, int radius) const
32 {

Callers

nothing calls this directly

Calls 8

getLeftMethod · 0.95
getTopMethod · 0.95
getRightMethod · 0.95
getBottomMethod · 0.95
getDistanceMethod · 0.95
existsMethod · 0.45
getUnitsInRectangleMethod · 0.45
isValidMethod · 0.45

Tested by

no test coverage detected