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

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

This commit is contained in:
Michał W. Urbańczyk 2012-09-28 19:50:09 +00:00
parent 7e6128b653
commit a669831fc6

View File

@ -1026,7 +1026,8 @@ void VCAI::makeTurnInternal()
try try
{ {
//Pick objects reserved in previous turn - we expect only nerby objects there //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()); cb->setSelection(hero.first.get());
boost::sort (hero.second, isCloser); boost::sort (hero.second, isCloser);