@@ -24,17 +24,19 @@
/** Railtype flags. */
enum RailTypeFlags {
RTF_CATENARY = 0, ///< Bit number for drawing a catenary.
RTF_NO_LEVEL_CROSSING = 1, ///< Bit number for disallowing level crossings.
RTF_HIDDEN = 2, ///< Bit number for hiding from selection.
RTF_NO_SPRITE_COMBINE = 3, ///< Bit number for using non-combined junctions.
RTFB_NONE = 0, ///< All flags cleared.
RTFB_CATENARY = 1 << RTF_CATENARY, ///< Value for drawing a catenary.
RTFB_NO_LEVEL_CROSSING = 1 << RTF_NO_LEVEL_CROSSING, ///< Value for disallowing level crossings.
RTFB_HIDDEN = 1 << RTF_HIDDEN, ///< Value for hiding from selection.
RTFB_NO_SPRITE_COMBINE = 1 << RTF_NO_SPRITE_COMBINE, ///< Value for using non-combined junctions.
};
DECLARE_ENUM_AS_BIT_SET(RailTypeFlags)
struct SpriteGroup;
/** Sprite groups for a railtype. */
@@ -48,12 +50,13 @@ enum RailTypeSpriteGroup {
RTSG_BRIDGE, ///< Bridge surface images
RTSG_CROSSING, ///< Level crossing overlay images
RTSG_DEPOT, ///< Depot images
RTSG_FENCES, ///< Fence images
RTSG_TUNNEL_PORTAL, ///< Tunnel portal overlay
RTSG_SIGNALS, ///< Signal images
RTSG_GROUND_COMPLETE, ///< Complete ground images
RTSG_END,
/**
* Offsets for sprites within an overlay/underlay set.
* These are the same for overlay and underlay sprites.
@@ -2104,18 +2104,31 @@ static void DrawTrackBitsOverlay(TileInf
image += SlopeToSpriteOffset(ti->tileh);
DrawGroundSprite(image, PAL_NONE);
}
bool no_combine = ti->tileh == SLOPE_FLAT && HasBit(rti->flags, RTF_NO_SPRITE_COMBINE);
SpriteID overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY);
SpriteID ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND);
SpriteID ground = GetCustomRailSprite(rti, ti->tile, no_combine ? RTSG_GROUND_COMPLETE : RTSG_GROUND);
TrackBits pbs = _settings_client.gui.show_track_reservation ? GetRailReservationTrackBits(ti->tile) : TRACK_BIT_NONE;
if (track == TRACK_BIT_NONE) {
/* Half-tile foundation, no track here? */
} else if (no_combine) {
/* Use trackbits as direct index from ground sprite, subtract 1
* because there is no sprite for no bits. */
DrawGroundSprite(ground + track - 1, PAL_NONE);
/* Draw reserved track bits */
if (pbs & TRACK_BIT_X) DrawGroundSprite(overlay + RTO_X, PALETTE_CRASH);
if (pbs & TRACK_BIT_Y) DrawGroundSprite(overlay + RTO_Y, PALETTE_CRASH);
if (pbs & TRACK_BIT_UPPER) DrawTrackSprite(overlay + RTO_N, PALETTE_CRASH, ti, SLOPE_N);
if (pbs & TRACK_BIT_LOWER) DrawTrackSprite(overlay + RTO_S, PALETTE_CRASH, ti, SLOPE_S);
if (pbs & TRACK_BIT_RIGHT) DrawTrackSprite(overlay + RTO_E, PALETTE_CRASH, ti, SLOPE_E);
if (pbs & TRACK_BIT_LEFT) DrawTrackSprite(overlay + RTO_W, PALETTE_CRASH, ti, SLOPE_W);
} else if (ti->tileh == SLOPE_NW && track == TRACK_BIT_Y) {
DrawGroundSprite(ground + RTO_SLOPE_NW, PAL_NONE);
if (pbs != TRACK_BIT_NONE) DrawGroundSprite(overlay + RTO_SLOPE_NW, PALETTE_CRASH);
} else if (ti->tileh == SLOPE_NE && track == TRACK_BIT_X) {
DrawGroundSprite(ground + RTO_SLOPE_NE, PAL_NONE);
if (pbs != TRACK_BIT_NONE) DrawGroundSprite(overlay + RTO_SLOPE_NE, PALETTE_CRASH);
Status change: