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

Function AssignBuildableLocations

bwapi/BWAPILIB/Source/Game.cpp:213–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211 };
212
213 void AssignBuildableLocations(PlacementReserve &reserve, UnitType type, TilePosition desiredPosition)
214 {
215 TilePosition start = desiredPosition - TilePosition(MAX_RANGE,MAX_RANGE)/2;
216
217 // Reserve space for the addon as well
218 bool hasAddon = type.canBuildAddon();
219
220 // Assign 1 to all buildable locations
221 reserve.iterate( [&](PlacementReserve *pr, int x, int y)
222 {
223 if ( (!hasAddon || Broodwar->canBuildHere(start+TilePosition(x+4,y+1), UnitTypes::Terran_Missile_Turret) ) &&
224 Broodwar->canBuildHere(start+TilePosition(x,y), type) )
225 {
226 pr->setValue(x, y, 1);
227 }
228 });
229 }
230
231 void RemoveDisconnected(PlacementReserve &reserve, TilePosition desiredPosition)
232 {

Callers 1

ReservePlacementFunction · 0.85

Calls 4

iterateMethod · 0.80
canBuildHereMethod · 0.80
setValueMethod · 0.80
canBuildAddonMethod · 0.45

Tested by

no test coverage detected