From 656999e99fa7ffd7153bbe5f1295d9d55bec17a6 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 26 Aug 2012 12:26:07 +0000 Subject: [PATCH] - fixed bug in AI town development - fixed too slow generation of FowChange package --- AI/VCAI/VCAI.cpp | 10 ++++++++++ server/CGameHandler.cpp | 10 +++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) 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))