Add setting to show restricted electric signals using the default sprites.

This is to improve visual distinctiveness of restricted signals when
using signal GRFs.
This defaults to off.
This commit is contained in:
Jonathan G Rennison
2015-12-09 01:01:37 +00:00
parent 8edf5e0a34
commit a93714a720
8 changed files with 43 additions and 3 deletions

View File

@@ -1862,6 +1862,8 @@ static void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track trac
SignalType type = GetSignalType(tile, track);
SignalVariant variant = GetSignalVariant(tile, track);
bool show_restricted = (variant == SIG_ELECTRIC) && IsRestrictedSignal(tile) && (GetExistingTraceRestrictProgram(tile, track) != NULL);
SpriteID sprite = GetCustomSignalSprite(rti, tile, type, variant, condition);
bool is_custom_sprite = (sprite != 0);
if (sprite != 0) {
@@ -1877,7 +1879,14 @@ static void DrawSingleSignal(TileIndex tile, const RailtypeInfo *rti, Track trac
extern uint _opengfx_grf_file_index;
if (!is_custom_sprite) is_custom_sprite = origin_slot != _opengfx_grf_file_index && (origin_slot >= _first_user_grf_file_index);
if (!is_custom_sprite && variant == SIG_ELECTRIC && IsRestrictedSignal(tile) && GetExistingTraceRestrictProgram(tile, track) != NULL) {
if (is_custom_sprite && show_restricted && _settings_client.gui.show_restricted_signal_default) {
/* Use duplicate sprite block, instead of GRF-specified signals */
sprite = (type == SIGTYPE_NORMAL && variant == SIG_ELECTRIC) ? SPR_DUP_ORIGINAL_SIGNALS_BASE : SPR_DUP_SIGNALS_BASE - 16;
sprite += type * 16 + variant * 64 + image * 2 + condition + (type > SIGTYPE_LAST_NOPBS ? 64 : 0);
is_custom_sprite = false;
}
if (!is_custom_sprite && show_restricted) {
if (type == SIGTYPE_PBS || type == SIGTYPE_PBS_ONEWAY) {
static const SubSprite lower_part = { -50, -10, 50, 50 };
static const SubSprite upper_part = { -50, -50, 50, -11 };