2015-02-03 00:14:16 +00:00
|
|
|
/*
|
2015-03-24 04:18:00 +00:00
|
|
|
* Author: esteldunedain
|
2015-02-03 03:43:23 +00:00
|
|
|
* Load the user setable settings from the user profile.
|
2015-02-03 00:14:16 +00:00
|
|
|
* Config < Server UserConfig < Mission Config < Client settings
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2015-04-18 18:06:01 +00:00
|
|
|
private ["_name", "_isClientSetable", "_isForced", "_profileValue"];
|
2015-04-18 17:59:41 +00:00
|
|
|
|
2015-02-03 03:43:23 +00:00
|
|
|
// Iterate through settings
|
|
|
|
{
|
|
|
|
_name = _x select 0;
|
|
|
|
_isClientSetable = _x select 2;
|
|
|
|
_isForced = _x select 6;
|
2015-02-03 00:14:16 +00:00
|
|
|
|
2015-02-03 03:43:23 +00:00
|
|
|
// If setting is user setable
|
|
|
|
if (_isClientSetable) then {
|
|
|
|
// If setting is not forced
|
|
|
|
if !(_isForced) then {
|
2015-02-03 00:14:16 +00:00
|
|
|
_profileValue = profileNamespace getvariable _name;
|
2015-02-03 03:43:23 +00:00
|
|
|
// If the setting is stored on the profile
|
2015-02-03 19:49:40 +00:00
|
|
|
if !(isNil "_profileValue") then {
|
2015-02-03 03:43:23 +00:00
|
|
|
// If the profile variable has the correct type
|
2015-02-03 00:14:16 +00:00
|
|
|
if (typeName _profileValue == typeName (missionNamespace getvariable _name)) then {
|
2015-02-03 03:43:23 +00:00
|
|
|
// Load the setting from the profile
|
2015-02-03 00:14:16 +00:00
|
|
|
missionNamespace setvariable [_name, _profileValue];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2015-04-18 17:59:41 +00:00
|
|
|
|
2015-02-03 03:43:23 +00:00
|
|
|
} forEach GVAR(settings);
|