2015-01-30 21:56:45 +00:00
/*
2015-03-24 04:18:00 +00:00
* Author: esteldunedain
2015-01-30 21:56:45 +00:00
* Load the parameters on the server.
* Config < Server UserConfig < Mission Config
*
* Arguments:
* None
*
* Return Value:
* None
*
* Public: No
*/
#include "script_component.hpp"
2015-02-03 03:43:23 +00:00
GVAR(settings) = [];
2015-01-30 21:56:45 +00:00
2015-03-27 15:26:18 +00:00
_parseConfigForSettings = {
private ["_config", "_countOptions", "_optionEntry", "_index"];
2015-01-30 21:56:45 +00:00
2015-03-27 15:26:18 +00:00
_config = _this select 0;
_countOptions = count _config;
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = _config select _index;
[_optionEntry] call FUNC(setSettingFromConfig);
2015-02-03 00:13:31 +00:00
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
{
2015-03-27 15:26:18 +00:00
_x set [6, true];
} forEach GVAR(settings);
2015-02-03 00:13:31 +00:00
};
2015-03-27 15:26:18 +00:00
};
2015-01-30 21:56:45 +00:00
2015-04-05 10:38:10 +00:00
// Order is this way because:
// ACE_Settings should never force any setting by default. Loading it first ensures that all settings from ACE_Settings exist.
// This way, ACE_ServerSettings will override ACE_Settings, even if no force is used.
// Mission settings will override the server config settings, if no force is used.
// This ensures that all settings are of their correct type, in case an outdated or corrupt server config is used , as well as have their correct localized display name and description
2015-01-30 21:56:45 +00:00
2015-03-27 15:26:18 +00:00
// Regular config
[configFile >> "ACE_Settings"] call _parseConfigForSettings;
2015-04-05 10:38:10 +00:00
// Server config
[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings;
2015-03-27 15:26:18 +00:00
// mission side settings
[missionConfigFile >> "ACE_Settings"] call _parseConfigForSettings;
2015-02-03 03:43:23 +00:00
// Publish all settings data
publicVariable QGVAR(settings);
// Publish all setting values
{
publicVariable (_x select 0);
} forEach GVAR(settings);