From 07807fb044c5d84674ce800db6344f91b8513df0 Mon Sep 17 00:00:00 2001 From: ArseniyShestakov Date: Tue, 8 Dec 2015 07:33:13 +0300 Subject: [PATCH] Client: slience visibility error on shipyard in non-coastal town --- AI/VCAI/VCAI.cpp | 2 +- client/windows/CCastleInterface.cpp | 7 +++++-- lib/mapObjects/CObjectHandler.cpp | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 54e45fbf7..72aa7c2a5 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -1784,7 +1784,7 @@ const CGObjectInstance * VCAI::lookForArt(int aid) const { for(const CGObjectInstance *obj : ai->visitableObjs) { - if(obj->ID == 5 && obj->subID == aid) + if(obj->ID == Obj::ARTIFACT && obj->subID == aid) return obj; } diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index 9f3ad2438..5f54b8214 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -230,7 +230,7 @@ std::string CBuildingRect::getSubtitle()//hover text for building } else { - logGlobal->warnStream() << "Problem: dwelling with id " << bid << " offers no creatures!"; + logGlobal->warnStream() << "Problem: dwelling with id " << bid << " offers no creatures!"; return "#ERROR#"; } } @@ -501,7 +501,10 @@ void CCastleBuildings::recreate() if(vstd::contains(town->builtBuildings, BuildingID::SHIPYARD)) { - std::vector vobjs = LOCPLINT->cb->getVisitableObjs(town->bestLocation()); + auto bayPos = town->bestLocation(); + if(!bayPos.valid()) + logGlobal->warnStream() << "Shipyard in non-coastal town!"; + std::vector vobjs = LOCPLINT->cb->getVisitableObjs(bayPos, false); //there is visitable obj at shipyard output tile and it's a boat or hero (on boat) if(!vobjs.empty() && (vobjs.front()->ID == Obj::BOAT || vobjs.front()->ID == Obj::HERO)) { diff --git a/lib/mapObjects/CObjectHandler.cpp b/lib/mapObjects/CObjectHandler.cpp index 88c7e6bd0..8c785b374 100644 --- a/lib/mapObjects/CObjectHandler.cpp +++ b/lib/mapObjects/CObjectHandler.cpp @@ -330,7 +330,7 @@ int3 IBoatGenerator::bestLocation() const { if (const TerrainTile *tile = IObjectInterface::cb->getTile(o->pos + offset, false)) //tile is in the map { - if (tile->terType == ETerrainType::WATER && (!tile->blocked || tile->blockingObjects.front()->ID == 8)) //and is water and is not blocked or is blocked by boat + if (tile->terType == ETerrainType::WATER && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat return o->pos + offset; } }