From a3a481f96d929ff6f018d128b4c79355464050b7 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 7 Aug 2015 15:08:52 -0500 Subject: [PATCH] Some fixes --- addons/optionsmenu/XEH_postInit.sqf | 1 + .../functions/fnc_onSettingsMenuOpen.sqf | 4 +++ .../fnc_settingsMenuUpdateKeyView.sqf | 27 +++++++++---------- .../functions/fnc_settingsMenuUpdateList.sqf | 4 +-- .../functions/fnc_updateSetting.sqf | 10 +++---- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/addons/optionsmenu/XEH_postInit.sqf b/addons/optionsmenu/XEH_postInit.sqf index fdf9075b99..65e0f9fde2 100644 --- a/addons/optionsmenu/XEH_postInit.sqf +++ b/addons/optionsmenu/XEH_postInit.sqf @@ -2,6 +2,7 @@ #include "script_component.hpp" ["SettingsInitialized", { + GVAR(categories) pushback ""; //Ensure All Catagories is at top { if !(_x select 8 in GVAR(categories)) then { GVAR(categories) pushback (_x select 8); diff --git a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf index 9b6c33eda8..eaceadc56b 100644 --- a/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onSettingsMenuOpen.sqf @@ -59,3 +59,7 @@ if (GVAR(serverConfigGeneration) == 0) then { }; (_menu displayCtrl 14) lbAdd _x; } forEach GVAR(categories); + +(_menu displayCtrl 14) lbSetCurSel 0; //All Catagoies + + diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 7ed7a4e487..359f7c93af 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -28,27 +28,24 @@ _collection = switch (GVAR(optionMenu_openTab)) do { default {[]}; }; -if (count _collection > 0) then { +_selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); +_filteredCollection = []; +{ + if (_selectedCategory == "" || {_selectedCategory == (_x select 8)}) then { + _filteredCollection pushBack _x; + }; +} forEach _collection; + +if (count _filteredCollection > 0) then { _settingIndex = (lbCurSel _ctrlList); - if (_settingIndex > (count _collection)) then { - _settingIndex = count _collection - 1; + if (_settingIndex > (count _filteredCollection)) then { + _settingIndex = count _filteredCollection - 1; }; if (_settingIndex < 0) then { _settingIndex = 0; }; - diag_log format["_collection: %1", _collection]; - _setting = _collection select _settingIndex; - - _selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); - if !(_selectedCategory == "All Categories" || _selectedCategory == (_setting select 8)) exitwith { - systemChat format["INCORRECT CATEGORY: %1 != %2", _selectedCategory, _setting]; - diag_log format["INCORRECT CATEGORY: %1 != %2", _selectedCategory, _setting]; - lbClear 400; - (_settingsMenu displayCtrl 250) ctrlSetText "No settings available"; - (_settingsMenu displayCtrl 251) ctrlSetText "No settings available"; - (_settingsMenu displayCtrl 300) ctrlSetText "No settings available"; - }; + _setting = _filteredCollection select _settingIndex; _entryName = _setting select 0; _localizedName = _setting select 3; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index 5f067e45c4..b2ec6392e8 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -30,7 +30,7 @@ _selectedCategory = GVAR(categories) select GVAR(currentCategorySelection); switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { { - if (_selectedCategory == "All Categories" || _selectedCategory == (_X select 8)) then { + if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { _ctrlList lbadd (_x select 3); _settingsValue = _x select 9; @@ -46,7 +46,7 @@ switch (GVAR(optionMenu_openTab)) do { }; case (MENU_TAB_COLORS): { { - if (_selectedCategory == "All Categories" || _selectedCategory == (_X select 8)) then { + if (_selectedCategory == "" || _selectedCategory == (_X select 8)) then { _color = +(_x select 9); { _color set [_forEachIndex, ((round (_x * 100))/100)]; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 89f4a0f1a3..25fa06c604 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -34,7 +34,7 @@ switch (_type) do { if !((_x select 9) isEqualTo _newValue) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; } ; }; @@ -44,7 +44,7 @@ switch (_type) do { { if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; }; } foreach GVAR(clientSideColors); }; @@ -58,7 +58,7 @@ switch (_type) do { if !((_x select 9) isEqualTo _newValue) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; } ; }; @@ -68,7 +68,7 @@ switch (_type) do { { if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; }; } foreach GVAR(serverSideColors); }; @@ -76,7 +76,7 @@ switch (_type) do { { if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then { _changed = true; - _x set [8, _newValue]; + _x set [9, _newValue]; }; } foreach GVAR(serverSideValues); };