mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r6251) Replace 2 bool variables by a simple switch
This commit is contained in:
parent
7922c9ff84
commit
26b153b1df
10
rail_cmd.c
10
rail_cmd.c
|
@ -1210,8 +1210,6 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track)
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile));
|
||||||
PalSpriteID image;
|
PalSpriteID image;
|
||||||
bool junction = false;
|
bool junction = false;
|
||||||
bool earth = IsBarrenRailGround(ti->tile);
|
|
||||||
bool snow = IsSnowRailGround(ti->tile);
|
|
||||||
|
|
||||||
// Select the sprite to use.
|
// Select the sprite to use.
|
||||||
(image = rti->base_sprites.track_y, track == TRACK_BIT_Y) ||
|
(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;
|
image = _track_sloped_sprites[ti->tileh - 1] + rti->base_sprites.track_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (earth) {
|
switch (GetRailGroundType(ti->tile)) {
|
||||||
image = (image & SPRITE_MASK) | PALETTE_TO_BARE_LAND; // Use brown palette
|
case RAIL_GROUND_BARREN: image |= PALETTE_TO_BARE_LAND; break;
|
||||||
} else if (snow) {
|
case RAIL_GROUND_ICE_DESERT: image += rti->snow_offset; break;
|
||||||
image += rti->snow_offset;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGroundSprite(image);
|
DrawGroundSprite(image);
|
||||||
|
|
|
@ -311,11 +311,6 @@ static inline RailGroundType GetRailGroundType(TileIndex t)
|
||||||
return (RailGroundType)GB(_m[t].m2, 0, 4);
|
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)
|
static inline bool IsSnowRailGround(TileIndex t)
|
||||||
{
|
{
|
||||||
return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
|
return GetRailGroundType(t) == RAIL_GROUND_ICE_DESERT;
|
||||||
|
|
Loading…
Reference in New Issue