Merge branch 'serverConfig' of github.com:KoffeinFlummi/ACE3 into serverConfig

This commit is contained in:
jaynus 2015-04-05 14:08:54 -07:00
commit 8fa6ab38fd
7 changed files with 28 additions and 15 deletions

View File

@ -32,12 +32,18 @@ _parseConfigForSettings = {
};
};
// Server config
[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings;
// 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
// Regular config
[configFile >> "ACE_Settings"] call _parseConfigForSettings;
// Server config
[configFile >> "ACE_ServerSettings"] call _parseConfigForSettings;
// mission side settings
[missionConfigFile >> "ACE_Settings"] call _parseConfigForSettings;

View File

@ -43,7 +43,9 @@ _compiledConfig = "
if (_typeName == "STRING") then { // I dont think we have string values, but just in case
_value = format['"%1"', _value];
};
if (_typeName == "BOOL") then {
_value = if (typeOf _value == "BOOL" && {_value}) then {1} else {0};
};
_compiledConfigEntry = format ["
class %1 {
value = %2;
@ -55,3 +57,5 @@ class %1 {
} forEach EGVAR(common,settings);
copyToClipboard format["%1",_compiledConfig];
["STR_ACE_OptionsMenu_settingsExported"] call EFUNC(common,displayTextStructured);

View File

@ -16,6 +16,8 @@
#include "script_component.hpp"
if (GVAR(serverConfigGeneration) == 0 || isMultiplayer) exitwith {closeDialog 145246;};
// Filter only user setable setting
GVAR(serverSideOptions) = [];
GVAR(serverSideColors) = [];
@ -57,3 +59,8 @@ disableSerialization;
_menu = uiNamespace getvariable "ACE_serverSettingsMenu";
(_menu displayCtrl 1003) ctrlEnable false;
if (GVAR(ClientSettingsExportIncluded)) then {
(_settingsMenu displayCtrl 1102) ctrlSetText localize ("STR_ACE_OptionsMenu_exClientSettings");
} else {
(_settingsMenu displayCtrl 1102) ctrlSetText localize ("STR_ACE_OptionsMenu_inClientSettings");
};

View File

@ -15,13 +15,4 @@
GVAR(ClientSettingsExportIncluded) = !(GVAR(ClientSettingsExportIncluded));
private "_settingsMenu";
disableSerialization;
_settingsMenu = uiNamespace getVariable 'ACE_serverSettingsMenu';
if (GVAR(ClientSettingsExportIncluded)) then {
(_settingsMenu displayCtrl 1102) ctrlSetText localize ("STR_ACE_OptionsMenu_exClientSettings");
} else {
(_settingsMenu displayCtrl 1102) ctrlSetText localize ("STR_ACE_OptionsMenu_inClientSettings");
};
[] call FUNC(onServerSettingsMenuOpen);

View File

@ -84,7 +84,9 @@ switch (_type) do {
if (_changed) then {
if (GVAR(serverConfigGeneration) > 0) then {
missionNamespace setvariable [_name, _newValue];
if !(isMultiplayer) then {
missionNamespace setvariable [_name, _newValue];
};
} else {
profileNamespace setVariable [_name, _newValue];
[_name, _newValue] call EFUNC(common,setSetting);

View File

@ -237,8 +237,8 @@ class ACE_settingsMenu {
};
};
class ACE_serverSettingsMenu: ACE_settingsMenu {
onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', _this select 0)]; [] call FUNC(onServerSettingsMenuOpen); GVAR(serverConfigGeneration) = true;);
onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', nil)]; GVAR(serverConfigGeneration) = false;);
onLoad = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', _this select 0)]; [] call FUNC(onServerSettingsMenuOpen););
onUnload = QUOTE(uiNamespace setVariable [ARR_2('ACE_serverSettingsMenu', nil)];);
class controls: controls {
class HeaderName {
idc = 1;

View File

@ -100,5 +100,8 @@
<Key ID="STR_ACE_OptionsMenu_exClientSettings">
<English>Exclude Client Settings</English>
</Key>
<Key ID="STR_ACE_OptionsMenu_settingsExported">
<English>Settings exported to clipboard</English>
</Key>
</Package>
</Project>