From 346796f4f856c40d7980b69303640f7ba662c2df Mon Sep 17 00:00:00 2001 From: DJWarmonger Date: Wed, 22 Aug 2018 12:32:48 +0200 Subject: [PATCH] Possible fix for evaluate VisitHero (compiler optimization?) --- AI/VCAI/FuzzyHelper.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/AI/VCAI/FuzzyHelper.cpp b/AI/VCAI/FuzzyHelper.cpp index e657200d7..142e15862 100644 --- a/AI/VCAI/FuzzyHelper.cpp +++ b/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)