diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index dbb10f1df7..6f1642254a 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -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 diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index 4dbb379896..ac6d56d3ad 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -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 diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp index e837472f7d..9979285610 100644 --- a/src/script/api/script_tile.cpp +++ b/src/script/api/script_tile.cpp @@ -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; diff --git a/src/script/api/script_tile.hpp b/src/script/api/script_tile.hpp index aec9329b45..6a3154a632 100644 --- a/src/script/api/script_tile.hpp +++ b/src/script/api/script_tile.hpp @@ -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.