ACE3/addons/optionsmenu/functions/fnc_updateSetting.sqf

44 lines
958 B
Plaintext
Raw Normal View History

/**
* fnc_updateSetting.sqf
* @Descr:
* @Author: Glowbal
*
* @Arguments: []
* @Return:
* @PublicAPI: true
*/
#include "script_component.hpp"
2015-01-21 19:53:05 +00:00
private ["_changed"];
2015-01-21 22:27:53 +00:00
PARAMS_3(_type,_name,_newValue);
_changed = false;
switch (_type) do {
2015-01-21 19:53:05 +00:00
case (MENU_TAB_OPTIONS): {
2015-01-21 22:27:53 +00:00
{
if ((_x select 0) == _name) then {
if (!((_x select 4) isEqualTo _newValue)) then {
_changed = true;
_x set [4, _newValue];
};
};
} foreach GVAR(clientSideOptions);
};
2015-01-21 19:53:05 +00:00
case (MENU_TAB_COLORS): {
2015-01-21 22:27:53 +00:00
{
if (((_x select 0) == _name) && {!((_x select 3) isEqualTo _newValue)}) then {
_changed = true;
_x set [3, _newValue];
};
} foreach GVAR(clientSideColors);
};
2015-01-21 19:53:05 +00:00
};
if (_changed) then {
2015-01-21 22:27:53 +00:00
missionNameSpace setVariable [_name, _newValue];
[_type, _name] call FUNC(saveToProfile);
["SettingChanged", [_name, _newValue]] call EFUNC(common,localEvent);
TRACE_2("Variable Updated",_name,_newValue);
};