1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- fixed bug in AI town development

- fixed too slow generation of FowChange package
This commit is contained in:
Ivan Savenko 2012-08-26 12:26:07 +00:00
parent d69f4b7632
commit 656999e99f
2 changed files with 19 additions and 1 deletions

View File

@ -1164,6 +1164,16 @@ bool VCAI::tryBuildStructure(const CGTownInstance * t, int building, unsigned in
return true;
std::set<int> toBuild = cb->getBuildingRequiments(t, building);
//erase all already built buildings
for (auto buildIter = toBuild.begin(); buildIter != toBuild.end();)
{
if (vstd::contains(t->builtBuildings, *buildIter))
toBuild.erase(buildIter++);
else
buildIter++;
}
toBuild.insert(building);
BOOST_FOREACH(int buildID, toBuild)

View File

@ -1326,7 +1326,15 @@ void CGameHandler::newTurn()
FoWChange fw;
fw.mode = 1;
fw.player = player;
getAllTiles(fw.tiles, player, -1, 0);
// find all hidden tiles
auto & fow = gs->getPlayerTeam(player)->fogOfWarMap;
for (size_t i=0; i<fow.size(); i++)
for (size_t j=0; j<fow[i].size(); j++)
for (size_t k=0; k<fow[i][j].size(); k++)
if (!fow[i][j][k])
fw.tiles.insert(int3(i,j,k));
sendAndApply (&fw);
}
if (t->hasBonusOfType (Bonus::DARKNESS))