clear_cmd.c
changeset 1878 622765748231
parent 1796 cae31916ae54
child 1891 92a3b0aa0946
--- a/clear_cmd.c	Mon May 30 14:45:36 2005 +0000
+++ b/clear_cmd.c	Mon May 30 15:50:20 2005 +0000
@@ -238,6 +238,9 @@
 
 	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 @@
 
 	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;