Explorar o código

VCAI::performTypicalActions: always check that hero is still available

It's weird why this only appear now so if you have ideas check issue 2479.
Arseniy Shestakov %!s(int64=9) %!d(string=hai) anos
pai
achega
30042cac3d
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      AI/VCAI/VCAI.cpp

+ 3 - 0
AI/VCAI/VCAI.cpp

@@ -2517,6 +2517,9 @@ void VCAI::performTypicalActions()
 {
 {
 	for(auto h : getUnblockedHeroes())
 	for(auto h : getUnblockedHeroes())
 	{
 	{
+		if(!h) //hero might be lost. getUnblockedHeroes() called once on start of turn
+			continue;
+
 		logAi->debugStream() << boost::format("Looking into %s, MP=%d") % h->name.c_str() % h->movement;
 		logAi->debugStream() << boost::format("Looking into %s, MP=%d") % h->name.c_str() % h->movement;
 		makePossibleUpgrades(*h);
 		makePossibleUpgrades(*h);
 		pickBestArtifacts(*h);
 		pickBestArtifacts(*h);