From 7a091215e1f2e316cfce51eda87a5382138a366e Mon Sep 17 00:00:00 2001 From: Glowbal Date: Fri, 27 Mar 2015 16:26:18 +0100 Subject: [PATCH] Draft #188 --- .../functions/fnc_loadSettingsOnServer.sqf | 56 ++++++------------- 1 file changed, 18 insertions(+), 38 deletions(-) diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index 2548c44bec..96e025cff7 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -15,52 +15,32 @@ GVAR(settings) = []; -// Load settings from main config -_countOptions = count (configFile >> "ACE_Settings"); -for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (configFile >> "ACE_Settings") select _index; +_parseConfigForSettings = { + private ["_config", "_countOptions", "_optionEntry", "_index"]; - [_optionEntry] call FUNC(setSettingFromConfig); -}; -// Check if all settings should be forced -if (GVAR(forceAllSettings)) then { - { - _x set [6, true]; - } forEach GVAR(settings); -}; - -// @todo -// Load settings from server userconfig only if the ACE_ServerSettings is loaded -/*if (isClass (configFile >> "CfgPatches" >> "ACE_ServerSettings")) then { - DFUNC(serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp"; - if !(isNil DFUNC(serverUserConfig)) then { - [] call FUNC(serverUserConfig); + _config = _this select 0; + _countOptions = count _config; + for "_index" from 0 to (_countOptions - 1) do { + _optionEntry = _config select _index; + [_optionEntry] call FUNC(setSettingFromConfig); }; // Check if all settings should be forced if (GVAR(forceAllSettings)) then { { - if !(missionNamespace getVariable format ["%1_forced", _x]) then { - missionNamespace setVariable format ["%1_forced", _x, true]; - publicVariable format ["%1_forced", _name]; - }; - } forEach GVAR(settingsList); + _x set [6, true]; + } forEach GVAR(settings); }; -};*/ - -// Load settings from mission config -_countOptions = count (missionConfigFile >> "ACE_Settings"); -for "_index" from 0 to (_countOptions - 1) do { - _optionEntry = (missionConfigFile >> "ACE_Settings") select _index; - - [_optionEntry] call FUNC(setSettingFromConfig); -}; -// Check if all settings should be forced -if (GVAR(forceAllSettings)) then { - { - _x set [6, true]; - } forEach GVAR(settings); }; +// Server config +[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings; + +// Regular config +[configFile >> "ACE_Settings"] call _parseConfigForSettings; + +// mission side settings +[missionConfigFile >> "ACE_Settings"] call _parseConfigForSettings; + // Publish all settings data publicVariable QGVAR(settings); // Publish all setting values