Browse Source

Fixed access to unitialized memory causing StupidAI to act stupid

Ivan Savenko 10 years ago
parent
commit
73b4188fab
1 changed files with 6 additions and 0 deletions
  1. 6 0
      AI/StupidAI/StupidAI.cpp

+ 6 - 0
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);