mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
- fixed bug in AI town development
- fixed too slow generation of FowChange package
This commit is contained in:
parent
d69f4b7632
commit
656999e99f
@ -1164,6 +1164,16 @@ bool VCAI::tryBuildStructure(const CGTownInstance * t, int building, unsigned in
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
std::set<int> toBuild = cb->getBuildingRequiments(t, building);
|
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);
|
toBuild.insert(building);
|
||||||
|
|
||||||
BOOST_FOREACH(int buildID, toBuild)
|
BOOST_FOREACH(int buildID, toBuild)
|
||||||
|
@ -1326,7 +1326,15 @@ void CGameHandler::newTurn()
|
|||||||
FoWChange fw;
|
FoWChange fw;
|
||||||
fw.mode = 1;
|
fw.mode = 1;
|
||||||
fw.player = player;
|
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);
|
sendAndApply (&fw);
|
||||||
}
|
}
|
||||||
if (t->hasBonusOfType (Bonus::DARKNESS))
|
if (t->hasBonusOfType (Bonus::DARKNESS))
|
||||||
|
Loading…
Reference in New Issue
Block a user