From 26b153b1dfdffb24fbeb2e5bc91154a2e8d3f78e Mon Sep 17 00:00:00 2001 From: tron Date: Thu, 31 Aug 2006 06:46:52 +0000 Subject: (svn r6251) Replace 2 bool variables by a simple switch --- rail_cmd.c | 10 ++++------ rail_map.h | 5 ----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/rail_cmd.c b/rail_cmd.c index fe12c6590..6e8ca0c16 100644 --- a/rail_cmd.c +++ b/rail_cmd.c @@ -1210,8 +1210,6 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track) const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); PalSpriteID image; bool junction = false; - bool earth = IsBarrenRailGround(ti->tile); - bool snow = IsSnowRailGround(ti->tile); // Select the sprite to use. (image = rti->base_sprites.track_y, track == TRACK_BIT_Y) || @@ -1243,10 +1241,10 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track) image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y; } - if (earth) { - image = (image & SPRITE_MASK) | PALETTE_TO_BARE_LAND; // Use brown palette - } else if (snow) { - image += rti->snow_offset; + switch (GetRailGroundType(ti->tile)) { + case RAIL_GROUND_BARREN: image |= PALETTE_TO_BARE_LAND; break; + case RAIL_GROUND_ICE_DESERT: image += rti->snow_offset; break; + default: break; } DrawGroundSprite(image); diff --git a/rail_map.h b/rail_map.h index d4f0a0386..4d609fc37 100644 --- a/rail_map.h +++ b/rail_map.h @@ -311,11 +311,6 @@ static inline RailGroundType GetRailGroundType(TileIndex t) return (RailGroundType)GB(_m[t].m2, 0, 4); } -static inline bool IsBarrenRailGround(TileIndex t) -{ - return GetRailGroundType(t) == RAIL_GROUND_BARREN; -} - static inline bool IsSnowRailGround(TileIndex t) { return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT; -- cgit v1.2.3-70-g09d2