summaryrefslogtreecommitdiff
path: root/tile.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-04-23 13:48:16 +0000
committertron <tron@openttd.org>2006-04-23 13:48:16 +0000
commitdd180a1e1883336a1edc3b4d6eac440f06e3685b (patch)
tree3f0769bd955cefba7ab80063e64546c1874e0a62 /tile.c
parentfa213c686ee1d348d1eb167f2423261d8040205e (diff)
downloadopenttd-dd180a1e1883336a1edc3b4d6eac440f06e3685b.tar.xz
(svn r4541) Add a type for slopes and replace many magic numbers by the appropriate enums
Diffstat (limited to 'tile.c')
-rw-r--r--tile.c16
1 files changed, 8 insertions, 8 deletions
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;