From ae2c69c46cfbad63bbc17af8083ff4f81d98362c Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 6 Oct 2013 11:16:00 +0000 Subject: [PATCH] (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) --- src/script/api/script_tile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/script/api/script_tile.cpp b/src/script/api/script_tile.cpp index b14bea649e..c84e8411a6 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++) {