From 73b4188fab89ef24d8e4fd8d6f4395199392a399 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 3 Dec 2015 21:28:01 +0200 Subject: [PATCH] Fixed access to unitialized memory causing StupidAI to act stupid --- AI/StupidAI/StupidAI.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AI/StupidAI/StupidAI.cpp b/AI/StupidAI/StupidAI.cpp index 7fbda2d42..b87b14a8d 100644 --- a/AI/StupidAI/StupidAI.cpp +++ b/AI/StupidAI/StupidAI.cpp @@ -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);