ACE_Settings: various fixes

This commit is contained in:
Nicolás Badano 2015-02-03 02:37:13 -03:00
parent 2c0d2013d4
commit 658f30b9a2
4 changed files with 11 additions and 8 deletions

View File

@ -13,7 +13,7 @@ call FUNC(loadSettingsFromProfile);
_force = _this select 2; _force = _this select 2;
if (_force) then { if (_force) then {
_settingData = [_name] call FUNC(getSettingData); _settingData = [_name] call FUNC(getSettingData);
if (isNull _settingData) exitWith {}; if (count _settingData == 0) exitWith {};
_settingData set [6,_force]; _settingData set [6,_force];
}; };
}] call FUNC(addEventhandler); }] call FUNC(addEventhandler);

View File

@ -22,7 +22,8 @@
EXPLODE_1_PVT(_this,_name); EXPLODE_1_PVT(_this,_name);
_value = objNull; private ["_value"];
_value = [];
{ {
if ((_x select 0) == _name) exitWith {_value = _x}; if ((_x select 0) == _name) exitWith {_value = _x};
} forEach GVAR(settings); } forEach GVAR(settings);

View File

@ -17,9 +17,11 @@
*/ */
#include "script_component.hpp" #include "script_component.hpp"
EXPLODE_2_PVT(_this,_name,_value); private ["_name","_value"];
_name = _this select 0;
_value = _this select 1;
private ["force"]; private ["_force"];
_force = false; _force = false;
if (count _this > 2) then { if (count _this > 2) then {
_force = _this select 2; _force = _this select 2;
@ -28,13 +30,13 @@ if (count _this > 2) then {
_settingData = [_name] call FUNC(getSettingData); _settingData = [_name] call FUNC(getSettingData);
// Exit if the setting does not exist // Exit if the setting does not exist
if (isNull _settingData) exitWith {}; if (count _settingData == 0) exitWith {};
// Exit if the setting is already forced // Exit if the setting is already forced
if (_settingData select 6) exitWith {}; if (_settingData select 6) exitWith {};
// Exit if the type is not right // Exit if the type is not right
if (typeName _value != typeName (missionNamespace getVariable _name)) exitWith {}; if ((typeName _value) != typeName (missionNamespace getVariable _name)) exitWith {};
// Force it if it was required // Force it if it was required
_settingData set [6, _force]; _settingData set [6, _force];

View File

@ -13,8 +13,8 @@
GVAR(clientSideOptions) = []; GVAR(clientSideOptions) = [];
GVAR(clientSideColors) = []; GVAR(clientSideColors) = [];
{ {
// If the setting is user setable // If the setting is user setable and not forced
if (_x select 2) then { if ((_x select 2) && !(_x select 6)) then {
// Append the current value to the setting metadata // Append the current value to the setting metadata
_setting = + _x; _setting = + _x;
_setting pushBack (missionNamespace getVariable (_x select 0)); _setting pushBack (missionNamespace getVariable (_x select 0));