Skip to content
Snippets Groups Projects
Commit 8601a456 authored by GabrielTofvesson's avatar GabrielTofvesson
Browse files

Changed types. get_build_location_near accepts a non-negative integer: 0...

Changed types. get_build_location_near accepts a non-negative integer: 0 indicates an exhaustive search
parent 2b6867cd
No related branches found
No related tags found
No related merge requests found
...@@ -95,7 +95,7 @@ bool BuildingPlacer::canBuildHereWithSpace(int bx, int by, const UnitType & type ...@@ -95,7 +95,7 @@ bool BuildingPlacer::canBuildHereWithSpace(int bx, int by, const UnitType & type
return true; return true;
} }
CCTilePosition BuildingPlacer::getBuildLocationNear(const CCTilePosition & p, const UnitType & t, int buildDist, int search_count) const CCTilePosition BuildingPlacer::getBuildLocationNear(const CCTilePosition & p, const UnitType & t, int buildDist, size_t search_count) const
{ {
//Timer t; //Timer t;
//t.start(); //t.start();
...@@ -106,7 +106,7 @@ CCTilePosition BuildingPlacer::getBuildLocationNear(const CCTilePosition & p, co ...@@ -106,7 +106,7 @@ CCTilePosition BuildingPlacer::getBuildLocationNear(const CCTilePosition & p, co
//double ms1 = t.getElapsedTimeInMilliSec(); //double ms1 = t.getElapsedTimeInMilliSec();
// iterate through the list until we've found a suitable location // iterate through the list until we've found a suitable location
for (size_t i(0); i < closestToBuilding.size() && (i < 0 or i < search_count); ++i) for (size_t i(0); i < closestToBuilding.size() && (search_count == 0 or i < search_count); ++i)
{ {
auto & pos = closestToBuilding[i]; auto & pos = closestToBuilding[i];
......
...@@ -29,7 +29,7 @@ public: ...@@ -29,7 +29,7 @@ public:
bool canBuildHereWithSpace(int bx, int by, const UnitType & type, int buildDist) const; bool canBuildHereWithSpace(int bx, int by, const UnitType & type, int buildDist) const;
// returns a build location near a building's desired location // returns a build location near a building's desired location
CCTilePosition getBuildLocationNear(const CCTilePosition & p, const UnitType & type, int buildDist, int search_count = 1000) const; CCTilePosition getBuildLocationNear(const CCTilePosition & p, const UnitType & type, int buildDist, size_t search_count = 1000) const;
void drawReservedTiles(); void drawReservedTiles();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment