Explorar o código

Fixed new issue with hero trying to visit himself.

DjWarmonger %!s(int64=12) %!d(string=hai) anos
pai
achega
74a1d09871
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 1 1
      AI/VCAI/Goals.cpp
  2. 2 0
      AI/VCAI/VCAI.cpp

+ 1 - 1
AI/VCAI/Goals.cpp

@@ -752,7 +752,7 @@ TSubgoal GatherArmy::whatToDoToAchieve()
 					return sptr (Goals::VisitHero(h->id.getNum()).setisAbstract(true).sethero(hero));
 						//go to the other hero if we are faster
 				else
-					return sptr (Goals::VisitHero(h->id.getNum()).setisAbstract(true).sethero(h));
+					return sptr (Goals::VisitHero(hero->id.getNum()).setisAbstract(true).sethero(h));
 						//let the other hero come to us
 			}
 		}

+ 2 - 0
AI/VCAI/VCAI.cpp

@@ -1220,8 +1220,10 @@ void VCAI::setGoal(HeroPtr h, Goals::TSubgoal goal)
 	if (goal->invalid())
 		erase_if_present(lockedHeroes, h);
 	else
+	{
 		lockedHeroes[h] = goal;
 		goal->setisElementar(false); //always evaluate goals before realizing
+	}
 }
 
 void VCAI::completeGoal (Goals::TSubgoal goal)