diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 86124ea8e..54b4408c9 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -1164,6 +1164,16 @@ bool VCAI::tryBuildStructure(const CGTownInstance * t, int building, unsigned in return true; std::set 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) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index eb97d2c62..9ea78699a 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -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; ihasBonusOfType (Bonus::DARKNESS))