From 202904f1f99683bf8df0cf65bc0c5bfa6c86e13f Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 5 Apr 2015 10:32:40 +0200 Subject: [PATCH 1/5] Using 1 and 0 instead of true and false for config export --- addons/optionsmenu/functions/fnc_exportSettings.sqf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index 8718698a18..de97a9065c 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -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; From 279641787de443142159ed0c13dcb3efa0733fe3 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 5 Apr 2015 11:11:54 +0200 Subject: [PATCH 2/5] Added checks for enforce usage only in SP with settings enabled --- addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf | 2 ++ addons/optionsmenu/functions/fnc_updateSetting.sqf | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf index b419e25b32..dcdffe9b64 100644 --- a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf @@ -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) = []; diff --git a/addons/optionsmenu/functions/fnc_updateSetting.sqf b/addons/optionsmenu/functions/fnc_updateSetting.sqf index d1a7825671..3fe1682614 100644 --- a/addons/optionsmenu/functions/fnc_updateSetting.sqf +++ b/addons/optionsmenu/functions/fnc_updateSetting.sqf @@ -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); From f1a3d588ba7eac9251e59f1d63446df7a9ee7732 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 5 Apr 2015 12:38:10 +0200 Subject: [PATCH 3/5] Changed initialization order of config settings. 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 --- addons/common/functions/fnc_loadSettingsOnServer.sqf | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/common/functions/fnc_loadSettingsOnServer.sqf b/addons/common/functions/fnc_loadSettingsOnServer.sqf index 96e025cff7..9255d047b3 100644 --- a/addons/common/functions/fnc_loadSettingsOnServer.sqf +++ b/addons/common/functions/fnc_loadSettingsOnServer.sqf @@ -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; From bae3826bdf3a9ba27f33da5373e9ab90520bdc6a Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 5 Apr 2015 14:48:23 +0200 Subject: [PATCH 4/5] Polished server config export --- addons/optionsmenu/functions/fnc_exportSettings.sqf | 2 ++ .../functions/fnc_onServerSettingsMenuOpen.sqf | 5 +++++ .../functions/fnc_toggleIncludeClientSettings.sqf | 9 --------- addons/optionsmenu/stringtable.xml | 3 +++ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/addons/optionsmenu/functions/fnc_exportSettings.sqf b/addons/optionsmenu/functions/fnc_exportSettings.sqf index de97a9065c..9ef736ac1c 100644 --- a/addons/optionsmenu/functions/fnc_exportSettings.sqf +++ b/addons/optionsmenu/functions/fnc_exportSettings.sqf @@ -57,3 +57,5 @@ class %1 { } forEach EGVAR(common,settings); copyToClipboard format["%1",_compiledConfig]; + +["STR_ACE_OptionsMenu_settingsExported"] call EFUNC(common,displayTextStructured); diff --git a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf index dcdffe9b64..7894d2ff1a 100644 --- a/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf +++ b/addons/optionsmenu/functions/fnc_onServerSettingsMenuOpen.sqf @@ -59,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"); +}; diff --git a/addons/optionsmenu/functions/fnc_toggleIncludeClientSettings.sqf b/addons/optionsmenu/functions/fnc_toggleIncludeClientSettings.sqf index 5713bf98e4..8fd52d8d72 100644 --- a/addons/optionsmenu/functions/fnc_toggleIncludeClientSettings.sqf +++ b/addons/optionsmenu/functions/fnc_toggleIncludeClientSettings.sqf @@ -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); diff --git a/addons/optionsmenu/stringtable.xml b/addons/optionsmenu/stringtable.xml index 4a8c574755..76407da435 100644 --- a/addons/optionsmenu/stringtable.xml +++ b/addons/optionsmenu/stringtable.xml @@ -100,5 +100,8 @@ Exclude Client Settings + + Settings exported to clipboard + \ No newline at end of file From c514fde5d350f76740fa9df9bf8150881c4ff233 Mon Sep 17 00:00:00 2001 From: Glowbal Date: Sun, 5 Apr 2015 15:13:34 +0200 Subject: [PATCH 5/5] Not necessary here. Makes it only work once. --- addons/optionsmenu/gui/settingsMenu.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/optionsmenu/gui/settingsMenu.hpp b/addons/optionsmenu/gui/settingsMenu.hpp index d5c8eeeb84..93d35b284c 100644 --- a/addons/optionsmenu/gui/settingsMenu.hpp +++ b/addons/optionsmenu/gui/settingsMenu.hpp @@ -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;