This commit is contained in:
Nicolás Badano 2015-02-02 21:13:31 -03:00
parent 96b7c0d30c
commit 0600a72147
4 changed files with 36 additions and 41 deletions

View File

@ -165,9 +165,8 @@ PREP(hashListSelect);
PREP(hashListSet);
PREP(hashListPush);
// Load settings
if (isServer) {}
if (isServer) then {
call FUNC(loadSettingsOnServer);
};

View File

@ -20,11 +20,7 @@ _countOptions = count (configFile >> "ACE_Settings");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (configFile >> "ACE_Settings") select _index;
_name = configName _optionEntry;
_valueEntry = _optionEntry >> "value";
_typeEntry = _optionEntry >> "typeName";
[_name, _valueEntry, _typeEntry] call FUNC(setSettingFromConfig);
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {
@ -36,10 +32,10 @@ if (GVAR(forceAllSettings)) then {
} forEach GVAR(settingsList);
};
// Load settings from server userconfig
DFUNC(common,serverUserConfig) = compile preprocessFileLineNumbers "\userconfig\ACE\ACE_Settings.hpp";
if !(isNil QFUNC(common,serverUserConfig)) then {
// 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);
};
// Check if all settings should be forced
@ -51,17 +47,14 @@ if (GVAR(forceAllSettings)) then {
};
} forEach GVAR(settingsList);
};
};
// Load settings from mission config
_countOptions = count (missionConfigFile >> "ACE_Settings");
for "_index" from 0 to (_countOptions - 1) do {
_optionEntry = (missionConfigFile >> "ACE_Settings") select _index;
_name = configName _optionEntry;
_valueEntry = _optionEntry >> "value";
[_name, _valueEntry] call FUNC(setSettingFromConfig);
[_optionEntry] call FUNC(setSettingFromConfig);
};
// Check if all settings should be forced
if (GVAR(forceAllSettings)) then {

View File

@ -3,8 +3,7 @@
* Load a setting from config if it was not previosuly forced. Force if neccesary.
*
* Arguments:
* 0: Setting name (String)
* 1: Config entry (config entry)
* 0: Config entry (config entry)
*
* Return Value:
* None
@ -13,33 +12,35 @@
*/
#include "script_component.hpp"
EXPLODE_2_PVT(_this,_name,_optionEntry);
EXPLODE_1_PVT(_this,_optionEntry);
_fnc_getValueWithType = {
EXPLODE_2_PVT(_this,_optionEntry,_typeName);
_value = getNumber (_optionEntry >> "value");
diag_log text format ["%1 %2: %3", configName _optionEntry, _typeName, _value];
if (_typeName == "BOOL") exitWith {
_value = _value > 0;
_value > 0
};
if (_typeName == "STRING") exitWith {
_value = getText (_optionEntry >> "value");
getText (_optionEntry >> "value")
};
if (_typeName == "ARRAY") exitWith {
_value = getArray (_optionEntry >> "value");
getArray (_optionEntry >> "value")
};
_value
};
_name = configName _optionEntry;
// Check if the variable is already defined
if (isNil _name) exitWith {
if (isNil _name) then {
// That setting was not loaded yet
//diag_log text format ["[ACE]: Mission setting '%1' doesn't exist", _name];
_typeEntry = _this select 2;
_typeName = getText _typeEntry;
// Get type from config
_typeName = getText (_optionEntry >> "typeName");
// Read entry and cast it to the correct type
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
// Init the variable and publish it
@ -61,7 +62,9 @@ if (isNil _name) exitWith {
// The setting is not forced, so update the value
// Get the type from the existing variable
_typeName = typeName missionNamespace getVariable _name;
_typeName = typeName (missionNamespace getVariable _name);
// Read entry and cast it to the correct type
_value = [_optionEntry, _typeName] call _fnc_getValueWithType;
// Update the variable and publish it

View File

@ -25,7 +25,7 @@ GVAR(newStrength) = GVAR(newStrength) max _strength;
if (missionNamespace getVariable [QGVAR(isEarRingingPlaying), false]) exitWith {};
if (QGVAR(DisableEarRinging)) exitWith {};
if (GVAR(DisableEarRinging)) exitWith {};
if (_strength > 0.75) exitWith {
playSound "ACE_EarRinging_Heavy";