浏览代码

NKAI: disallow using allied shipyard

Andrii Danylchenko 2 年之前
父节点
当前提交
34abc9f82d
共有 1 个文件被更改,包括 4 次插入2 次删除
  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);