Browse Source

Possible fix for evaluate VisitHero (compiler optimization?)

DJWarmonger 7 years ago
parent
commit
346796f4f8
1 changed files with 5 additions and 2 deletions
  1. 5 2
      AI/VCAI/FuzzyHelper.cpp

+ 5 - 2
AI/VCAI/FuzzyHelper.cpp

@@ -75,8 +75,11 @@ float FuzzyHelper::evaluate(Goals::VisitHero & g)
 	auto obj = ai->myCb->getObj(ObjectInstanceID(g.objid)); //we assume for now that these goals are similar
 	if(!obj)
 		return -100; //hero died in the meantime
-	//TODO: consider direct copy (constructor?)
-	g.setpriority(Goals::VisitTile(obj->visitablePos()).sethero(g.hero).setisAbstract(g.isAbstract).accept(this));
+	else
+	{
+		auto dummyGoal = Goals::VisitTile(obj->visitablePos()).sethero(g.hero).setisAbstract(g.isAbstract);
+		g.setpriority(dummyGoal.accept(this));
+	}
 	return g.priority;
 }
 float FuzzyHelper::evaluate(Goals::GatherArmy & g)