Browse Source

NKAI: disallow using allied shipyard

Andrii Danylchenko 2 years ago
parent
commit
34abc9f82d
1 changed files with 4 additions and 2 deletions
  1. 4 2
      AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.cpp

+ 4 - 2
AI/Nullkiller/Pathfinding/Rules/AILayerTransitionRule.cpp

@@ -53,13 +53,15 @@ namespace AIPathfinding
 
 		for(const CGTownInstance * t : cb->getTownsInfo())
 		{
-			if(t->hasBuilt(BuildingID::SHIPYARD))
+			// do not allow ally shipyards because of bug
+			if(t->hasBuilt(BuildingID::SHIPYARD) && t->getOwner() == ai->playerID)
 				shipyards.push_back(t);
 		}
 
 		for(const CGObjectInstance * obj : ai->memory->visitableObjs)
 		{
-			if(obj->ID != Obj::TOWN) //towns were handled in the previous loop
+			// do not allow ally shipyards because of bug
+			if(obj->ID != Obj::TOWN && obj->getOwner() == ai->playerID) //towns were handled in the previous loop
 			{
 				if(const IShipyard * shipyard = IShipyard::castFrom(obj))
 					shipyards.push_back(shipyard);