1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2025-12-10 06:52:05 +01:00

Add: [Script] ScriptTile::IsHouseTile

This commit is contained in:
TheDude-gh
2025-11-20 12:54:33 +01:00
committed by rubidium42
parent 67ded4f980
commit 75aee10e1e
4 changed files with 17 additions and 0 deletions

View File

@@ -30,6 +30,7 @@
* \li AIVehicleList_Waypoint
* \li AIError::ERR_BRIDGE_TOO_LOW
* \li AIEngine::GetAllRailTypes
* \li AITile::IsHouseTile
*
* Other changes:
* \li AIBridge::GetBridgeID renamed to AIBridge::GetBridgeType

View File

@@ -31,6 +31,7 @@
* \li GSBaseStation::GetOwner
* \li GSError::ERR_BRIDGE_TOO_LOW
* \li GSEngine::GetAllRailTypes
* \li GSTile::IsHouseTile
*
* Other changes:
* \li GSBridge::GetBridgeID renamed to GSBridge::GetBridgeType

View File

@@ -154,6 +154,13 @@
return (::IsTileType(tile, MP_CLEAR) && ::IsClearGround(tile, CLEAR_DESERT));
}
/* static */ bool ScriptTile::IsHouseTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
return ::IsTileType(tile, MP_HOUSE);
}
/* static */ ScriptTile::TerrainType ScriptTile::GetTerrainType(TileIndex tile)
{
if (!::IsValidTile(tile)) return TERRAIN_NORMAL;

View File

@@ -275,6 +275,14 @@ public:
*/
static bool IsDesertTile(TileIndex tile);
/**
* Check if the tile is town house/building
* @param tile The tile to check on.
* @pre ScriptMap::IsValidTile(tile).
* @return True if and only if the tile is house tile.
*/
static bool IsHouseTile(TileIndex tile);
/**
* Get the type of terrain regardless of buildings or infrastructure.
* @note When a desert or rainforest tile are changed, their terrain type will remain the same. In other words, a sea tile can be of the desert terrain type.