diff options
author | tron <tron@openttd.org> | 2006-01-30 17:18:45 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-01-30 17:18:45 +0000 |
commit | 5e1e90260016fc5ad7a62a824922f9766158bbf8 (patch) | |
tree | a71bfa3b7016eec2f35802faea7d5bb51c9b0130 /clear_cmd.c | |
parent | c8dd64bdbc162753f55b06ad395c84d15bff6998 (diff) | |
download | openttd-5e1e90260016fc5ad7a62a824922f9766158bbf8.tar.xz |
(svn r3490) -Fix: A bunch (10) of off-by-one errors when checking if a TileIndex points to a tile on the map
Diffstat (limited to 'clear_cmd.c')
-rw-r--r-- | clear_cmd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clear_cmd.c b/clear_cmd.c index 0f7e36577..52dd174f7 100644 --- a/clear_cmd.c +++ b/clear_cmd.c @@ -233,7 +233,7 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2) tile = TileVirtXY(x, y); /* Make an extra check for map-bounds cause we add tiles to the originating tile */ - if (tile + TileDiffXY(1, 1) > MapSize()) return CMD_ERROR; + if (tile + TileDiffXY(1, 1) >= MapSize()) return CMD_ERROR; if (p1 & 1) { if (!TerraformTileHeight(&ts, tile + TileDiffXY(1, 0), @@ -332,7 +332,7 @@ int32 CmdLevelLand(int ex, int ey, uint32 flags, uint32 p1, uint32 p2) TileIndex tile; int32 ret, cost, money; - if (p1 > MapSize()) return CMD_ERROR; + if (p1 >= MapSize()) return CMD_ERROR; SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |