(svn r6251) Replace 2 bool variables by a simple switch
authortron
Thu, 31 Aug 2006 06:46:52 +0000
changeset 4466 480223faf4c4
parent 4465 852cf43b354f
child 4467 dede0d254ffb
(svn r6251) Replace 2 bool variables by a simple switch
rail_cmd.c
rail_map.h
--- a/rail_cmd.c	Wed Aug 30 23:01:45 2006 +0000
+++ b/rail_cmd.c	Thu Aug 31 06:46:52 2006 +0000
@@ -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	Wed Aug 30 23:01:45 2006 +0000
+++ b/rail_map.h	Thu Aug 31 06:46:52 2006 +0000
@@ -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;