mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-24 00:36:29 +02:00
Fix boat positioning
This commit is contained in:
@@ -92,12 +92,13 @@ int3 IBoatGenerator::bestLocation() const
|
||||
|
||||
for (auto & offset : offsets)
|
||||
{
|
||||
const TerrainTile *tile = getObject()->cb->getTile(getObject()->visitablePos() + offset, false);
|
||||
int3 targetTile = getObject()->visitablePos() + offset;
|
||||
const TerrainTile *tile = getObject()->cb->getTile(targetTile, false);
|
||||
|
||||
if(tile) //tile is in the map
|
||||
{
|
||||
if(tile->terType->isWater() && (!tile->blocked || tile->blockingObjects.front()->ID == Obj::BOAT)) //and is water and is not blocked or is blocked by boat
|
||||
return getObject()->getPosition() + offset;
|
||||
return targetTile;
|
||||
}
|
||||
}
|
||||
return int3 (-1,-1,-1);
|
||||
|
||||
Reference in New Issue
Block a user