summaryrefslogtreecommitdiff
path: root/clear_cmd.c
diff options
context:
space:
mode:
authorDarkvater <darkvater@openttd.org>2005-05-30 15:50:20 +0000
committerDarkvater <darkvater@openttd.org>2005-05-30 15:50:20 +0000
commit0cd53574ec659e283a0029f6cd037ffd66999e60 (patch)
tree2f98d00f629f6505e2bc649b087f6dafbdfd584b /clear_cmd.c
parent00cf2eae388135fcd9e7fd21cfa0f7b561fa1ddb (diff)
downloadopenttd-0cd53574ec659e283a0029f6cd037ffd66999e60.tar.xz
(svn r2384) - Fix: Check selling land and setting player colour. Also an extra map-bounds check for terraforming; inspired by the monkey (and Tron :) )
Diffstat (limited to 'clear_cmd.c')
-rw-r--r--clear_cmd.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/clear_cmd.c b/clear_cmd.c
index 9dc30bd8e..0ee8ee70a 100644
--- a/clear_cmd.c
+++ b/clear_cmd.c
@@ -238,6 +238,9 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
tile = TILE_FROM_XY(x,y);
+ /* Make an extra check for map-bounds cause we add tiles to the originating tile */
+ if (tile + TILE_XY(1,1) > MapSize()) return CMD_ERROR;
+
if (p1 & 1) {
if (!TerraformTileHeight(&ts, tile+TILE_XY(1,0),
TileHeight(tile + TILE_XY(1, 0)) + direction))
@@ -449,8 +452,9 @@ int32 CmdSellLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
tile = TILE_FROM_XY(x,y);
- if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER)
- return CMD_ERROR;
+ if (!IsTileType(tile, MP_UNMOVABLE) || _map5[tile] != 3) return CMD_ERROR;
+ if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR;
+
if (!EnsureNoVehicle(tile)) return CMD_ERROR;