Explorar el Código

AI: fix freeze when AI has a win condition to control own town

Andrii Danylchenko hace 7 años
padre
commit
9a0b5a0afc
Se han modificado 1 ficheros con 11 adiciones y 1 borrados
  1. 11 1
      AI/VCAI/Goals.cpp

+ 11 - 1
AI/VCAI/Goals.cpp

@@ -422,7 +422,17 @@ TSubgoal Win::whatToDoToAchieve()
 		{
 			if(goal.object)
 			{
-				return sptr(Goals::VisitObj(goal.object->id.getNum()));
+				auto objRelations = cb->getPlayerRelations(ai->playerID, goal.object->tempOwner);
+				
+				if(objRelations == PlayerRelations::ENEMIES)
+				{
+					return sptr(Goals::VisitObj(goal.object->id.getNum()));
+				}
+				else
+				{
+					// TODO: Defance
+					break;
+				}
 			}
 			else
 			{