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

Function ReserveExistingAddonPlacement

bwapi/BWAPILIB/Source/Game.cpp:292–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290 }
291
292 void ReserveExistingAddonPlacement(PlacementReserve &reserve, TilePosition desiredPosition)
293 {
294 TilePosition start = desiredPosition - TilePosition(MAX_RANGE,MAX_RANGE)/2;
295
296 //Exclude addon placement locations
297 reserve.backup();
298 Unitset myUnits = Broodwar->self()->getUnits();
299 myUnits.erase_if( !(Exists && CanBuildAddon) );
300 for ( auto &u : myUnits )
301 {
302 TilePosition addonPos = (u->getTilePosition() + TilePosition(4,1)) - start;
303 reserve.setRange(addonPos, addonPos+TilePosition(2,2), 0);
304 }
305
306 // Restore if this gave us no build locations
307 reserve.restoreIfInvalid(__FUNCTION__);
308 }
309
310 void ReserveStructure(PlacementReserve &reserve, Unit pUnit, int padding, UnitType type, TilePosition desiredPosition)
311 {

Callers 1

ReservePlacementFunction · 0.85

Calls 7

backupMethod · 0.80
erase_ifMethod · 0.80
getTilePositionMethod · 0.80
setRangeMethod · 0.80
restoreIfInvalidMethod · 0.80
getUnitsMethod · 0.45
selfMethod · 0.45

Tested by

no test coverage detected