From 147cd1a5af5cec8e860757882a511a005ac87e14 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 27 Feb 2016 18:06:02 -0600 Subject: [PATCH] Hide categories that have no user settable options --- .../functions/fnc_onCategorySelectChanged.sqf | 2 +- .../optionsmenu/functions/fnc_onSettingsMenuOpen.sqf | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf b/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf index 3129e32bef..123a156731 100644 --- a/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf +++ b/addons/optionsmenu/functions/fnc_onCategorySelectChanged.sqf @@ -22,6 +22,6 @@ disableSerialization; _settingsMenu = uiNamespace getVariable 'ACE_settingsMenu'; _ctrlComboBox = (_settingsMenu displayCtrl 14); -GVAR(currentCategorySelection) = lbCurSel _ctrlComboBox; +GVAR(currentCategorySelection) = _ctrlComboBox lbValue (lbCurSel _ctrlComboBox); [true] call FUNC(settingsMenuUpdateList); diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index 104d8195cf..bef61b73e7 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -21,6 +21,7 @@ private ["_setting", "_menu"]; // Filter only user setable setting GVAR(clientSideOptions) = []; GVAR(clientSideColors) = []; +private _clientSettableCategories = [""]; { // If the setting is user setable and not forced @@ -37,6 +38,7 @@ GVAR(clientSideColors) = []; if ((_x select 1) == "COLOR") then { GVAR(clientSideColors) pushBack _setting; }; + _clientSettableCategories pushBackUnique (_x select 8); //Add to list of user-settable categories }; } forEach EGVAR(common,settings); @@ -55,10 +57,13 @@ if (GVAR(serverConfigGeneration) == 0) then { lbClear (_menu displayCtrl 14); { - if (_x == "") then { - _x = localize LSTRING(category_all); + if (_x in _clientSettableCategories) then { //only show category if it has user-settable options + if (_x == "") then { + _x = localize LSTRING(category_all); + }; + private _Index = (_menu displayCtrl 14) lbAdd _x; + (_menu displayCtrl 14) lbSetValue [_Index, _forEachIndex]; }; - (_menu displayCtrl 14) lbAdd _x; } forEach GVAR(categories); (_menu displayCtrl 14) lbSetCurSel GVAR(currentCategorySelection); //All Catagoies