1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

NKAI: disallow using allied shipyard

This commit is contained in:
Andrii Danylchenko
2023-03-27 08:50:19 +03:00
committed by Andrii Danylchenko
parent 519513e512
commit 34abc9f82d

View File

@@ -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);