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:
parent
90dfe3e782
commit
73b4188fab
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user