2
0
Эх сурвалжийг харах

Merge pull request #542 from nullkiller/ai-stability-fixes

AI: stability fixes
Alexander Shishkin 6 жил өмнө
parent
commit
08b841d668

+ 6 - 0
AI/VCAI/AIUtility.cpp

@@ -370,6 +370,12 @@ bool isObjectRemovable(const CGObjectInstance * obj)
 	case Obj::TREASURE_CHEST:
 	case Obj::ARTIFACT:
 	case Obj::BORDERGUARD:
+	case Obj::FLOTSAM:
+	case Obj::PANDORAS_BOX:
+	case Obj::OCEAN_BOTTLE:
+	case Obj::SEA_CHEST:
+	case Obj::SHIPWRECK_SURVIVOR:
+	case Obj::SPELL_SCROLL:
 		return true;
 		break;
 	default:

+ 3 - 4
AI/VCAI/Pathfinding/AIPathfinderConfig.cpp

@@ -300,10 +300,9 @@ namespace AIPathfinding
 			if(blocker == BlockingReason::DESTINATION_BLOCKVIS && destination.nodeObject)
 			{
 				auto objID = destination.nodeObject->ID;
-				if((objID == Obj::HERO && destination.objectRelations != PlayerRelations::ENEMIES)
-					|| objID == Obj::SUBTERRANEAN_GATE || objID == Obj::MONOLITH_TWO_WAY
-					|| objID == Obj::MONOLITH_ONE_WAY_ENTRANCE || objID == Obj::MONOLITH_ONE_WAY_EXIT
-					|| objID == Obj::WHIRLPOOL)
+				auto enemyHero = objID == Obj::HERO && destination.objectRelations == PlayerRelations::ENEMIES;
+
+				if(!enemyHero && !isObjectRemovable(destination.nodeObject))
 				{
 					destination.blocked = true;
 				}

+ 5 - 0
AI/VCAI/VCAI.cpp

@@ -834,6 +834,8 @@ void VCAI::mainLoop()
 	std::vector<Goals::TSubgoal> elementarGoals; //no duplicates allowed (operator ==)
 	basicGoals.clear();
 
+	validateVisitableObjs();
+
 	//get all potential and saved goals
 	//TODO: not lose
 	basicGoals.push_back(sptr(Goals::Win()));
@@ -1748,6 +1750,9 @@ std::vector<const CGObjectInstance *> VCAI::getFlaggedObjects() const
 
 void VCAI::addVisitableObj(const CGObjectInstance * obj)
 {
+	if(obj->ID == Obj::EVENT)
+		return;
+
 	visitableObjs.insert(obj);
 
 	// All teleport objects seen automatically assigned to appropriate channels