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

Method getUnitsInRectangle

bwapi/BWAPI/Source/BWAPI/GameImpl.cpp:276–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274 return this->unitArray[index-1];
275 }
276 Unitset GameImpl::getUnitsInRectangle(int left, int top, int right, int bottom, const UnitFilter &pred) const
277 {
278 Unitset unitFinderResults;
279
280 // Have the unit finder do its stuff
281 Templates::iterateUnitFinder<BW::unitFinder>(BW::BWDATA::UnitOrderingX.data(),
282 BW::BWDATA::UnitOrderingY.data(),
283 BW::BWDATA::UnitOrderingCount,
284 left,
285 top,
286 right,
287 bottom,
288 [&](Unit u){ if ( !pred.isValid() || pred(u) )
289 unitFinderResults.insert(u); });
290 // Return results
291 return unitFinderResults;
292 }
293 Unit GameImpl::getClosestUnitInRectangle(Position center, const UnitFilter &pred, int left, int top, int right, int bottom) const
294 {
295 // cppcheck-suppress variableScope

Callers 1

updateUnitsMethod · 0.95

Calls 1

isValidMethod · 0.45

Tested by

no test coverage detected