1
0
Fork 0

(svn r4269) We don't use GNU indentation style

release/0.5
tron 2006-04-04 06:01:45 +00:00
parent 4e743232de
commit 2ecfed2fad
1 changed files with 32 additions and 30 deletions

View File

@ -281,47 +281,49 @@ static int32 ClearTile_Water(TileIndex tile, byte flags)
if (flags & DC_EXEC) DoClearSquare(tile); if (flags & DC_EXEC) DoClearSquare(tile);
return _price.clear_water; return _price.clear_water;
case WATER_COAST:
{
uint slope = GetTileSlope(tile, NULL);
// Make sure no vehicle is on the tile case WATER_COAST: {
if (!EnsureNoVehicle(tile)) return CMD_ERROR; uint slope = GetTileSlope(tile, NULL);
// Make sure it's not an edge tile. // Make sure no vehicle is on the tile
if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) || if (!EnsureNoVehicle(tile)) return CMD_ERROR;
!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); // Make sure it's not an edge tile.
if (slope == 8 || slope == 4 || slope == 2 || slope == 1) { if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) ||
return _price.clear_water; !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) {
} else { return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
return _price.purchase_land;
}
} }
case WATER_LOCK:
{
static const TileIndexDiffC _shiplift_tomiddle_offs[] = {
{ 0, 0}, {0, 0}, { 0, 0}, {0, 0}, // middle
{-1, 0}, {0, 1}, { 1, 0}, {0, -1}, // lower
{ 1, 0}, {0, -1}, {-1, 0}, {0, 1}, // upper
};
if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); if (flags & DC_EXEC) DoClearSquare(tile);
if (_current_player == OWNER_WATER) return CMD_ERROR; if (slope == 8 || slope == 4 || slope == 2 || slope == 1) {
// move to the middle tile.. return _price.clear_water;
return RemoveShiplift(tile + ToTileIndexDiff(_shiplift_tomiddle_offs[GetSection(tile)]), flags); } else {
return _price.purchase_land;
} }
}
case WATER_LOCK: {
static const TileIndexDiffC _shiplift_tomiddle_offs[] = {
{ 0, 0}, {0, 0}, { 0, 0}, {0, 0}, // middle
{-1, 0}, {0, 1}, { 1, 0}, {0, -1}, // lower
{ 1, 0}, {0, -1}, {-1, 0}, {0, 1}, // upper
};
if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
if (_current_player == OWNER_WATER) return CMD_ERROR;
// move to the middle tile..
return RemoveShiplift(tile + ToTileIndexDiff(_shiplift_tomiddle_offs[GetSection(tile)]), flags);
}
case WATER_DEPOT: case WATER_DEPOT:
if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED); if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
return RemoveShipDepot(tile, flags); return RemoveShipDepot(tile, flags);
default: NOT_REACHED();
}
return 0; // useless but silences warning default:
NOT_REACHED();
return 0;
}
} }
// return true if a tile is a water tile. // return true if a tile is a water tile.