1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Client: slience visibility error on shipyard in non-coastal town

This commit is contained in:
ArseniyShestakov 2015-12-08 07:33:13 +03:00
parent cf4cb5c948
commit 07807fb044
3 changed files with 7 additions and 4 deletions

View File

@ -1784,7 +1784,7 @@ const CGObjectInstance * VCAI::lookForArt(int aid) const
{ {
for(const CGObjectInstance *obj : ai->visitableObjs) for(const CGObjectInstance *obj : ai->visitableObjs)
{ {
if(obj->ID == 5 && obj->subID == aid) if(obj->ID == Obj::ARTIFACT && obj->subID == aid)
return obj; return obj;
} }

View File

@ -230,7 +230,7 @@ std::string CBuildingRect::getSubtitle()//hover text for building
} }
else else
{ {
logGlobal->warnStream() << "Problem: dwelling with id " << bid << " offers no creatures!"; logGlobal->warnStream() << "Problem: dwelling with id " << bid << " offers no creatures!";
return "#ERROR#"; return "#ERROR#";
} }
} }
@ -501,7 +501,10 @@ void CCastleBuildings::recreate()
if(vstd::contains(town->builtBuildings, BuildingID::SHIPYARD)) if(vstd::contains(town->builtBuildings, BuildingID::SHIPYARD))
{ {
std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(town->bestLocation()); auto bayPos = town->bestLocation();
if(!bayPos.valid())
logGlobal->warnStream() << "Shipyard in non-coastal town!";
std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(bayPos, false);
//there is visitable obj at shipyard output tile and it's a boat or hero (on boat) //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)) if(!vobjs.empty() && (vobjs.front()->ID == Obj::BOAT || vobjs.front()->ID == Obj::HERO))
{ {

View File

@ -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 (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; return o->pos + offset;
} }
} }