mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +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:
		| @@ -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; | ||||
|   | ||||
| @@ -277,6 +277,7 @@ struct DLL_LINKAGE TerrainTile | ||||
| 	CGObjectInstance * topVisitableObj(bool excludeTop = false) const; | ||||
| 	bool isWater() const; | ||||
| 	bool isCoastal() const; | ||||
| 	EDiggingStatus getDiggingStatus(const bool excludeTop = true) const; | ||||
| 	bool hasFavourableWinds() const; | ||||
|  | ||||
| 	ETerrainType terType; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user