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

Fixed a case when AI could spend all money on army and not build anything in secondary towns.

This commit is contained in:
DJWarmonger 2017-11-04 22:14:56 +01:00
parent 654fea56a4
commit edc4c01805

View File

@ -2204,7 +2204,6 @@ void VCAI::tryRealize(Goals::Build & g)
{
logAi->debug("Looking into %s", t->name);
buildStructure(t);
buildArmyIn(t);
if(!ai->primaryHero() ||
(t->getArmyStrength() > ai->primaryHero()->getArmyStrength() * 2 && !isAccessibleForHero(t->visitablePos(), ai->primaryHero())))
@ -2548,6 +2547,11 @@ void VCAI::striveToQuest (const QuestInfo &q)
void VCAI::performTypicalActions()
{
//TODO: build army only on request
for(auto t : cb->getTownsInfo())
{
buildArmyIn(t);
}
for(auto h : getUnblockedHeroes())
{
if(!h) //hero might be lost. getUnblockedHeroes() called once on start of turn