(svn r1545) Add TileHeight() which returns the height (not multiplied by 8)

Replace some direct references to _map_type_and_height with TileHeight()/IsTileType()
This commit is contained in:
tron
2005-01-16 14:50:01 +00:00
parent 07647737d5
commit 27057ae4b0
6 changed files with 26 additions and 22 deletions

View File

@@ -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);