mirror of https://github.com/OpenTTD/OpenTTD
(svn r23094) -Codechange: add a default NULL to GetFoundationSlope and use it
parent
2ed0f93bfb
commit
ecbc56a677
|
@ -36,7 +36,7 @@ byte LowestSnowLine();
|
||||||
void ClearSnowLine();
|
void ClearSnowLine();
|
||||||
|
|
||||||
int GetSlopeZInCorner(Slope tileh, Corner corner);
|
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 GetPartialPixelZ(int x, int y, Slope corners);
|
||||||
uint GetSlopePixelZ(int x, int y);
|
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)
|
static inline Slope GetFoundationPixelSlope(TileIndex tile, uint *z)
|
||||||
{
|
{
|
||||||
|
assert(z != NULL);
|
||||||
Slope s = GetFoundationSlope(tile, z);
|
Slope s = GetFoundationSlope(tile, z);
|
||||||
if (z != NULL) *z *= TILE_HEIGHT;
|
*z *= TILE_HEIGHT;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ static bool IsPossibleCrossing(const TileIndex tile, Axis ax)
|
||||||
return (IsTileType(tile, MP_RAILWAY) &&
|
return (IsTileType(tile, MP_RAILWAY) &&
|
||||||
GetRailTileType(tile) == RAIL_TILE_NORMAL &&
|
GetRailTileType(tile) == RAIL_TILE_NORMAL &&
|
||||||
GetTrackBits(tile) == (ax == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X) &&
|
GetTrackBits(tile) == (ax == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X) &&
|
||||||
GetFoundationPixelSlope(tile, NULL) == SLOPE_FLAT);
|
GetFoundationSlope(tile) == SLOPE_FLAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1410,7 +1410,7 @@ static void TileLoop_Road(TileIndex tile)
|
||||||
if (t->road_build_months != 0 &&
|
if (t->road_build_months != 0 &&
|
||||||
(DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) &&
|
(DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) &&
|
||||||
IsNormalRoad(tile) && !HasAtMostOneBit(GetAllRoadBits(tile))) {
|
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);
|
StartRoadWorks(tile);
|
||||||
|
|
||||||
SndPlayTileFx(SND_21_JACKHAMMER, tile);
|
SndPlayTileFx(SND_21_JACKHAMMER, tile);
|
||||||
|
|
|
@ -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);
|
bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2);
|
||||||
if (cur_slope == SLOPE_FLAT) return ret;
|
if (cur_slope == SLOPE_FLAT) return ret;
|
||||||
|
|
||||||
|
|
|
@ -1090,7 +1090,7 @@ void TileLoop_Water(TileIndex tile)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLOOD_DRYUP: {
|
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;
|
uint dir;
|
||||||
FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope_here]) {
|
FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope_here]) {
|
||||||
TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir));
|
TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir));
|
||||||
|
|
Loading…
Reference in New Issue