1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Digging: implement digging status on right click. Fix issue 401

This is also fix possibility to dig on some non-blockable objects like event.
This commit is contained in:
ArseniyShestakov
2015-11-29 12:32:06 +03:00
parent f940e3ed42
commit f55bfe41d6
9 changed files with 55 additions and 29 deletions

View File

@ -146,6 +146,18 @@ bool TerrainTile::isCoastal() const
return extTileFlags & 64;
}
EDiggingStatus TerrainTile::getDiggingStatus(const bool excludeTop) const
{
if(terType == ETerrainType::WATER || terType == ETerrainType::ROCK)
return EDiggingStatus::WRONG_TERRAIN;
int allowedBlocked = excludeTop ? 1 : 0;
if(blockingObjects.size() > allowedBlocked || topVisitableObj(excludeTop))
return EDiggingStatus::TILE_OCCUPIED;
else
return EDiggingStatus::CAN_DIG;
}
bool TerrainTile::hasFavourableWinds() const
{
return extTileFlags & 128;