|
|
@@ -133,8 +133,8 @@ void CPrivilagedInfoCallback::getAllTiles (std::unordered_set<int3, ShashInt3> &
|
|
|
{
|
|
|
for (int yd = 0; yd < gs->map->height; yd++)
|
|
|
{
|
|
|
- if ((getTile (int3 (xd,yd,zd))->terType == 8 && water)
|
|
|
- || (getTile (int3 (xd,yd,zd))->terType != 8 && land))
|
|
|
+ if ((getTile (int3 (xd,yd,zd))->terType == ETerrainType::WATER && water)
|
|
|
+ || (getTile (int3 (xd,yd,zd))->terType != ETerrainType::WATER && land))
|
|
|
tiles.insert(int3(xd,yd,zd));
|
|
|
}
|
|
|
}
|
|
|
@@ -157,7 +157,7 @@ void CPrivilagedInfoCallback::getFreeTiles (std::vector<int3> &tiles) const
|
|
|
for (int yd = 0; yd < gs->map->height; yd++)
|
|
|
{
|
|
|
tinfo = getTile(int3 (xd,yd,zd));
|
|
|
- if (tinfo->terType != 8 && !tinfo->blocked) //land and free
|
|
|
+ if (tinfo->terType != ETerrainType::WATER && !tinfo->blocked) //land and free
|
|
|
tiles.push_back (int3 (xd,yd,zd));
|
|
|
}
|
|
|
}
|
|
|
@@ -567,13 +567,13 @@ EBuildingState::EBuildingState CGameInfoCallback::canBuildStructure( const CGTow
|
|
|
{
|
|
|
ERROR_RET_VAL_IF(!canGetFullInfo(t), "Town is not owned!", EBuildingState::TOWN_NOT_OWNED);
|
|
|
|
|
|
- if(!t->town->buildings.count(ID))
|
|
|
- return EBuildingState::BUILDING_ERROR;
|
|
|
-
|
|
|
- const CBuilding * pom = t->town->buildings.at(ID);
|
|
|
-
|
|
|
-
|
|
|
- if(t->hasBuilt(ID)) //already built
|
|
|
+ if(!t->town->buildings.count(ID))
|
|
|
+ return EBuildingState::BUILDING_ERROR;
|
|
|
+
|
|
|
+ const CBuilding * pom = t->town->buildings.at(ID);
|
|
|
+
|
|
|
+
|
|
|
+ if(t->hasBuilt(ID)) //already built
|
|
|
return EBuildingState::ALREADY_PRESENT;
|
|
|
|
|
|
//can we build it?
|
|
|
@@ -634,24 +634,24 @@ std::set<BuildingID> CGameInfoCallback::getBuildingRequiments( const CGTownInsta
|
|
|
{
|
|
|
ERROR_RET_VAL_IF(!canGetFullInfo(t), "Town is not owned!", std::set<BuildingID>());
|
|
|
ERROR_RET_VAL_IF(!t->town->buildings.count(ID), "No such building!", std::set<BuildingID>());
|
|
|
-
|
|
|
- std::set<int> used;
|
|
|
- used.insert(ID);
|
|
|
- auto reqs = t->town->buildings.at(ID)->requirements;
|
|
|
-
|
|
|
- bool found;
|
|
|
- do
|
|
|
+
|
|
|
+ std::set<int> used;
|
|
|
+ used.insert(ID);
|
|
|
+ auto reqs = t->town->buildings.at(ID)->requirements;
|
|
|
+
|
|
|
+ bool found;
|
|
|
+ do
|
|
|
{
|
|
|
found = false;
|
|
|
for(auto i=reqs.begin();i!=reqs.end();i++)
|
|
|
{
|
|
|
- if(used.find(*i)==used.end()) //we haven't added requirements for this building
|
|
|
- {
|
|
|
- found = true;
|
|
|
- auto & requires = t->town->buildings.at(*i)->requirements;
|
|
|
-
|
|
|
- used.insert(*i);
|
|
|
- for(auto & require : requires)
|
|
|
+ if(used.find(*i)==used.end()) //we haven't added requirements for this building
|
|
|
+ {
|
|
|
+ found = true;
|
|
|
+ auto & requires = t->town->buildings.at(*i)->requirements;
|
|
|
+
|
|
|
+ used.insert(*i);
|
|
|
+ for(auto & require : requires)
|
|
|
reqs.insert(require);//creating full list of requirements
|
|
|
}
|
|
|
}
|