2015-01-21 11:43:58 +00:00
|
|
|
/**
|
2015-01-21 22:27:53 +00:00
|
|
|
* fnc_loadFromProfile.sqf
|
|
|
|
* @Descr: N/A
|
|
|
|
* @Author: Glowbal
|
|
|
|
*
|
|
|
|
* @Arguments: []
|
|
|
|
* @Return:
|
|
|
|
* @PublicAPI: false
|
|
|
|
*/
|
2015-01-21 11:43:58 +00:00
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-01-21 22:27:53 +00:00
|
|
|
private ["_typeString", "_settingValue", "_badData"];
|
2015-01-21 11:43:58 +00:00
|
|
|
PARAMS_3(_type,_name,_default);
|
|
|
|
|
|
|
|
_typeString = "";
|
|
|
|
switch (_type) do {
|
|
|
|
case (MENU_TAB_OPTIONS): {_typeString = "option";};
|
|
|
|
case (MENU_TAB_COLORS): {_typeString = "color";};
|
|
|
|
};
|
|
|
|
|
|
|
|
_settingValue = profileNamespace getvariable [(format ["ace_%1_%2", _typeString, _name]), _default];
|
|
|
|
|
|
|
|
_badData = isNil "_settingValue";
|
|
|
|
if (!_badData) then {
|
2015-01-21 22:27:53 +00:00
|
|
|
switch (_type) do {
|
|
|
|
case (MENU_TAB_OPTIONS): {_badData = ((typeName _settingValue) != (typeName 0));};
|
|
|
|
case (MENU_TAB_COLORS): {_badData = (((typeName _settingValue) != (typeName [])) || {(count _settingValue) != 4});};
|
|
|
|
};
|
2015-01-21 11:43:58 +00:00
|
|
|
};
|
|
|
|
if (_badData) then {
|
|
|
|
_settingValue = _default;
|
2015-01-21 22:00:54 +00:00
|
|
|
systemChat format ["Bad Data in profile [ace_%1_%2] using default", _typeString, _name];
|
2015-01-21 11:43:58 +00:00
|
|
|
ERROR("Bad Value in profile");
|
|
|
|
};
|
|
|
|
|
|
|
|
_settingValue
|