Skip to content

Commit

Permalink
Revert "Fix issue alkurbatov#43 "Don't build between minerals and com…
Browse files Browse the repository at this point in the history
…mand center""

This reverts commit ea06c40.
  • Loading branch information
ImpulseCloud committed Feb 27, 2021
1 parent 250f56d commit b8d59c8
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/blueprints/Building.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,13 @@
bool Building::Build(Order* order_) {
// Find place to build the structure
sc2::Point3D base = gAPI->observer().StartingLocation();
sc2::Point2D point, offset;
auto range = 15.0f; //greater than 15.0f may build too far away
auto buffer = 6.0f; //less than 6.0f may build in mineral line
sc2::Point2D point;

unsigned attempt = 0;
do {
offset.x = sc2::GetRandomScalar() * range; //build in range of StartLoc
offset.y = sc2::GetRandomScalar() * range;

if (abs(offset.x) < buffer && abs(offset.y) < buffer)
continue; //but don't build within exclusion buffer

point = base + offset;

if (attempt == 100)
range = 30.0f; //if full, double range
point.x = base.x + sc2::GetRandomScalar() * 15.0f;
point.y = base.y + sc2::GetRandomScalar() * 15.0f;

if (++attempt > 150)
return false;
} while (!gAPI->query().CanBePlaced(*order_, point));
Expand Down

0 comments on commit b8d59c8

Please sign in to comment.