fix in setsettings

This commit is contained in:
Nicolás Badano 2015-02-03 15:46:33 -03:00
parent 74d0ae95ff
commit b119d5246b

View File

@ -36,13 +36,22 @@ if (count _settingData == 0) exitWith {};
if (_settingData select 6) exitWith {}; if (_settingData select 6) exitWith {};
// If the type is not equal, try to cast it // If the type is not equal, try to cast it
_failed = false;
if ((typeName _value) != (_settingData select 1)) then { if ((typeName _value) != (_settingData select 1)) then {
_failed = True; _failed = true;
if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") exitWith { diag_log (typeName _value);
_value = _value > 0; if ((_settingData select 1) == "BOOL" and (typeName _value) == "SCALAR") then {
_failed = false; // If value is not 0 or 1 consider it invalid and don't set anything
if (_value == 0) then {
_value = false;
_failed = false;
};
if (_value == 1) then {
_value = true;
_failed = false;
};
}; };
if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") exitWith { if ((_settingData select 1) == "COLOR" and (typeName _value) == "ARRAY") then {
_failed = false; _failed = false;
}; };
}; };