water_cmd.c
branch0.5
changeset 5530 15f701e93291
parent 5512 52869fa67090
child 5536 11b3dd55f6f4
--- a/water_cmd.c	Fri Aug 10 17:49:29 2007 +0000
+++ b/water_cmd.c	Fri Aug 10 17:53:12 2007 +0000
@@ -157,7 +157,7 @@
 {
 	TileIndexDiff delta = TileOffsByDiagDir(GetLockDirection(tile));
 
-	if (!CheckTileOwnership(tile)) return CMD_ERROR;
+	if (!CheckTileOwnership(tile) && GetTileOwner(tile) != OWNER_NONE) return CMD_ERROR;
 
 	// make sure no vehicle is on the tile.
 	if (!EnsureNoVehicle(tile) || !EnsureNoVehicle(tile + delta) || !EnsureNoVehicle(tile - delta))
@@ -303,7 +303,7 @@
 				return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
 			}
 
-			if (GetTileOwner(tile) != OWNER_WATER && !CheckTileOwnership(tile)) return CMD_ERROR;
+			if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR;
 
 			if (flags & DC_EXEC) DoClearSquare(tile);
 			return _price.clear_water;
@@ -810,8 +810,10 @@
 
 	if (new_player != PLAYER_SPECTATOR) {
 		SetTileOwner(tile, new_player);
+	} else if (IsShipDepot(tile)) {
+		DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 	} else {
-		DoCommand(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
+		SetTileOwner(tile, OWNER_NONE);
 	}
 }