From dd180a1e1883336a1edc3b4d6eac440f06e3685b Mon Sep 17 00:00:00 2001 From: tron Date: Sun, 23 Apr 2006 13:48:16 +0000 Subject: (svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums --- tile.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'tile.c') diff --git a/tile.c b/tile.c index 5b50fe191..36df4c542 100644 --- a/tile.c +++ b/tile.c @@ -8,27 +8,27 @@ * @param h uint pointer to write the height to * @return the tileh */ -uint GetTileh(uint n, uint w, uint e, uint s, uint *h) +Slope GetTileh(uint n, uint w, uint e, uint s, uint *h) { uint min = n; - uint r; + Slope r; if (min >= w) min = w; if (min >= e) min = e; if (min >= s) min = s; - r = 0; - if ((n -= min) != 0) r += (--n << 4) + 8; - if ((e -= min) != 0) r += (--e << 4) + 4; - if ((s -= min) != 0) r += (--s << 4) + 2; - if ((w -= min) != 0) r += (--w << 4) + 1; + r = SLOPE_FLAT; + if ((n -= min) != 0) r += (--n << 4) + SLOPE_N; + if ((e -= min) != 0) r += (--e << 4) + SLOPE_E; + if ((s -= min) != 0) r += (--s << 4) + SLOPE_S; + if ((w -= min) != 0) r += (--w << 4) + SLOPE_W; if (h != NULL) *h = min * TILE_HEIGHT; return r; } -uint GetTileSlope(TileIndex tile, uint *h) +Slope GetTileSlope(TileIndex tile, uint *h) { uint a; uint b; -- cgit v1.2.3-54-g00ecf