Mercurial > hg > openttd
changeset 4466:e1a370ed33ee draft
(svn r6251) Replace 2 bool variables by a simple switch
author | tron <tron@openttd.org> |
---|---|
date | Thu, 31 Aug 2006 06:46:52 +0000 |
parents | cd2b09e54303 |
children | 7913fdd469c5 |
files | rail_cmd.c rail_map.h |
diffstat | 2 files changed, 4 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/rail_cmd.c +++ b/rail_cmd.c @@ -1210,8 +1210,6 @@ 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 @@ 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);
--- a/rail_map.h +++ b/rail_map.h @@ -311,11 +311,6 @@ 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;