# HG changeset patch # User frosch # Date 1213306616 0 # Node ID b53a857888b80d2b7b7ec7bfdce8aac39ce5a084 # Parent 4b627487aac9ad698cecd0668f22d1931061dce9 (svn r13499) -Codechange: Allow drawing (ugly) leveled foundations on steep slopes, just in case someone needs them for fallback. diff -r 4b627487aac9 -r b53a857888b8 src/industry_cmd.cpp --- a/src/industry_cmd.cpp Thu Jun 12 19:06:30 2008 +0000 +++ b/src/industry_cmd.cpp Thu Jun 12 21:36:56 2008 +0000 @@ -337,8 +337,7 @@ IndustryGfx gfx = GetIndustryGfx(tile); /* For NewGRF industry tiles we might not be drawing a foundation. We need to - * account for this, otherwise we might be applying a FOUNDATION_LEVELED - * on a steep slope which is not allowed. Furthermore other structures should + * account for this, as other structures should * draw the wall of the foundation in this case. */ if (gfx >= NEW_INDUSTRYTILEOFFSET) { diff -r 4b627487aac9 -r b53a857888b8 src/landscape.cpp --- a/src/landscape.cpp Thu Jun 12 19:06:30 2008 +0000 +++ b/src/landscape.cpp Thu Jun 12 21:36:56 2008 +0000 @@ -79,8 +79,9 @@ if (!IsFoundation(f)) return 0; if (IsLeveledFoundation(f)) { + uint dz = TILE_HEIGHT + (IsSteepSlope(*s) ? TILE_HEIGHT : 0); *s = SLOPE_FLAT; - return TILE_HEIGHT; + return dz; } if (f != FOUNDATION_STEEP_BOTH && IsNonContinuousFoundation(f)) { @@ -402,6 +403,9 @@ AddSortableSpriteToDraw(inclined_base + inclined, PAL_NONE, ti->x, ti->y, 16, 16, 1, ti->z); OffsetGroundSprite(31, 9); + } else if (IsLeveledFoundation(f)) { + AddSortableSpriteToDraw(leveled_base + SlopeWithOneCornerRaised(highest_corner), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z - TILE_HEIGHT); + OffsetGroundSprite(31, 1); } else if (f == FOUNDATION_STEEP_LOWER) { /* one corner raised */ OffsetGroundSprite(31, 1); diff -r 4b627487aac9 -r b53a857888b8 src/slope_func.h --- a/src/slope_func.h Thu Jun 12 19:06:30 2008 +0000 +++ b/src/slope_func.h Thu Jun 12 21:36:56 2008 +0000 @@ -347,13 +347,11 @@ * Returns the foundation needed to flatten a slope. * The returned foundation is either FOUNDATION_NONE if the tile was already flat, or FOUNDATION_LEVELED. * - * @pre The slope must not be steep. * @param s The current #Slope. * @return The needed #Foundation. */ static inline Foundation FlatteningFoundation(Slope s) { - assert(!IsSteepSlope(s)); return (s == SLOPE_FLAT ? FOUNDATION_NONE : FOUNDATION_LEVELED); }