summaryrefslogtreecommitdiff
path: root/landscape.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-01-16 14:50:01 +0000
committertron <tron@openttd.org>2005-01-16 14:50:01 +0000
commit022b8cea37b1ae1a3a1745c5373d202a7f267a2d (patch)
tree187e8c5437b91c17d0f652b2f0d01e30fbd131b4 /landscape.c
parent8e404a26f65b8851b3dcf067fddf62f188005ee9 (diff)
downloadopenttd-022b8cea37b1ae1a3a1745c5373d202a7f267a2d.tar.xz
(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)
Replace some direct references to _map_type_and_height with TileHeight()/IsTileType()
Diffstat (limited to 'landscape.c')
-rw-r--r--landscape.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/landscape.c b/landscape.c
index c40dd4c1a..1a490a897 100644
--- a/landscape.c
+++ b/landscape.c
@@ -53,12 +53,12 @@ uint GetTileSlope(uint tile, int *h)
assert(tile < MapSize() && TileX(tile) != MapMaxX() && TileY(tile) != MapMaxY());
- min = a = _map_type_and_height[tile] & 0xF;
- b = _map_type_and_height[tile+TILE_XY(1,0)] & 0xF;
+ min = a = TileHeight(tile);
+ b = TileHeight(tile + TILE_XY(1,0));
if (min >= b) min = b;
- c = _map_type_and_height[tile+TILE_XY(0,1)] & 0xF;
+ c = TileHeight(tile + TILE_XY(0,1));
if (min >= c) min = c;
- d = _map_type_and_height[tile+TILE_XY(1,1)] & 0xF;
+ d = TileHeight(tile + TILE_XY(1,1));
if (min >= d) min = d;
r = 0;
@@ -634,14 +634,13 @@ static void CreateDesertOrRainForest()
{
uint tile;
const TileIndexDiffC *data;
- byte mt;
int i;
for (tile = 0; tile != MapSize(); ++tile) {
for (data = _make_desert_or_rainforest_data;
data != endof(_make_desert_or_rainforest_data); ++data) {
- mt = _map_type_and_height[TILE_MASK(tile + ToTileIndexDiff(*data))];
- if ((mt & 0xf) >= 4 || (mt >> 4) == MP_WATER) break;
+ TileIndex t = tile + ToTileIndexDiff(*data);
+ if (TileHeight(t) >= 4 || IsTileType(t, MP_WATER)) break;
}
if (data == endof(_make_desert_or_rainforest_data))
SetMapExtraBits(tile, 1);