From 857b45453a126f045fc01babeb8c207a51ba3371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Badano?= Date: Tue, 3 Feb 2015 01:03:26 -0300 Subject: [PATCH] ACE_Settings: fix option to reset user setable settings to default --- addons/common/functions/fnc_getSettingData.sqf | 1 + addons/common/functions/fnc_setSettingFromConfig.sqf | 6 ++++-- addons/optionsmenu/functions/fnc_resetSettings.sqf | 4 ++-- .../functions/fnc_settingsMenuUpdateKeyView.sqf | 4 ++-- .../functions/fnc_settingsMenuUpdateList.sqf | 6 +++--- addons/optionsmenu/functions/fnc_updateSetting.sqf | 10 +++++----- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/addons/common/functions/fnc_getSettingData.sqf b/addons/common/functions/fnc_getSettingData.sqf index f8572c5f42..5b0c1c96ea 100644 --- a/addons/common/functions/fnc_getSettingData.sqf +++ b/addons/common/functions/fnc_getSettingData.sqf @@ -14,6 +14,7 @@ * 4: _localizedDescription * 5: _possibleValues * 6: _isForced + * 7: _defaultValue * * Public: No */ diff --git a/addons/common/functions/fnc_setSettingFromConfig.sqf b/addons/common/functions/fnc_setSettingFromConfig.sqf index a6b46f45c4..f87249786f 100644 --- a/addons/common/functions/fnc_setSettingFromConfig.sqf +++ b/addons/common/functions/fnc_setSettingFromConfig.sqf @@ -61,7 +61,8 @@ if (isNil _name) then { _localizedName, _localizedDescription, _possibleValues, - _isForced + _isForced, + _defaultValue ];*/ _settingData = [ _name, @@ -70,7 +71,8 @@ if (isNil _name) then { getText (_optionEntry >> "displayName"), getText (_optionEntry >> "description"), getArray (_optionEntry >> "values"), - getNumber (_optionEntry >> "force") > 0 + getNumber (_optionEntry >> "force") > 0, + _value ]; GVAR(settings) pushBack _settingData; diff --git a/addons/optionsmenu/functions/fnc_resetSettings.sqf b/addons/optionsmenu/functions/fnc_resetSettings.sqf index bdc5c7662a..dd4b951ef5 100644 --- a/addons/optionsmenu/functions/fnc_resetSettings.sqf +++ b/addons/optionsmenu/functions/fnc_resetSettings.sqf @@ -13,13 +13,13 @@ private ["_name", "_default", "_lastSelected"]; { _name = _x select 0; - _default = _x select 5; + _default = _x select 7; [MENU_TAB_OPTIONS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideOptions); { _name = _x select 0; - _default = _x select 4; + _default = _x select 7; [MENU_TAB_COLORS, _name, _default] call FUNC(updateSetting); } forEach GVAR(clientSideColors); diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf index 23b9ed9523..c271ecd176 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateKeyView.sqf @@ -44,7 +44,7 @@ if (count _collection > 0) then { switch (GVAR(optionMenu_openTab)) do { case (MENU_TAB_OPTIONS): { _possibleValues = _setting select 5; - _settingsValue = _setting select 7; + _settingsValue = _setting select 8; // Created disable/enable options for bools if ((_setting select 1) == "BOOL") then { @@ -59,7 +59,7 @@ if (count _collection > 0) then { (_settingsMenu displayCtrl 400) lbSetCurSel _settingsValue; }; case (MENU_TAB_COLORS): { - _currentColor = _setting select 7; + _currentColor = _setting select 8; { sliderSetPosition [_x, (255 * (_currentColor select _forEachIndex))]; } forEach [410, 411, 412, 413]; diff --git a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf index 78b5113203..73a6d3de3b 100644 --- a/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf +++ b/addons/optionsmenu/functions/fnc_settingsMenuUpdateList.sqf @@ -23,7 +23,7 @@ case (MENU_TAB_OPTIONS): { { _ctrlList lbadd (_x select 3); - _settingsValue = _x select 7; + _settingsValue = _x select 8; // Created disable/enable options for bools _settingsText = if ((_x select 1) == "BOOL") then { @@ -37,14 +37,14 @@ case (MENU_TAB_OPTIONS): { }; case (MENU_TAB_COLORS): { { - _color = +(_x select 7); + _color = +(_x select 8); { _color set [_forEachIndex, ((round (_x * 100))/100)]; } forEach _color; _settingsColor = str _color; _ctrlList lbadd (_x select 3); _ctrlList lbadd (_settingsColor); - _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 7)]; + _ctrlList lnbSetColor [[_forEachIndex, 1], (_x select 8)]; }foreach GVAR(clientSideColors); }; }; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index 270d39f540..4691ff8e67 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -23,9 +23,9 @@ case (MENU_TAB_OPTIONS): { _newValue = [false, true] select _newValue; }; - if !((_x select 7) isEqualTo _newValue) then { + if !((_x select 8) isEqualTo _newValue) then { _changed = true; - _x set [7, _newValue]; + _x set [8, _newValue]; } ; }; @@ -33,16 +33,16 @@ case (MENU_TAB_OPTIONS): { }; case (MENU_TAB_COLORS): { { - if (((_x select 0) == _name) && {!((_x select 7) isEqualTo _newValue)}) then { + if (((_x select 0) == _name) && {!((_x select 8) isEqualTo _newValue)}) then { _changed = true; - _x set [7, _newValue]; + _x set [8, _newValue]; }; } foreach GVAR(clientSideColors); }; }; if (_changed) then { - profileNamespace setvariable [_name, _newValue]; + profileNamespace setVariable [_name, _newValue]; missionNameSpace setVariable [_name, _newValue]; ["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent); TRACE_2("Variable Updated",_name,_newValue);