| 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 |