Mercurial > hg > openttd
changeset 18271:f63c96a8cfb5 draft
(svn r23107) -Codechange: let GetSlopePixelZ and TerraformTile tile type functions use int z as well
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 04 Nov 2011 11:36:10 +0000 |
parents | 432112453b2e |
children | 3ebab55c5495 |
files | src/clear_cmd.cpp src/industry_cmd.cpp src/object_cmd.cpp src/rail_cmd.cpp src/road_cmd.cpp src/station_cmd.cpp src/tile_cmd.h src/town_cmd.cpp src/tree_cmd.cpp src/tunnelbridge_cmd.cpp src/void_cmd.cpp src/water_cmd.cpp |
diffstat | 12 files changed, 26 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -107,7 +107,7 @@ DrawBridgeMiddle(ti); } -static uint GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -361,7 +361,7 @@ return; } -static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); }
--- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -364,7 +364,7 @@ } } -static uint GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y) { return GetTileMaxPixelZ(tile); } @@ -2715,7 +2715,7 @@ !(HasBit(this->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CHANGE)); // production change callbacks } -static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { if (AutoslopeEnabled()) { /* We imitate here TTDP's behaviour:
--- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -381,7 +381,7 @@ if (spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) DrawBridgeMiddle(ti); } -static uint GetSlopePixelZ_Object(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y) { if (IsOwnedLand(tile)) { int z; @@ -716,7 +716,7 @@ } } -static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { ObjectType type = GetObjectType(tile);
--- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -2335,7 +2335,7 @@ DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette); } -static uint GetSlopePixelZ_Track(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y) { if (IsPlainRail(tile)) { int z; @@ -2826,7 +2826,7 @@ return cost; } -static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { int z_old; Slope tileh_old = GetTileSlope(tile, &z_old);
--- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1337,7 +1337,7 @@ } } -static uint GetSlopePixelZ_Road(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y) { if (IsNormalRoad(tile)) { @@ -1677,7 +1677,7 @@ } } -static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) { switch (GetRoadTileType(tile)) {
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2756,7 +2756,7 @@ DrawRailTileSeqInGUI(x, y, t, st == STATION_WAYPOINT ? 0 : total_offset, 0, pal); } -static uint GetSlopePixelZ_Station(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Station(TileIndex tile, uint x, uint y) { return GetTileMaxPixelZ(tile); } @@ -3589,7 +3589,7 @@ return CMD_ERROR; } -static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) { /* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
--- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -70,7 +70,7 @@ * @param ti Information about the tile to draw */ typedef void DrawTileProc(TileInfo *ti); -typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); +typedef int GetSlopeZProc(TileIndex tile, uint x, uint y); typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags); /** @@ -133,7 +133,7 @@ * @param tileh_new Slope after terraforming. * @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.) */ -typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new); +typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new); /** * Set of callback functions for performing tile operations of a given tile type.
--- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -255,7 +255,7 @@ } } -static uint GetSlopePixelZ_Town(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Town(TileIndex tile, uint x, uint y) { return GetTileMaxPixelZ(tile); } @@ -3046,7 +3046,7 @@ } } -static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { if (AutoslopeEnabled()) { HouseID house = GetHouseType(tile);
--- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -516,7 +516,7 @@ } -static uint GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -776,7 +776,7 @@ _trees_tick_ctr = 0; } -static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR); }
--- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1359,7 +1359,7 @@ } -static uint GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -1673,7 +1673,7 @@ return VETSB_CONTINUE; } -static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile) && GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) { DiagDirection direction = GetTunnelBridgeDirection(tile); @@ -1685,10 +1685,10 @@ /* Check if new slope is valid for bridges in general (so we can safely call GetBridgeFoundation()) */ if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) { CheckBridgeSlopeSouth(axis, &tileh_old, &z_old); - res = CheckBridgeSlopeSouth(axis, &tileh_new, (int*)&z_new); + res = CheckBridgeSlopeSouth(axis, &tileh_new, &z_new); } else { CheckBridgeSlopeNorth(axis, &tileh_old, &z_old); - res = CheckBridgeSlopeNorth(axis, &tileh_new, (int*)&z_new); + res = CheckBridgeSlopeNorth(axis, &tileh_new, &z_new); } /* Surface slope is valid and remains unchanged? */
--- a/src/void_cmd.cpp +++ b/src/void_cmd.cpp @@ -23,7 +23,7 @@ } -static uint GetSlopePixelZ_Void(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y) { return TilePixelHeight(tile); } @@ -60,7 +60,7 @@ return 0; } -static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP); }
--- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -794,7 +794,7 @@ } -static uint GetSlopePixelZ_Water(TileIndex tile, uint x, uint y) +static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y) { int z; Slope tileh = GetTilePixelSlope(tile, &z); @@ -1202,7 +1202,7 @@ return VETSB_CONTINUE; } -static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) +static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new) { /* Canals can't be terraformed */ if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);