Browse Source

AiI will ignore winning conditions that require defeating his own objects. Fixes #2174

DjWarmonger 10 years ago
parent
commit
f3c7774576
1 changed files with 6 additions and 0 deletions
  1. 6 0
      AI/VCAI/Goals.cpp

+ 6 - 0
AI/VCAI/Goals.cpp

@@ -221,6 +221,12 @@ TSubgoal Win::whatToDoToAchieve()
 			{
 			{
 				if (goal.object)
 				if (goal.object)
 				{
 				{
+					auto obj = cb->getObj (goal.object->id);
+					if (obj)
+						if (obj->getOwner() == ai->playerID) //we can't capture our own object
+							return sptr(Goals::Conquer());
+
+
 					return sptr (Goals::GetObj(goal.object->id.getNum()));
 					return sptr (Goals::GetObj(goal.object->id.getNum()));
 				}
 				}
 				else
 				else