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

Function ReserveGroundHeight

bwapi/BWAPILIB/Source/Game.cpp:275–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

273 }*/
274
275 void ReserveGroundHeight(PlacementReserve &reserve, TilePosition desiredPosition)
276 {
277 TilePosition start = desiredPosition - TilePosition(MAX_RANGE,MAX_RANGE)/2;
278
279 // Exclude locations with a different ground height, but restore a backup in case there are no more build locations
280 reserve.backup();
281 int targetHeight = Broodwar->getGroundHeight(desiredPosition);
282 reserve.iterate( [&](PlacementReserve *pr, int x, int y)
283 {
284 if ( Broodwar->getGroundHeight( start + TilePosition(x,y) ) != targetHeight )
285 pr->setValue(x, y, 0);
286 });
287
288 // Restore original if there is nothing left
289 reserve.restoreIfInvalid(__FUNCTION__);
290 }
291
292 void ReserveExistingAddonPlacement(PlacementReserve &reserve, TilePosition desiredPosition)
293 {

Callers 1

ReservePlacementFunction · 0.85

Calls 5

backupMethod · 0.80
iterateMethod · 0.80
setValueMethod · 0.80
restoreIfInvalidMethod · 0.80
getGroundHeightMethod · 0.45

Tested by

no test coverage detected