diff options
author | SamuXarick <43006711+SamuXarick@users.noreply.github.com> | 2021-09-14 21:06:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 22:06:55 +0200 |
commit | 37de87812994be72399a9588473ece1c514397c0 (patch) | |
tree | b450411376890b3ac8310dcca2f5b9bad3ca830f /src/script/api/script_tile.cpp | |
parent | c6035158ca9df31d12ba28acf2037ff7d5aeb248 (diff) | |
download | openttd-37de87812994be72399a9588473ece1c514397c0.tar.xz |
Feature: [AI/GS] Missing water related functions and objects (#8390)
Diffstat (limited to 'src/script/api/script_tile.cpp')
-rw-r--r-- | src/script/api/script_tile.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp index 360b32c02..90411a7f7 100644 --- a/src/script/api/script_tile.cpp +++ b/src/script/api/script_tile.cpp @@ -58,6 +58,20 @@ return true; } +/* static */ bool ScriptTile::IsSeaTile(TileIndex tile) +{ + if (!::IsValidTile(tile)) return false; + + return ::IsTileType(tile, MP_WATER) && ::IsSea(tile); +} + +/* static */ bool ScriptTile::IsRiverTile(TileIndex tile) +{ + if (!::IsValidTile(tile)) return false; + + return ::IsTileType(tile, MP_WATER) && ::IsRiver(tile); +} + /* static */ bool ScriptTile::IsWaterTile(TileIndex tile) { if (!::IsValidTile(tile)) return false; @@ -320,6 +334,7 @@ case BT_CLEAR_ROCKY: return ::GetPrice(PR_CLEAR_ROCKS, 1, nullptr); case BT_CLEAR_FIELDS: return ::GetPrice(PR_CLEAR_FIELDS, 1, nullptr); case BT_CLEAR_HOUSE: return ::GetPrice(PR_CLEAR_HOUSE, 1, nullptr); + case BT_CLEAR_WATER: return ::GetPrice(PR_CLEAR_WATER, 1, nullptr); default: return -1; } } |