소스 검색

* VCAI: fixed crash when a locked hero died when attempting realizing a goal

Michał W. Urbańczyk 13 년 전
부모
커밋
a669831fc6
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      AI/VCAI/VCAI.cpp

+ 2 - 1
AI/VCAI/VCAI.cpp

@@ -1026,7 +1026,8 @@ void VCAI::makeTurnInternal()
 	try
 	{
 		//Pick objects reserved in previous turn - we expect only nerby objects there
-		BOOST_FOREACH (auto hero, reservedHeroesMap)
+		auto reservedHeroesCopy = reservedHeroesMap; //work on copy => the map may be changed while iterating (eg because hero died when attempting a goal)
+		BOOST_FOREACH (auto hero, reservedHeroesCopy)
 		{
 			cb->setSelection(hero.first.get());
 			boost::sort (hero.second, isCloser);