diff options
author | tron <tron@openttd.org> | 2006-08-31 06:46:52 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-08-31 06:46:52 +0000 |
commit | 26b153b1dfdffb24fbeb2e5bc91154a2e8d3f78e (patch) | |
tree | 0fe6c863b019a738faf2d2ed1078f2d084e24242 | |
parent | 7922c9ff8496db84a24a62665437389fdaade34a (diff) | |
download | openttd-26b153b1dfdffb24fbeb2e5bc91154a2e8d3f78e.tar.xz |
(svn r6251) Replace 2 bool variables by a simple switch
-rw-r--r-- | rail_cmd.c | 10 | ||||
-rw-r--r-- | 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; |