From 4c37aad393d66707faa35074d5329e3adb96b9da Mon Sep 17 00:00:00 2001 From: keldorkatarn Date: Fri, 1 Apr 2016 22:02:57 +0200 Subject: [PATCH] Make sure we the custom track type based signals for bridges and tunnels also. (cherry picked from commit 1dc478cb654f88eab3c760bdc9f305ce3f039ec3) --- src/tunnelbridge_cmd.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 0ba55b693e..656db507ca 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -1190,14 +1190,21 @@ static void DrawTunnelBridgeRampSignal(const TileInfo *ti) if (ti->tileh != SLOPE_FLAT && IsBridge(ti->tile)) z += 8; // sloped bridge head SignalVariant variant = IsTunnelBridgeSemaphore(ti->tile) ? SIG_SEMAPHORE : SIG_ELECTRIC; + const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(ti->tile)); - SpriteID sprite; - if (variant == SIG_ELECTRIC && type == SIGTYPE_NORMAL) { - /* Normal electric signals are picked from original sprites. */ - sprite = SPR_ORIGINAL_SIGNALS_BASE + ((position << 1) + is_green); + SpriteID sprite = GetCustomSignalSprite(rti, ti->tile, type, variant, is_green ? SIGNAL_STATE_GREEN : SIGNAL_STATE_RED); + bool is_custom_sprite = (sprite != 0); + + if (is_custom_sprite) { + sprite += position; } else { - /* All other signals are picked from add on sprites. */ - sprite = SPR_SIGNALS_BASE + ((type - 1) * 16 + variant * 64 + (position << 1) + is_green) + (IsSignalSpritePBS(type) ? 64 : 0); + if (variant == SIG_ELECTRIC && type == SIGTYPE_NORMAL) { + /* Normal electric signals are picked from original sprites. */ + sprite = SPR_ORIGINAL_SIGNALS_BASE + ((position << 1) + is_green); + } else { + /* All other signals are picked from add on sprites. */ + sprite = SPR_SIGNALS_BASE + ((type - 1) * 16 + variant * 64 + (position << 1) + is_green) + (IsSignalSpritePBS(type) ? 64 : 0); + } } AddSortableSpriteToDraw(sprite, PAL_NONE, x, y, 1, 1, TILE_HEIGHT, z, false, 0, 0, BB_Z_SEPARATOR);