summaryrefslogtreecommitdiff
path: root/src/landscape.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-05 19:36:13 +0000
committerrubidium <rubidium@openttd.org>2007-10-05 19:36:13 +0000
commitc4edf5c6ce181f2e6cbf86772dd121aa412f6703 (patch)
tree267ed22b0e877ec1908fc746497626f64b27d14e /src/landscape.cpp
parent0827b314f9aca2340d2a2673bd99897b632c9fbf (diff)
downloadopenttd-c4edf5c6ce181f2e6cbf86772dd121aa412f6703.tar.xz
(svn r11209) -Codechange: remove some magic numbers and bit magic with appropriate enums and functions. Patch by frosch.
Diffstat (limited to 'src/landscape.cpp')
-rw-r--r--src/landscape.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index fa21d667c..0e61d5010 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -77,23 +77,23 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s)
}
uint dz = IsSteepSlope(*s) ? TILE_HEIGHT : 0;
- byte highest_corner = GetHighestSlopeCorner(*s);
+ Corner highest_corner = GetHighestSlopeCorner(*s);
switch (f) {
case FOUNDATION_INCLINED_X:
- *s = (highest_corner <= 1 ? SLOPE_SW : SLOPE_NE);
+ *s = (((highest_corner == CORNER_W) || (highest_corner == CORNER_S)) ? SLOPE_SW : SLOPE_NE);
break;
case FOUNDATION_INCLINED_Y:
- *s = (((highest_corner == 1) || (highest_corner == 2)) ? SLOPE_SE : SLOPE_NW);
+ *s = (((highest_corner == CORNER_S) || (highest_corner == CORNER_E)) ? SLOPE_SE : SLOPE_NW);
break;
case FOUNDATION_STEEP_LOWER:
- *s = (Slope) (1 << highest_corner);
+ *s = SlopeWithOneCornerRaised(highest_corner);
break;
case FOUNDATION_STEEP_HIGHER:
- *s = (Slope) (*s & ~SLOPE_STEEP);
+ *s = SlopeWithThreeCornersRaised(OppositeCorner(highest_corner));
break;
default: NOT_REACHED();
@@ -271,7 +271,7 @@ void DrawFoundation(TileInfo *ti, Foundation f)
lower_base + (ti->tileh & ~SLOPE_STEEP), PAL_NONE, ti->x, ti->y, 16, 16, 7, ti->z
);
- byte highest_corner = GetHighestSlopeCorner(ti->tileh);
+ Corner highest_corner = GetHighestSlopeCorner(ti->tileh);
ti->z += ApplyFoundationToSlope(f, &ti->tileh);
if (IsInclinedFoundation(f)) {