Change settings for using default signal graphics and signal recolouring

This commit is contained in:
Jonathan G Rennison 2023-12-08 21:40:40 +00:00
parent bae2936491
commit 48cc6a686b
13 changed files with 57 additions and 37 deletions

View File

@ -198,9 +198,6 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :Zobrazovat skup
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Zobrazovat hmotnostní poměry vlaku v podrobnostech: {STRING} STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Zobrazovat hmotnostní poměry vlaku v podrobnostech: {STRING}
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Zobrazovat poměr váhy vlaku k jeho výkonu a tažné síle v okně Detaily STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Zobrazovat poměr váhy vlaku k jeho výkonu a tažné síle v okně Detaily
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :Zobrazovat omezená optická návěstidla výchozí grafikou: {STRING}
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Zobrazovat návěstidla s omezením vyhledávání trasy pomocí výchozí grafiky světelných návěstidel s modrou značkou, namísto použití jakékoli jiné obsažené v NewGRF. Tato volba usnadní rozpoznání omezených návěstidel.
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Zobrazovat všechna návěstidla výchozí grafikou: {STRING} STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Zobrazovat všechna návěstidla výchozí grafikou: {STRING}
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Zobrazovat všechna návěstidla pomocí výchozí grafiky namísto použití jakékoli jiné obsažené v NewGRF. Tato volba usnadní určení stavu a typu návěstidla, když NewGRF poskytuje nejasné nebo nedostupné vzhledy návěstidel. STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Zobrazovat všechna návěstidla pomocí výchozí grafiky namísto použití jakékoli jiné obsažené v NewGRF. Tato volba usnadní určení stavu a typu návěstidla, když NewGRF poskytuje nejasné nebo nedostupné vzhledy návěstidel.

View File

@ -244,11 +244,13 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :Show vehicle gr
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Show train weight ratios in details: {STRING2} STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Show train weight ratios in details: {STRING2}
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Show train weight ratios in the vehicle details window STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Show train weight ratios in the vehicle details window
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :Show restricted electric signals using default graphics: {STRING2} STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_RECOLOUR :Show default restricted signals with blue signal posts: {STRING2}
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Show electric signals with routing restriction programs using the default signal graphics with a blue signal post, instead of using any NewGRF signal graphics. This is to make it easier to visually distinguish restricted signals. STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_RECOLOUR_HELPTEXT :Show electric signals with routing restriction programs with a blue signal post, when using the default signal graphics. This does not affect NewGRF signal graphics. This is to make it easier to visually distinguish restricted signals.
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Show all signals using default graphics: {STRING2} STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Show all signals using default graphics: {STRING2}
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Show all signals using the default signal graphics, instead of using any NewGRF signal graphics. This is to make it easier to see the state and type of signals when NewGRFs provide unclear or inaccessible signal graphics. STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Show all signals using the default signal graphics, instead of using any NewGRF signal graphics. This is to make it easier to see the state and type of signals when NewGRFs provide unclear or inaccessible signal graphics.
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT_EXTRA :{STRING}{}The "only for restricted signals" mode uses the default signal graphics for electric signals with routing restriction programs attached, when recolouring of signal posts is enabled and the NewGRF does not handle different graphics for restricted signals itself.
STR_CONFIG_SETTING_SHOW_ALL_SIG_RESTRICTED_RECOLOUR :Only for restricted signals
STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES :Show advanced routing restriction features: {STRING2} STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES :Show advanced routing restriction features: {STRING2}
STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT :Show advanced routing restriction features. When disabled, some advanced features are not shown in the UI, but are still available to all players. STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT :Show advanced routing restriction features. When disabled, some advanced features are not shown in the UI, but are still available to all players.

View File

@ -206,9 +206,6 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :Amosar o nome d
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Amosar os ratios de pesos do tren nos detallees: {STRING} STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Amosar os ratios de pesos do tren nos detallees: {STRING}
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Amosar os ratios de pesos do tren na fiestra de detalles do vehículo STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Amosar os ratios de pesos do tren na fiestra de detalles do vehículo
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :Amosar os sinais eléctricos restrinxidos usando os gráficos por defecto: {STRING}
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Amosar os sinais eléctricos con programas de restrición de enrutamento utilizando os gráficos de sinais por defecto cun sinal azul, en lguar de utilizar gráficos dalgún NewGRF. Isto é para facilitar a distinción visual de sinais restrinxidos.
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Amosar todos os sinais cos gráficos por defecto: {STRING} STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Amosar todos os sinais cos gráficos por defecto: {STRING}
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Amosar todos os sinais usando os sinais gráficos por defecto, en lugar de usar sinais de NewGRF. Isto é para que sexa máis sinxelo ver o estado e tipo de sinais cando os NewGRF non están claros ou non teñen gráficos. STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Amosar todos os sinais usando os sinais gráficos por defecto, en lugar de usar sinais de NewGRF. Isto é para que sexa máis sinxelo ver o estado e tipo de sinais cando os NewGRF non están claros ou non teñen gráficos.

View File

@ -178,9 +178,6 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :Zeige die Fahrz
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Zeige die Gewichtsverhältnisse von Zügen im Einzelheitenfenster: {STRING} STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Zeige die Gewichtsverhältnisse von Zügen im Einzelheitenfenster: {STRING}
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Zeige die Gewichtsverhältnisse von Zügen im Fenster der Fahrzeugeinzelheiten. STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :Zeige die Gewichtsverhältnisse von Zügen im Fenster der Fahrzeugeinzelheiten.
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :Zeige beschränkte Lichtsignale in den Standard-Grafiken: {STRING}
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :Zeige Lichtsignale mit Routing-Beschränkungen in den Standard-Grafiken mit blauem Pfosten anstelle von NewGRF-Grafiken, um diese zur leichteren Erkennbarkeit visuell hervorzuheben.
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Zeige alle Signale mit den Standardgrafiken: {STRING} STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :Zeige alle Signale mit den Standardgrafiken: {STRING}
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Zeige alle Signale mit den Standardgrafiken anstatt Grafiken einer Signal-NewGRF. Dient dazu, den Typ und Status von Signalen besser erkennbar zu machen, falls die verwendete Signal-NewGRF schlecht erkennbare Signalgrafiken bereitstellt. STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :Zeige alle Signale mit den Standardgrafiken anstatt Grafiken einer Signal-NewGRF. Dient dazu, den Typ und Status von Signalen besser erkennbar zu machen, falls die verwendete Signal-NewGRF schlecht erkennbare Signalgrafiken bereitstellt.

View File

@ -206,9 +206,6 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :열차의 그
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :상세정보 화면에서 열차 무게 비 보이기: {STRING} STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :상세정보 화면에서 열차 무게 비 보이기: {STRING}
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :열차의 무게 비를 상세정보 화면에 표시할지 설정합니다. STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :열차의 무게 비를 상세정보 화면에 표시할지 설정합니다.
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :경로 제한 신호기를 기본 그래픽으로 보이기: {STRING}
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :경로 제한이 설정된 전자 신호기를 NewGRF의 신호기 그래픽 대신 기본 신호기 그래픽에 파란 표시를 한 그래픽으로 표시합니다. 이 옵션은 경로 제한 신호기의 구별을 쉽게 하기 위해 사용합니다.
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :모든 신호기를 기본 그래픽으로 표시: {STRING} STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :모든 신호기를 기본 그래픽으로 표시: {STRING}
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :모든 신호기를 NewGRF의 신호기 그래픽을 사용하는 대신, 기본 신호기 그래픽으로 표시합니다. NewGRF에서 제공하는 신호기 그래픽을 사용할 수 없거나 명확하지 않은 경우에 이 설정을 사용하면 신호기의 현시 상태와 종류를 보기가 쉬워집니다. STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :모든 신호기를 NewGRF의 신호기 그래픽을 사용하는 대신, 기본 신호기 그래픽으로 표시합니다. NewGRF에서 제공하는 신호기 그래픽을 사용할 수 없거나 명확하지 않은 경우에 이 설정을 사용하면 신호기의 현시 상태와 종류를 보기가 쉬워집니다.

View File

@ -206,9 +206,6 @@ STR_CONFIG_SETTING_SHOW_VEHICLE_GROUP_IN_DETAILS_HELPTEXT :在载具详情
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :在列车详情窗口显示列车重量比: {STRING} STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :在列车详情窗口显示列车重量比: {STRING}
STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :在列车详情窗口显示列车重量比 STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS_HELPTEXT :在列车详情窗口显示列车重量比
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF :使用默认图形显示受限的电力信号灯: {STRING}
STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT :使用具有蓝色信号柱的默认信号图样显示有路由限制的电力信号灯代替使用任何NewGRF的信号灯图样{}这是为了更容易区分普通信号灯与有路由限制的信号灯
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :使用默认图形展示所有的信号灯: {STRING} STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF :使用默认图形展示所有的信号灯: {STRING}
STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :使用默认信号灯图样展示所有的信号灯代替使用任何NewGRF的信号灯图形{}这是为了在NewGRF提供不清晰的信号灯图形时更容易去区分信号灯的状态及其类型 STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT :使用默认信号灯图样展示所有的信号灯代替使用任何NewGRF的信号灯图形{}这是为了在NewGRF提供不清晰的信号灯图形时更容易去区分信号灯的状态及其类型

View File

@ -200,7 +200,7 @@ static PalSpriteID GetRailTypeCustomSignalSprite(const RailTypeInfo *rti, TileIn
CustomSignalSpriteResult GetCustomSignalSprite(const RailTypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, uint8 aspect, CustomSignalSpriteResult GetCustomSignalSprite(const RailTypeInfo *rti, TileIndex tile, SignalType type, SignalVariant var, uint8 aspect,
CustomSignalSpriteContext context, uint8 style, const TraceRestrictProgram *prog, uint z) CustomSignalSpriteContext context, uint8 style, const TraceRestrictProgram *prog, uint z)
{ {
if (_settings_client.gui.show_all_signal_default && style == 0) return { { 0, PAL_NONE }, false }; if (_settings_client.gui.show_all_signal_default == SSDM_ON && style == 0) return { { 0, PAL_NONE }, false };
if (style == 0) { if (style == 0) {
PalSpriteID spr = GetRailTypeCustomSignalSprite(rti, tile, type, var, aspect, context, prog, z); PalSpriteID spr = GetRailTypeCustomSignalSprite(rti, tile, type, var, aspect, context, prog, z);

View File

@ -85,7 +85,7 @@ void ResolveRailTypeGUISignalSprites(RailTypeInfo *rti, uint8 style, PalSpriteID
auto default_sprite = [&](SignalVariant var, SignalType type) -> SpriteID { auto default_sprite = [&](SignalVariant var, SignalType type) -> SpriteID {
SpriteID spr = _signal_lookup[var][type]; SpriteID spr = _signal_lookup[var][type];
if (_settings_client.gui.show_all_signal_default) { if (_settings_client.gui.show_all_signal_default == SSDM_ON) {
if (type == SIGTYPE_PROG) { if (type == SIGTYPE_PROG) {
spr += SPR_DUP_PROGSIGNAL_BASE - SPR_PROGSIGNAL_BASE; spr += SPR_DUP_PROGSIGNAL_BASE - SPR_PROGSIGNAL_BASE;
} else if (type == SIGTYPE_NO_ENTRY) { } else if (type == SIGTYPE_NO_ENTRY) {
@ -3288,7 +3288,9 @@ void DrawSingleSignal(TileIndex tile, const RailTypeInfo *rti, Track track, Sign
is_custom_sprite = (file != nullptr) && (file->flags & SFF_USERGRF); is_custom_sprite = (file != nullptr) && (file->flags & SFF_USERGRF);
} }
if ((_settings_client.gui.show_all_signal_default || (is_custom_sprite && show_restricted && _settings_client.gui.show_restricted_signal_default && !result.restricted_valid && variant == SIG_ELECTRIC)) && style == 0) { if (style == 0 && (_settings_client.gui.show_all_signal_default == SSDM_ON ||
(is_custom_sprite && show_restricted && _settings_client.gui.show_restricted_signal_recolour &&
_settings_client.gui.show_all_signal_default == SSDM_RESTRICTED_RECOLOUR && !result.restricted_valid && variant == SIG_ELECTRIC))) {
/* Use duplicate sprite block, instead of GRF-specified signals */ /* Use duplicate sprite block, instead of GRF-specified signals */
if (type == SIGTYPE_PROG) { if (type == SIGTYPE_PROG) {
if (variant == SIG_SEMAPHORE) { if (variant == SIG_SEMAPHORE) {
@ -3310,7 +3312,7 @@ void DrawSingleSignal(TileIndex tile, const RailTypeInfo *rti, Track track, Sign
is_custom_sprite = false; is_custom_sprite = false;
} }
if (!is_custom_sprite && show_restricted && variant == SIG_ELECTRIC) { if (!is_custom_sprite && show_restricted && variant == SIG_ELECTRIC && _settings_client.gui.show_restricted_signal_recolour) {
DrawRestrictedSignal(type, sprite, x, y, z, BB_HEIGHT_UNDER_BRIDGE, 0); DrawRestrictedSignal(type, sprite, x, y, z, BB_HEIGHT_UNDER_BRIDGE, 0);
} else { } else {
AddSortableSpriteToDraw(sprite, pal, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, z); AddSortableSpriteToDraw(sprite, pal, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, z);

View File

@ -1960,6 +1960,19 @@ static bool TreePlacerSettingGUI(SettingOnGuiCtrlData &data)
} }
} }
static bool DefaultSignalsSettingGUI(SettingOnGuiCtrlData &data)
{
switch (data.type) {
case SOGCT_DESCRIPTION_TEXT:
SetDParam(0, data.text);
data.text = STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT_EXTRA;
return true;
default:
return false;
}
}
/* End - GUI callbacks */ /* End - GUI callbacks */
/** /**

View File

@ -2024,7 +2024,7 @@ static SettingsContainer &GetSettingsTree()
SettingsPage *viewport_signals = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VIEWPORT_SIGNALS)); SettingsPage *viewport_signals = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VIEWPORT_SIGNALS));
{ {
viewport_signals->Add(new SettingEntry("construction.train_signal_side")); viewport_signals->Add(new SettingEntry("construction.train_signal_side"));
viewport_signals->Add(new SettingEntry("gui.show_restricted_signal_default")); viewport_signals->Add(new SettingEntry("gui.show_restricted_signal_recolour"));
viewport_signals->Add(new SettingEntry("gui.show_all_signal_default")); viewport_signals->Add(new SettingEntry("gui.show_all_signal_default"));
} }
SettingsPage *viewport_route_overlay = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY)); SettingsPage *viewport_route_overlay = viewports->Add(new SettingsPage(STR_CONFIG_SETTING_VEHICLE_ROUTE_OVERLAY));

View File

@ -124,6 +124,12 @@ enum ViewportScrollMode {
VSM_END, ///< Number of scroll mode settings. VSM_END, ///< Number of scroll mode settings.
}; };
enum ShowSignalDefaultMode {
SSDM_OFF,
SSDM_ON,
SSDM_RESTRICTED_RECOLOUR,
};
/** Settings related to time display. This may be loaded from the savegame and/or overriden by the client. */ /** Settings related to time display. This may be loaded from the savegame and/or overriden by the client. */
struct TimeSettings { struct TimeSettings {
bool time_in_minutes; ///< whether to use the hh:mm conversion when printing dates bool time_in_minutes; ///< whether to use the hh:mm conversion when printing dates
@ -246,8 +252,8 @@ struct GUISettings : public TimeSettings {
bool show_train_length_in_details; ///< show train length in vehicle details window top widget bool show_train_length_in_details; ///< show train length in vehicle details window top widget
bool show_train_weight_ratios_in_details; ///< show train weight ratios in vehicle details window top widget bool show_train_weight_ratios_in_details; ///< show train weight ratios in vehicle details window top widget
bool show_vehicle_group_in_details; ///< show vehicle group in vehicle details window top widget bool show_vehicle_group_in_details; ///< show vehicle group in vehicle details window top widget
bool show_restricted_signal_default; ///< Show restricted electric signals using the default sprite bool show_restricted_signal_recolour; ///< Show restricted electric signals with recoloured signal post
bool show_all_signal_default; ///< Show all signals using the default sprite uint8 show_all_signal_default; ///< Show all signals using the default sprite
bool show_adv_tracerestrict_features; ///< Show advanced trace restrict features in UI bool show_adv_tracerestrict_features; ///< Show advanced trace restrict features in UI
bool show_progsig_ui; ///< Show programmable pre-signals feature in UI bool show_progsig_ui; ///< Show programmable pre-signals feature in UI
bool show_noentrysig_ui; ///< Show no-entry signals feature in UI bool show_noentrysig_ui; ///< Show no-entry signals feature in UI

View File

@ -30,6 +30,7 @@ static void DeveloperModeChanged(int32 new_value);
/* Begin - GUI callbacks */ /* Begin - GUI callbacks */
static bool ZoomMaxCfgName(SettingOnGuiCtrlData &data); static bool ZoomMaxCfgName(SettingOnGuiCtrlData &data);
static bool DefaultSignalsSettingGUI(SettingOnGuiCtrlData &data);
/* End - GUI callbacks */ /* End - GUI callbacks */
@ -61,6 +62,13 @@ static const SettingDescEnumEntry _no_depot_order_warn[] = {
{ 0, STR_NULL } { 0, STR_NULL }
}; };
static const SettingDescEnumEntry _show_all_signal_default[] = {
{ SSDM_OFF, STR_CONFIG_SETTING_OFF },
{ SSDM_ON, STR_CONFIG_SETTING_ON },
{ SSDM_RESTRICTED_RECOLOUR, STR_CONFIG_SETTING_SHOW_ALL_SIG_RESTRICTED_RECOLOUR },
{ 0, STR_NULL }
};
const SettingTable _gui_settings{ const SettingTable _gui_settings{
[post-amble] [post-amble]
}; };
@ -1341,20 +1349,23 @@ post_cb = [](auto) { MarkWholeScreenDirty(); }
cat = SC_BASIC cat = SC_BASIC
[SDTC_BOOL] [SDTC_BOOL]
var = gui.show_restricted_signal_default var = gui.show_restricted_signal_recolour
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH
def = false def = true
str = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF str = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_RECOLOUR
strhelp = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT strhelp = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_RECOLOUR_HELPTEXT
post_cb = [](auto) { MarkWholeScreenDirty(); } post_cb = [](auto) { MarkWholeScreenDirty(); }
[SDTC_BOOL] [SDTC_ENUM]
var = gui.show_all_signal_default var = gui.show_all_signal_default
flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_PATCH type = SLE_UINT8
def = false flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_CONVERT_BOOL_TO_INT | SF_PATCH
def = SSDM_OFF
enumlist = _show_all_signal_default
str = STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF str = STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF
strhelp = STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT strhelp = STR_CONFIG_SETTING_SHOW_ALL_SIG_DEF_HELPTEXT
post_cb = [](auto) { UpdateRailGuiSprites(); MarkWholeScreenDirty(); } post_cb = [](auto) { UpdateRailGuiSprites(); MarkWholeScreenDirty(); }
guiproc = DefaultSignalsSettingGUI
[SDTC_BOOL] [SDTC_BOOL]
var = gui.show_adv_tracerestrict_features var = gui.show_adv_tracerestrict_features

View File

@ -1776,24 +1776,25 @@ static void DrawTunnelBridgeRampSingleSignal(const TileInfo *ti, bool is_green,
if (variant == SIG_ELECTRIC && type == SIGTYPE_NORMAL) { if (variant == SIG_ELECTRIC && type == SIGTYPE_NORMAL) {
/* Normal electric signals are picked from original sprites. */ /* Normal electric signals are picked from original sprites. */
sprite = { SPR_ORIGINAL_SIGNALS_BASE + ((position << 1) + is_green), PAL_NONE }; sprite = { SPR_ORIGINAL_SIGNALS_BASE + ((position << 1) + is_green), PAL_NONE };
if (_settings_client.gui.show_all_signal_default) sprite.sprite += SPR_DUP_ORIGINAL_SIGNALS_BASE - SPR_ORIGINAL_SIGNALS_BASE; if (_settings_client.gui.show_all_signal_default == SSDM_ON) sprite.sprite += SPR_DUP_ORIGINAL_SIGNALS_BASE - SPR_ORIGINAL_SIGNALS_BASE;
} else { } else {
/* All other signals are picked from add on sprites. */ /* 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), PAL_NONE }; sprite = { SPR_SIGNALS_BASE + ((type - 1) * 16 + variant * 64 + (position << 1) + is_green) + (IsSignalSpritePBS(type) ? 64 : 0), PAL_NONE };
if (_settings_client.gui.show_all_signal_default) sprite.sprite += SPR_DUP_SIGNALS_BASE - SPR_SIGNALS_BASE; if (_settings_client.gui.show_all_signal_default == SSDM_ON) sprite.sprite += SPR_DUP_SIGNALS_BASE - SPR_SIGNALS_BASE;
} }
SpriteFile *file = GetOriginFile(sprite.sprite); SpriteFile *file = GetOriginFile(sprite.sprite);
is_custom_sprite = (file != nullptr) && (file->flags & SFF_USERGRF); is_custom_sprite = (file != nullptr) && (file->flags & SFF_USERGRF);
} }
if (is_custom_sprite && show_restricted && _settings_client.gui.show_restricted_signal_default && !result.restricted_valid && variant == SIG_ELECTRIC && style == 0) { if (is_custom_sprite && show_restricted && style == 0 && _settings_client.gui.show_restricted_signal_recolour &&
_settings_client.gui.show_all_signal_default == SSDM_RESTRICTED_RECOLOUR && !result.restricted_valid && variant == SIG_ELECTRIC) {
/* Use duplicate sprite block, instead of GRF-specified signals */ /* 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, PAL_NONE }; sprite = { (type == SIGTYPE_NORMAL && variant == SIG_ELECTRIC) ? SPR_DUP_ORIGINAL_SIGNALS_BASE : SPR_DUP_SIGNALS_BASE - 16, PAL_NONE };
sprite.sprite += type * 16 + variant * 64 + position * 2 + is_green + (IsSignalSpritePBS(type) ? 64 : 0); sprite.sprite += type * 16 + variant * 64 + position * 2 + is_green + (IsSignalSpritePBS(type) ? 64 : 0);
is_custom_sprite = false; is_custom_sprite = false;
} }
if (!is_custom_sprite && show_restricted && variant == SIG_ELECTRIC) { if (!is_custom_sprite && show_restricted && variant == SIG_ELECTRIC && _settings_client.gui.show_restricted_signal_recolour) {
extern void DrawRestrictedSignal(SignalType type, SpriteID sprite, int x, int y, int z, int dz, int bb_offset_z); extern void DrawRestrictedSignal(SignalType type, SpriteID sprite, int x, int y, int z, int dz, int bb_offset_z);
DrawRestrictedSignal(type, sprite.sprite, x, y, z, TILE_HEIGHT, BB_Z_SEPARATOR); DrawRestrictedSignal(type, sprite.sprite, x, y, z, TILE_HEIGHT, BB_Z_SEPARATOR);
} else { } else {
@ -1899,11 +1900,11 @@ static void DrawBridgeSignalOnMiddlePart(const TileInfo *ti, TileIndex bridge_st
if (variant == SIG_ELECTRIC) { if (variant == SIG_ELECTRIC) {
/* Normal electric signals are picked from original sprites. */ /* Normal electric signals are picked from original sprites. */
sprite.sprite = SPR_ORIGINAL_SIGNALS_BASE + (position << 1) + (state == SIGNAL_STATE_GREEN ? 1 : 0); sprite.sprite = SPR_ORIGINAL_SIGNALS_BASE + (position << 1) + (state == SIGNAL_STATE_GREEN ? 1 : 0);
if (_settings_client.gui.show_all_signal_default) sprite.sprite += SPR_DUP_ORIGINAL_SIGNALS_BASE - SPR_ORIGINAL_SIGNALS_BASE; if (_settings_client.gui.show_all_signal_default == SSDM_ON) sprite.sprite += SPR_DUP_ORIGINAL_SIGNALS_BASE - SPR_ORIGINAL_SIGNALS_BASE;
} else { } else {
/* All other signals are picked from add on sprites. */ /* All other signals are picked from add on sprites. */
sprite.sprite = SPR_SIGNALS_BASE + (variant * 64) + (position << 1) - 16 + (state == SIGNAL_STATE_GREEN ? 1 : 0); sprite.sprite = SPR_SIGNALS_BASE + (variant * 64) + (position << 1) - 16 + (state == SIGNAL_STATE_GREEN ? 1 : 0);
if (_settings_client.gui.show_all_signal_default) sprite.sprite += SPR_DUP_SIGNALS_BASE - SPR_SIGNALS_BASE; if (_settings_client.gui.show_all_signal_default == SSDM_ON) sprite.sprite += SPR_DUP_SIGNALS_BASE - SPR_SIGNALS_BASE;
} }
sprite.pal = PAL_NONE; sprite.pal = PAL_NONE;
} }