diff options
author | rubidium <rubidium@openttd.org> | 2011-11-04 10:23:48 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-11-04 10:23:48 +0000 |
commit | ecbc56a67711bfc37d751f9c3bff2a464ea03564 (patch) | |
tree | 59bf90cf6155c7940d6c56735a2cfd491e300bd3 | |
parent | 2ed0f93bfbd27ba4b4dc3e590556ffae6d9b9338 (diff) | |
download | openttd-ecbc56a67711bfc37d751f9c3bff2a464ea03564.tar.xz |
(svn r23094) -Codechange: add a default NULL to GetFoundationSlope and use it
-rw-r--r-- | src/landscape.h | 5 | ||||
-rw-r--r-- | src/road.cpp | 2 | ||||
-rw-r--r-- | src/road_cmd.cpp | 2 | ||||
-rw-r--r-- | src/town_cmd.cpp | 2 | ||||
-rw-r--r-- | src/water_cmd.cpp | 2 |
5 files changed, 7 insertions, 6 deletions
diff --git a/src/landscape.h b/src/landscape.h index f3071868f..a62bde13f 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -36,7 +36,7 @@ byte LowestSnowLine(); void ClearSnowLine(); int GetSlopeZInCorner(Slope tileh, Corner corner); -Slope GetFoundationSlope(TileIndex tile, uint *z); +Slope GetFoundationSlope(TileIndex tile, uint *z = NULL); uint GetPartialPixelZ(int x, int y, Slope corners); uint GetSlopePixelZ(int x, int y); @@ -66,8 +66,9 @@ static inline int GetSlopePixelZInCorner(Slope tileh, Corner corner) */ static inline Slope GetFoundationPixelSlope(TileIndex tile, uint *z) { + assert(z != NULL); Slope s = GetFoundationSlope(tile, z); - if (z != NULL) *z *= TILE_HEIGHT; + *z *= TILE_HEIGHT; return s; } diff --git a/src/road.cpp b/src/road.cpp index 73c87deb5..3b175d109 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -32,7 +32,7 @@ static bool IsPossibleCrossing(const TileIndex tile, Axis ax) return (IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_NORMAL && GetTrackBits(tile) == (ax == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X) && - GetFoundationPixelSlope(tile, NULL) == SLOPE_FLAT); + GetFoundationSlope(tile) == SLOPE_FLAT); } /** diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index d1cb5fae1..14f6f43fc 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1410,7 +1410,7 @@ static void TileLoop_Road(TileIndex tile) if (t->road_build_months != 0 && (DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) && IsNormalRoad(tile) && !HasAtMostOneBit(GetAllRoadBits(tile))) { - if (GetFoundationPixelSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { + if (GetFoundationSlope(tile) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { StartRoadWorks(tile); SndPlayTileFx(SND_21_JACKHAMMER, tile); diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 4c7a6d348..bfaee7498 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -787,7 +787,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir) } } - Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationPixelSlope(tile, NULL) : GetTileSlope(tile); + Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile) : GetTileSlope(tile); bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2); if (cur_slope == SLOPE_FLAT) return ret; diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 5cf793c1c..42c27239c 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -1090,7 +1090,7 @@ void TileLoop_Water(TileIndex tile) break; case FLOOD_DRYUP: { - Slope slope_here = GetFoundationPixelSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; + Slope slope_here = GetFoundationSlope(tile) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; uint dir; FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope_here]) { TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir)); |