summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-10-06 11:16:00 +0000
committerfrosch <frosch@openttd.org>2013-10-06 11:16:00 +0000
commitf26aad2e84f628e741fd267042913731b5637648 (patch)
tree17d882d7c9087b9ded4beaffc1368c6005c17b3e /src
parent3e8d498bc513872bfcd202aa8ffc96b911c8fbf7 (diff)
downloadopenttd-f26aad2e84f628e741fd267042913731b5637648.tar.xz
(svn r25815) -Fix [FS#5754]: ScriptTile::IsBuildableRectangle could report true for tiles outside of the map, if they happened to wrap around into a valid area. (Bolt)
Diffstat (limited to 'src')
-rw-r--r--src/script/api/script_tile.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp
index b14bea649..c84e8411a 100644
--- a/src/script/api/script_tile.cpp
+++ b/src/script/api/script_tile.cpp
@@ -43,10 +43,11 @@
/* static */ bool ScriptTile::IsBuildableRectangle(TileIndex tile, uint width, uint height)
{
- uint tx, ty;
+ /* Check whether we can extract valid X and Y */
+ if (!::IsValidTile(tile)) return false;
- tx = ScriptMap::GetTileX(tile);
- ty = ScriptMap::GetTileY(tile);
+ uint tx = ScriptMap::GetTileX(tile);
+ uint ty = ScriptMap::GetTileY(tile);
for (uint x = tx; x < width + tx; x++) {
for (uint y = ty; y < height + ty; y++) {