diff options
author | frosch <frosch@openttd.org> | 2008-06-12 21:36:56 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-06-12 21:36:56 +0000 |
commit | 90507de6e4de17728337c066791fe25be4287301 (patch) | |
tree | a1c6142c85a2edeaeb243c5a5f20cc704bf643ed | |
parent | b14d884a0ae6a7a2d44238984a49d8a1af580a93 (diff) | |
download | openttd-90507de6e4de17728337c066791fe25be4287301.tar.xz |
(svn r13499) -Codechange: Allow drawing (ugly) leveled foundations on steep slopes, just in case someone needs them for fallback.
-rw-r--r-- | src/industry_cmd.cpp | 3 | ||||
-rw-r--r-- | src/landscape.cpp | 6 | ||||
-rw-r--r-- | src/slope_func.h | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index ae2322fdf..1338fe9c9 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -337,8 +337,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh) 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 --git a/src/landscape.cpp b/src/landscape.cpp index 2216a3831..982f02ab8 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -79,8 +79,9 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s) 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 @@ void DrawFoundation(TileInfo *ti, Foundation f) 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 --git a/src/slope_func.h b/src/slope_func.h index 7bfa5e52d..99722f62b 100644 --- a/src/slope_func.h +++ b/src/slope_func.h @@ -347,13 +347,11 @@ static inline Corner GetRailFoundationCorner(Foundation f) * 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); } |