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 --- unmovable_cmd.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'unmovable_cmd.c') diff --git a/unmovable_cmd.c b/unmovable_cmd.c index a2518fd98..067af3ecc 100644 --- a/unmovable_cmd.c +++ b/unmovable_cmd.c @@ -141,7 +141,7 @@ static void DrawTile_Unmovable(TileInfo *ti) { const DrawTileUnmovableStruct *dtus; - if (ti->tileh) DrawFoundation(ti, ti->tileh); + if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh); DrawClearLandTile(ti, 2); dtus = &_draw_tile_unmovable_data[GetUnmovableType(ti->tile)]; @@ -175,7 +175,7 @@ static void DrawTile_Unmovable(TileInfo *ti) const DrawTileSprites *t; assert(IsCompanyHQ(ti->tile)); - if (ti->tileh) DrawFoundation(ti, ti->tileh); + if (ti->tileh != SLOPE_FLAT) DrawFoundation(ti, ti->tileh); ormod = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)); @@ -201,13 +201,13 @@ static uint GetSlopeZ_Unmovable(const TileInfo* ti) if (IsOwnedLand(ti->tile)) { return ti->z + GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh); } else { - return ti->z + (ti->tileh == 0 ? 0 : 8); + return ti->z + (ti->tileh == SLOPE_FLAT ? 0 : 8); } } -static uint GetSlopeTileh_Unmovable(TileIndex tile, uint tileh) +static Slope GetSlopeTileh_Unmovable(TileIndex tile, Slope tileh) { - return IsOwnedLand(tile) ? tileh : 0; + return IsOwnedLand(tile) ? tileh : SLOPE_FLAT; } static int32 ClearTile_Unmovable(TileIndex tile, byte flags) @@ -341,7 +341,7 @@ void GenerateUnmovables(void) j = ScaleByMapSize(40); // maximum number of radio towers on the map do { tile = RandomTile(); - if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == 0 && h >= 32) { + if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h >= 32) { if (!checkRadioTowerNearby(tile)) continue; MakeTransmitter(tile); if (--j == 0) break; @@ -372,7 +372,7 @@ restart: do { if (--j == 0) goto restart; tile = TILE_MASK(tile + TileOffsByDir(dir)); - } while (!(IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == 0 && h <= TILE_HEIGHT * 2)); + } while (!(IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h <= TILE_HEIGHT * 2)); assert(tile == TILE_MASK(tile)); -- cgit v1.2.3-54-g00ecf