Changeset - r20771:d3a6392edeb3
[Not reviewed]
master
0 1 0
frosch - 11 years ago 2013-10-06 11:16:00
frosch@openttd.org
(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)
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_tile.cpp
Show inline comments
 
@@ -40,16 +40,17 @@
 
			return false;
 
	}
 
}
 

	
 
/* 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++) {
 
			if (!IsBuildable(ScriptMap::GetTileIndex(x, y))) return false;
 
		}
 
	}
0 comments (0 inline, 0 general)