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

Fixed access to unitialized memory causing StupidAI to act stupid

This commit is contained in:
Ivan Savenko 2015-12-03 21:28:01 +02:00
parent 90dfe3e782
commit 73b4188fab

View File

@ -153,6 +153,12 @@ BattleAction CStupidAI::activeStack( const CStack * stack )
}
}
for ( auto & enemy : enemiesReachable )
enemy.calcDmg( stack );
for ( auto & enemy : enemiesShootable )
enemy.calcDmg( stack );
if(enemiesShootable.size())
{
const EnemyInfo &ei= *std::max_element(enemiesShootable.begin(), enemiesShootable.end(), isMoreProfitable);