| 29 | } |
| 30 | |
| 31 | Unit UnitInterface::getClosestUnit(const UnitFilter &pred, int radius) const |
| 32 | { |
| 33 | // Return if this unit does not exist |
| 34 | if ( !this->exists() ) |
| 35 | return nullptr; |
| 36 | |
| 37 | return Broodwar->getClosestUnitInRectangle(this->getPosition(), |
| 38 | [&](Unit u){ return this != u && this->getDistance(u) <= radius && (!pred.isValid() || pred(u)); }, |
| 39 | this->getLeft() - radius, |
| 40 | this->getTop() - radius, |
| 41 | this->getRight() + radius, |
| 42 | this->getBottom() + radius); |
| 43 | } |
| 44 | //--------------------------------------------- GET UNITS IN WEAPON RANGE ---------------------------------- |
| 45 | Unitset UnitInterface::getUnitsInWeaponRange(WeaponType weapon, const UnitFilter &pred) const |
| 46 | { |
nothing calls this directly
no test coverage detected