Przeglądaj źródła

Nullkiller: fixes for partly visible objs

Andrii Danylchenko 4 lat temu
rodzic
commit
1d561b9882

+ 4 - 1
AI/Nullkiller/Behaviors/CaptureObjectsBehavior.cpp

@@ -157,7 +157,10 @@ bool CaptureObjectsBehavior::shouldVisitObject(ObjectIdRef obj) const
 	//it may be hero visiting this obj
 	//we don't try visiting object on which allied or owned hero stands
 	// -> it will just trigger exchange windows and AI will be confused that obj behind doesn't get visited
-	const CGObjectInstance * topObj = cb->getTopObj(obj->visitablePos());
+	const CGObjectInstance * topObj = cb->getTopObj(pos);
+
+	if(!topObj)
+		return false; // partly visible obj but its visitable pos is not visible.
 
 	if(topObj->ID == Obj::HERO && cb->getPlayerRelations(ai->playerID, topObj->tempOwner) != PlayerRelations::ENEMIES)
 		return false;

+ 2 - 0
AI/Nullkiller/Engine/Nullkiller.cpp

@@ -61,6 +61,8 @@ void Nullkiller::resetAiState()
 
 void Nullkiller::updateAiState()
 {
+	ai->validateVisitableObjs();
+
 	// TODO: move to hero manager
 	auto activeHeroes = ai->getMyHeroes();