Add UI setting to hide adv tracerestrict features from GUI

Hide wait at PBS and slot features.
This commit is contained in:
Jonathan G Rennison
2017-03-30 23:32:37 +01:00
parent 9d0f0967f9
commit 7dbf99fa33
6 changed files with 32 additions and 5 deletions

View File

@@ -1293,6 +1293,8 @@ STR_CONFIG_SETTING_SHOW_TRAIN_WEIGHT_RATIOS_IN_DETAILS :Show train weig
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_DEF :Show restricted electric signals using default graphics: {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_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_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_LANDSCAPE :Landscape: {STRING2} STR_CONFIG_SETTING_LANDSCAPE :Landscape: {STRING2}
STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landscapes define basic gameplay scenarios with different cargos and town growth requirements. NewGRF and Game Scripts allow finer control though STR_CONFIG_SETTING_LANDSCAPE_HELPTEXT :Landscapes define basic gameplay scenarios with different cargos and town growth requirements. NewGRF and Game Scripts allow finer control though

View File

@@ -1548,6 +1548,7 @@ static SettingsContainer &GetSettingsTree()
interface->Add(new SettingEntry("gui.timetable_arrival_departure")); interface->Add(new SettingEntry("gui.timetable_arrival_departure"));
interface->Add(new SettingEntry("gui.expenses_layout")); interface->Add(new SettingEntry("gui.expenses_layout"));
interface->Add(new SettingEntry("gui.show_train_weight_ratios_in_details")); interface->Add(new SettingEntry("gui.show_train_weight_ratios_in_details"));
interface->Add(new SettingEntry("gui.show_adv_tracerestrict_features"));
} }
SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS)); SettingsPage *advisors = main->Add(new SettingsPage(STR_CONFIG_SETTING_ADVISORS));

View File

@@ -138,6 +138,7 @@ struct GUISettings {
uint8 graph_line_thickness; ///< the thickness of the lines in the various graph guis uint8 graph_line_thickness; ///< the thickness of the lines in the various graph guis
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_restricted_signal_default; ///< Show restricted electric signals using the default sprite bool show_restricted_signal_default; ///< Show restricted electric signals using the default sprite
bool show_adv_tracerestrict_features; ///< Show advanced trace restrict features in UI
uint8 osk_activation; ///< Mouse gesture to trigger the OSK. uint8 osk_activation; ///< Mouse gesture to trigger the OSK.
uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity. uint16 console_backlog_timeout; ///< the minimum amount of time items should be in the console backlog before they will be removed in ~3 seconds granularity.

View File

@@ -3160,6 +3160,15 @@ str = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF
strhelp = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT strhelp = STR_CONFIG_SETTING_SHOW_RESTRICTED_SIG_DEF_HELPTEXT
proc = RedrawScreen proc = RedrawScreen
[SDTC_BOOL]
var = gui.show_adv_tracerestrict_features
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
def = false
str = STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES
strhelp = STR_CONFIG_SETTING_SHOW_ADV_TRACE_RESTRICT_FEATURES_HELPTEXT
proc = RedrawScreen
cat = SC_EXPERT
; For the dedicated build we'll enable dates in logs by default. ; For the dedicated build we'll enable dates in logs by default.
[SDTC_BOOL] [SDTC_BOOL]
ifdef = DEDICATED ifdef = DEDICATED

View File

@@ -141,6 +141,8 @@ static const StringID _program_insert_str[] = {
static const uint32 _program_insert_else_hide_mask = 8; ///< disable bitmask for else static const uint32 _program_insert_else_hide_mask = 8; ///< disable bitmask for else
static const uint32 _program_insert_or_if_hide_mask = 4; ///< disable bitmask for orif static const uint32 _program_insert_or_if_hide_mask = 4; ///< disable bitmask for orif
static const uint32 _program_insert_else_if_hide_mask = 2; ///< disable bitmask for elif static const uint32 _program_insert_else_if_hide_mask = 2; ///< disable bitmask for elif
static const uint32 _program_wait_pbs_hide_mask = 0x100; ///< disable bitmask for wait at PBS
static const uint32 _program_slot_hide_mask = 0x200; ///< disable bitmask for slot
static const uint _program_insert_val[] = { static const uint _program_insert_val[] = {
TRIT_COND_UNDEFINED, // if block TRIT_COND_UNDEFINED, // if block
TRIT_COND_UNDEFINED | (TRCF_ELSE << 16), // elif block TRIT_COND_UNDEFINED | (TRCF_ELSE << 16), // elif block
@@ -289,7 +291,7 @@ static TraceRestrictItemType ItemTypeFromGuiType(TraceRestrictGuiItemType type)
/** /**
* Return the appropriate type dropdown TraceRestrictDropDownListSet for the given item type @p type * Return the appropriate type dropdown TraceRestrictDropDownListSet for the given item type @p type
*/ */
static const TraceRestrictDropDownListSet *GetTypeDropDownListSet(TraceRestrictGuiItemType type) static const TraceRestrictDropDownListSet *GetTypeDropDownListSet(TraceRestrictGuiItemType type, uint32 *hide_mask = nullptr)
{ {
static const StringID str_action[] = { static const StringID str_action[] = {
STR_TRACE_RESTRICT_PF_DENY, STR_TRACE_RESTRICT_PF_DENY,
@@ -353,7 +355,15 @@ static const TraceRestrictDropDownListSet *GetTypeDropDownListSet(TraceRestrictG
str_cond, val_cond, str_cond, val_cond,
}; };
return IsTraceRestrictTypeConditional(ItemTypeFromGuiType(type)) ? &set_cond : &set_action; bool is_conditional = IsTraceRestrictTypeConditional(ItemTypeFromGuiType(type));
if (hide_mask) {
if (_settings_client.gui.show_adv_tracerestrict_features) {
*hide_mask = 0;
} else {
*hide_mask = is_conditional ? 0x4000 : 0x30;
}
}
return is_conditional ? &set_cond : &set_action;
} }
/** /**
@@ -1111,6 +1121,7 @@ public:
} }
uint32 disabled = _program_insert_or_if_hide_mask; uint32 disabled = _program_insert_or_if_hide_mask;
uint32 hidden = 0;
TraceRestrictItem item = this->GetSelected(); TraceRestrictItem item = this->GetSelected();
if (GetTraceRestrictType(item) == TRIT_COND_ENDIF || if (GetTraceRestrictType(item) == TRIT_COND_ENDIF ||
(IsTraceRestrictConditional(item) && GetTraceRestrictCondFlags(item) != 0)) { (IsTraceRestrictConditional(item) && GetTraceRestrictCondFlags(item) != 0)) {
@@ -1131,8 +1142,9 @@ public:
if (ElseIfInsertionDryRun(false)) disabled &= ~_program_insert_or_if_hide_mask; if (ElseIfInsertionDryRun(false)) disabled &= ~_program_insert_or_if_hide_mask;
} }
} }
if (!_settings_client.gui.show_adv_tracerestrict_features) hidden |= _program_slot_hide_mask | _program_wait_pbs_hide_mask;
this->ShowDropDownListWithValue(&_program_insert, 0, true, TR_WIDGET_INSERT, disabled, 0, 0); this->ShowDropDownListWithValue(&_program_insert, 0, true, TR_WIDGET_INSERT, disabled, hidden, 0);
break; break;
} }
@@ -1197,7 +1209,9 @@ public:
TraceRestrictGuiItemType type = GetItemGuiType(item); TraceRestrictGuiItemType type = GetItemGuiType(item);
if (type != TRIT_NULL) { if (type != TRIT_NULL) {
this->ShowDropDownListWithValue(GetTypeDropDownListSet(type), type, false, widget, 0, 0, 0); uint32 hide_mask = 0;
const TraceRestrictDropDownListSet *set = GetTypeDropDownListSet(type, &hide_mask);
this->ShowDropDownListWithValue(set, type, false, widget, 0, hide_mask, 0);
} }
break; break;
} }

View File

@@ -179,7 +179,7 @@ DropDownList *BaseVehicleListWindow::BuildActionDropdownList(bool show_autorepla
*list->Append() = new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED, false); *list->Append() = new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, ADI_ADD_SHARED, false);
*list->Append() = new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL, false); *list->Append() = new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, ADI_REMOVE_ALL, false);
} }
if (this->vli.vtype == VEH_TRAIN) { if (this->vli.vtype == VEH_TRAIN && _settings_client.gui.show_adv_tracerestrict_features) {
*list->Append() = new DropDownListStringItem(STR_TRACE_RESTRICT_SLOT_MANAGE, ADI_TRACERESTRICT_SLOT_MGMT, false); *list->Append() = new DropDownListStringItem(STR_TRACE_RESTRICT_SLOT_MANAGE, ADI_TRACERESTRICT_SLOT_MGMT, false);
} }