2015-03-06 17:15:32 +00:00
|
|
|
/*
|
|
|
|
* Author: Glowbal
|
2015-03-14 18:10:25 +00:00
|
|
|
* Updates the setting when the client has selected a new value. Saves to profilenamespace and calls setSetting.
|
2015-03-06 17:15:32 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
2015-03-14 18:10:25 +00:00
|
|
|
* 0: The Tab Open <NUMBER>
|
|
|
|
* 1: The setting's name <STRING>
|
|
|
|
* 2: The new value either an index or a color <NUMBER>OR<ARRAY>
|
2015-03-06 17:15:32 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
2015-03-14 18:10:25 +00:00
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
|
|
|
* [MENU_TAB_COLORS, "ace_fireTruckColor", [1,0,0,1]] call ACE_optionsmenu_fnc_updateSetting
|
2015-03-06 17:15:32 +00:00
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
|
2015-01-21 11:43:58 +00:00
|
|
|
#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);
|
2015-01-21 11:43:58 +00:00
|
|
|
|
|
|
|
_changed = false;
|
|
|
|
|
|
|
|
switch (_type) do {
|
2015-04-05 00:17:43 +00:00
|
|
|
case (MENU_TAB_OPTIONS): {
|
|
|
|
{
|
|
|
|
if ((_x select 0) == _name) then {
|
2015-02-03 03:44:34 +00:00
|
|
|
|
2015-04-05 00:17:43 +00:00
|
|
|
if ((_x select 1) == "BOOL") then {
|
|
|
|
_newValue = [false, true] select _newValue;
|
|
|
|
};
|
|
|
|
|
2015-08-07 19:14:45 +00:00
|
|
|
if !((_x select 9) isEqualTo _newValue) then {
|
2015-04-05 00:17:43 +00:00
|
|
|
_changed = true;
|
2015-08-07 20:09:59 +00:00
|
|
|
_x set [9, _newValue];
|
2015-04-05 00:17:43 +00:00
|
|
|
} ;
|
2015-02-03 03:44:34 +00:00
|
|
|
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(clientSideOptions);
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
|
|
|
case (MENU_TAB_COLORS): {
|
|
|
|
{
|
2015-08-07 19:14:45 +00:00
|
|
|
if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then {
|
2015-02-03 03:44:34 +00:00
|
|
|
_changed = true;
|
2015-08-07 20:09:59 +00:00
|
|
|
_x set [9, _newValue];
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(clientSideColors);
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
|
|
|
case (MENU_TAB_SERVER_OPTIONS): {
|
|
|
|
{
|
|
|
|
if ((_x select 0) == _name) then {
|
|
|
|
|
|
|
|
if ((_x select 1) == "BOOL") then {
|
|
|
|
_newValue = [false, true] select _newValue;
|
|
|
|
};
|
2015-02-03 03:44:34 +00:00
|
|
|
|
2015-08-07 19:14:45 +00:00
|
|
|
if !((_x select 9) isEqualTo _newValue) then {
|
2015-04-05 00:17:43 +00:00
|
|
|
_changed = true;
|
2015-08-07 20:09:59 +00:00
|
|
|
_x set [9, _newValue];
|
2015-04-05 00:17:43 +00:00
|
|
|
} ;
|
|
|
|
|
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(serverSideOptions);
|
2015-01-21 22:27:53 +00:00
|
|
|
};
|
2015-04-05 00:17:43 +00:00
|
|
|
case (MENU_TAB_SERVER_COLORS): {
|
|
|
|
{
|
2015-08-07 19:14:45 +00:00
|
|
|
if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then {
|
2015-04-05 00:17:43 +00:00
|
|
|
_changed = true;
|
2015-08-07 20:09:59 +00:00
|
|
|
_x set [9, _newValue];
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(serverSideColors);
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
|
|
|
case (MENU_TAB_SERVER_VALUES): {
|
|
|
|
{
|
2015-08-07 19:14:45 +00:00
|
|
|
if (((_x select 0) == _name) && {!((_x select 9) isEqualTo _newValue)}) then {
|
2015-04-05 00:17:43 +00:00
|
|
|
_changed = true;
|
2015-08-07 20:09:59 +00:00
|
|
|
_x set [9, _newValue];
|
2015-04-05 00:17:43 +00:00
|
|
|
};
|
2015-11-30 16:23:48 +00:00
|
|
|
} forEach GVAR(serverSideValues);
|
2015-01-21 22:27:53 +00:00
|
|
|
};
|
2015-01-21 19:53:05 +00:00
|
|
|
};
|
2015-01-21 11:43:58 +00:00
|
|
|
|
|
|
|
if (_changed) then {
|
2015-04-05 00:17:43 +00:00
|
|
|
if (GVAR(serverConfigGeneration) > 0) then {
|
2015-04-05 09:11:54 +00:00
|
|
|
if !(isMultiplayer) then {
|
2015-11-30 16:27:09 +00:00
|
|
|
missionNamespace setVariable [_name, _newValue];
|
2015-04-05 09:11:54 +00:00
|
|
|
};
|
2015-04-05 00:17:43 +00:00
|
|
|
} else {
|
|
|
|
profileNamespace setVariable [_name, _newValue];
|
|
|
|
[_name, _newValue] call EFUNC(common,setSetting);
|
|
|
|
};
|
2015-01-21 11:43:58 +00:00
|
|
|
};
|