Changeset - r7509:c5114490e828
[Not reviewed]
master
0 3 0
rubidium - 17 years ago 2007-08-31 20:03:50
rubidium@openttd.org
(svn r11024) -Fix [FS#1173]: give a more correct error when building some things on tile 0; "Can't build on water" or "Too close to the edge" instead of "Vehicle in the way". Patch by SmatZ.
3 files changed with 8 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/clear_cmd.cpp
Show inline comments
 
@@ -403,8 +403,6 @@ CommandCost CmdPurchaseLandArea(TileInde
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 

	
 
	if (!EnsureNoVehicle(tile)) return CMD_ERROR;
 

	
 
	if (IsOwnedLandTile(tile) && IsTileOwner(tile, _current_player)) {
 
		return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT);
 
	}
src/tree_cmd.cpp
Show inline comments
 
@@ -255,6 +255,11 @@ CommandCost CmdPlantTree(TileIndex tile,
 
					cost.AddCost(_price.build_trees * 2);
 
					break;
 

	
 
				case MP_WATER:
 
					msg = STR_3807_CAN_T_BUILD_ON_WATER;
 
					continue;
 
					break;
 

	
 
				case MP_CLEAR:
 
					if (!IsTileOwner(tile, OWNER_NONE) ||
 
							IsBridgeAbove(tile)) {
src/water_cmd.cpp
Show inline comments
 
@@ -67,12 +67,9 @@ CommandCost CmdBuildShipDepot(TileIndex 
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 

	
 
	if (!EnsureNoVehicle(tile)) return CMD_ERROR;
 

	
 
	Axis axis = Extract<Axis, 0>(p1);
 

	
 
	tile2 = tile + (axis == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1));
 
	if (!EnsureNoVehicle(tile2)) return CMD_ERROR;
 

	
 
	if (!IsClearWaterTile(tile) || !IsClearWaterTile(tile2))
 
		return_cmd_error(STR_3801_MUST_BE_BUILT_ON_WATER);
 
@@ -289,15 +286,15 @@ static CommandCost ClearTile_Water(TileI
 
		case WATER_TILE_CLEAR:
 
			if (flags & DC_NO_WATER) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER);
 

	
 
			/* Make sure no vehicle is on the tile */
 
			if (!EnsureNoVehicle(tile)) return CMD_ERROR;
 

	
 
			/* Make sure it's not an edge tile. */
 
			if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) ||
 
					!IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) {
 
				return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
 
			}
 

	
 
			/* Make sure no vehicle is on the tile */
 
			if (!EnsureNoVehicle(tile)) return CMD_ERROR;
 

	
 
			if (GetTileOwner(tile) != OWNER_WATER && GetTileOwner(tile) != OWNER_NONE && !CheckTileOwnership(tile)) return CMD_ERROR;
 

	
 
			if (flags & DC_EXEC) DoClearSquare(tile);
 
@@ -309,12 +306,6 @@ static CommandCost ClearTile_Water(TileI
 
			/* Make sure no vehicle is on the tile */
 
			if (!EnsureNoVehicle(tile)) return CMD_ERROR;
 

	
 
			/* Make sure it's not an edge tile. */
 
			if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) ||
 
					!IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) {
 
				return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
 
			}
 

	
 
			if (flags & DC_EXEC) DoClearSquare(tile);
 
			if (slope == SLOPE_N || slope == SLOPE_E || slope == SLOPE_S || slope == SLOPE_W) {
 
				return CommandCost(_price.clear_water);
0 comments (0 inline, 0 general)