From 0e491445961dc115921e0e982f94dc49504c1160 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 12 Oct 2023 02:22:12 +0200 Subject: [PATCH 01/10] Add hemtt launch config --- .hemtt/project.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.hemtt/project.toml b/.hemtt/project.toml index ed381d0e1..add2c0b16 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -1,4 +1,5 @@ name = "CBA_A3" +mainprefix = "x" prefix = "cba" author = "CBATeam" @@ -35,3 +36,5 @@ preset = "Hemtt" [hemtt.release] folder = "CBA_A3" + +[hemtt.launch.default] From 5404e3e87f935d004d06905f0b5d856b74aed34a Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 12 Oct 2023 02:26:58 +0200 Subject: [PATCH 02/10] Add config property that can make settings changes stay until restart --- addons/settings/fnc_clear.sqf | 2 +- addons/settings/fnc_init.sqf | 2 +- addons/settings/fnc_initDisplayMain.sqf | 6 ++++++ addons/settings/fnc_set.sqf | 4 ++-- addons/settings/initSettings.sqf | 3 +++ template/cba_settings_userconfig/config.cpp | 3 +++ 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/addons/settings/fnc_clear.sqf b/addons/settings/fnc_clear.sqf index 00811a213..ce8e2e3f8 100644 --- a/addons/settings/fnc_clear.sqf +++ b/addons/settings/fnc_clear.sqf @@ -77,7 +77,7 @@ switch (toLower _source) do { case "server": { if (!isServer) exitWith {}; - profileNamespace setVariable [QGVAR(hash), HASH_NULL]; + GVAR(serverHashNamespace) setVariable [QGVAR(hash), HASH_NULL]; saveProfileNamespace; GVAR(client) call CBA_fnc_deleteNamespace; GVAR(client) = [] call CBA_fnc_createNamespace; diff --git a/addons/settings/fnc_init.sqf b/addons/settings/fnc_init.sqf index 173b9aeb6..be7b841c8 100644 --- a/addons/settings/fnc_init.sqf +++ b/addons/settings/fnc_init.sqf @@ -166,7 +166,7 @@ GVAR(default) setVariable [_setting, [_defaultValue, _setting, _settingType, _se private _settingInfo = GVAR(userconfig) getVariable _setting; if (isNil "_settingInfo") then { - private _settingsHash = profileNamespace getVariable [QGVAR(hash), HASH_NULL]; + private _settingsHash = GVAR(serverHashNamespace) getVariable [QGVAR(hash), HASH_NULL]; _settingInfo = [_settingsHash, toLower _setting] call CBA_fnc_hashGet; }; diff --git a/addons/settings/fnc_initDisplayMain.sqf b/addons/settings/fnc_initDisplayMain.sqf index b741e9ffc..402a5c893 100644 --- a/addons/settings/fnc_initDisplayMain.sqf +++ b/addons/settings/fnc_initDisplayMain.sqf @@ -28,6 +28,12 @@ if (_file != "") then { uiNamespace setVariable [QGVAR(userconfig), compileFinal str _userconfig]; +private _volatile = getNumber (configFile >> QGVAR(volatile)) == 1; +uiNamespace setVariable [QGVAR(volatile), _volatile]; +if (_volatile) then { + WARNING("Server settings changes will be lost upon game restart."); +}; + private _ctrlAddonOptions = _display displayCtrl IDC_MAIN_ADDONOPTIONS; if (isNil QUOTE(ADDON)) then { diff --git a/addons/settings/fnc_set.sqf b/addons/settings/fnc_set.sqf index f7cbb1ba2..24c98e9a6 100644 --- a/addons/settings/fnc_set.sqf +++ b/addons/settings/fnc_set.sqf @@ -118,7 +118,7 @@ switch (toLower _source) do { private _defaultValue = [_setting, "default"] call FUNC(get); private _defaultPriority = SANITIZE_PRIORITY(_setting,0,_source); - private _settingsHash = profileNamespace getVariable [QGVAR(hash), HASH_NULL]; + private _settingsHash = GVAR(serverHashNamespace) getVariable [QGVAR(hash), HASH_NULL]; if ([_value, _priority] isEqualTo [_defaultValue, _defaultPriority]) then { [_settingsHash, toLower _setting] call CBA_fnc_hashRem; @@ -126,7 +126,7 @@ switch (toLower _source) do { [_settingsHash, toLower _setting, [_value, _priority]] call CBA_fnc_hashSet; }; - profileNamespace setVariable [QGVAR(hash), _settingsHash]; + GVAR(serverHashNamespace) setVariable [QGVAR(hash), _settingsHash]; saveProfileNamespace; }; diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index 71d75f867..56e3d3c3c 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -10,6 +10,9 @@ if (isNil QGVAR(default)) then { if (isNil QGVAR(server)) then { GVAR(server) = NAMESPACE_NULL; + + private _volatile = uiNamespace getVariable QGVAR(volatile); + GVAR(serverHashNamespace) = [profileNamespace, uiNamespace] select _volatile; }; if (isServer) then { diff --git a/template/cba_settings_userconfig/config.cpp b/template/cba_settings_userconfig/config.cpp index fbd45cbb2..d09e8f0d8 100644 --- a/template/cba_settings_userconfig/config.cpp +++ b/template/cba_settings_userconfig/config.cpp @@ -12,3 +12,6 @@ class CfgPatches { authors[] = {"commy2"}; }; }; + +// Uncommenting this will make any changes to "Server" settings be lost upon game restart +// cba_settings_volatile = 1; From 787d38b3678b01894d1ff657530c242971dd7158 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Thu, 12 Oct 2023 03:14:46 +0200 Subject: [PATCH 03/10] Add warning in UI --- addons/settings/fnc_gui_sourceChanged.sqf | 1 + addons/settings/gui.hpp | 9 +++++++++ addons/settings/initSettings.sqf | 5 +++-- addons/settings/script_component.hpp | 1 + addons/settings/stringtable.xml | 8 ++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/addons/settings/fnc_gui_sourceChanged.sqf b/addons/settings/fnc_gui_sourceChanged.sqf index c9bd5e2a2..56f35bfe1 100644 --- a/addons/settings/fnc_gui_sourceChanged.sqf +++ b/addons/settings/fnc_gui_sourceChanged.sqf @@ -32,6 +32,7 @@ private _selectedAddon = uiNamespace getVariable QGVAR(addon); (_display displayCtrl IDC_TXT_OVERWRITE_CLIENT) ctrlShow (_selectedSource isNotEqualTo "client"); (_display displayCtrl IDC_TXT_OVERWRITE_MISSION) ctrlShow (_selectedSource isEqualTo "server"); +(_display displayCtrl IDC_TXT_VOLATILE_WARNING) ctrlShow (_selectedSource isEqualTo "server" && GVAR(volatile)); // enable / disable IMPORT and LOAD buttons private _ctrlButtonImport = _display displayCtrl IDC_BTN_IMPORT; diff --git a/addons/settings/gui.hpp b/addons/settings/gui.hpp index a5c5e3031..a5eb4aef7 100644 --- a/addons/settings/gui.hpp +++ b/addons/settings/gui.hpp @@ -85,6 +85,15 @@ class RscDisplayGameOptions { idc = IDC_TXT_OVERWRITE_MISSION; x = QUOTE(POS_W(33)); }; + class VolatileWarningText: OverwriteClientText { + onLoad = QUOTE((_this select 0) ctrlEnable true;); + idc = IDC_TXT_VOLATILE_WARNING; + style = ST_LEFT; + text = CSTRING(volatile); + tooltip = CSTRING(volatile_tooltip); + x = QUOTE(POS_W(1)); + w = QUOTE(POS_W(24)); + }; }; }; }; diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index 56e3d3c3c..ff269d675 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -1,6 +1,8 @@ // inline function, don't include script_component.hpp if (isNil QGVAR(default)) then { + private _volatile = uiNamespace getVariable QGVAR(volatile); + GVAR(allSettings) = []; GVAR(default) = [] call CBA_fnc_createNamespace; @@ -10,13 +12,12 @@ if (isNil QGVAR(default)) then { if (isNil QGVAR(server)) then { GVAR(server) = NAMESPACE_NULL; - - private _volatile = uiNamespace getVariable QGVAR(volatile); GVAR(serverHashNamespace) = [profileNamespace, uiNamespace] select _volatile; }; if (isServer) then { missionNamespace setVariable [QGVAR(server), true call CBA_fnc_createNamespace, true]; + missionNamespace setVariable [QGVAR(volatile), _volatile, true]; }; // --- read userconfig file diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index 131fdb723..234740a1c 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -32,6 +32,7 @@ #define IDC_BTN_CONFIGURE 9030 #define IDC_TXT_OVERWRITE_CLIENT 9040 #define IDC_TXT_OVERWRITE_MISSION 9041 +#define IDC_TXT_VOLATILE_WARNING 9042 #define IDC_SETTING_CONTROLS_GROUP 5000 #define IDC_SETTING_BACKGROUND 5001 diff --git a/addons/settings/stringtable.xml b/addons/settings/stringtable.xml index d42661da1..3235b7782 100644 --- a/addons/settings/stringtable.xml +++ b/addons/settings/stringtable.xml @@ -315,6 +315,14 @@ Resetovat na původní hodnotu. 기본값으로 초기화합니다. + + Changes will not persist after server restart + Zmiany nie zostaną zachowane po restarcie serwera + + + The server is configured to discard all changes to its setting after it will be restarted.\nChanges will persist between mission restarts. + Serwer jest skonfigurowany tak, aby odrzucać wszystkie zmiany w ustawieniach gdy zostanie zrestartowany.\nZmiany zostaną zachowane między restartami misji. + Overwrite\nClients Clients\nüberschreiben From 465d6a224de2f9984ffa2b1b6c84cfc22640aa2c Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Mon, 16 Oct 2023 02:18:59 +0200 Subject: [PATCH 04/10] Apply suggestions from code review Co-authored-by: BrettMayson --- .hemtt/project.toml | 2 -- addons/settings/stringtable.xml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.hemtt/project.toml b/.hemtt/project.toml index add2c0b16..39060b6e9 100644 --- a/.hemtt/project.toml +++ b/.hemtt/project.toml @@ -36,5 +36,3 @@ preset = "Hemtt" [hemtt.release] folder = "CBA_A3" - -[hemtt.launch.default] diff --git a/addons/settings/stringtable.xml b/addons/settings/stringtable.xml index 3235b7782..09d716b08 100644 --- a/addons/settings/stringtable.xml +++ b/addons/settings/stringtable.xml @@ -320,7 +320,7 @@ Zmiany nie zostaną zachowane po restarcie serwera - The server is configured to discard all changes to its setting after it will be restarted.\nChanges will persist between mission restarts. + The server is configured to not persist changes to settings between server restarts.\nChanges will persist between mission restarts. Serwer jest skonfigurowany tak, aby odrzucać wszystkie zmiany w ustawieniach gdy zostanie zrestartowany.\nZmiany zostaną zachowane między restartami misji. From faabb518ff486c6a2dc49b99c170969e8615a09e Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Mon, 16 Oct 2023 03:57:53 +0200 Subject: [PATCH 05/10] Enable volatile settings only on dedicated server Co-authored-by: PabstMirror --- addons/settings/fnc_initDisplayMain.sqf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/settings/fnc_initDisplayMain.sqf b/addons/settings/fnc_initDisplayMain.sqf index 402a5c893..125d2dde4 100644 --- a/addons/settings/fnc_initDisplayMain.sqf +++ b/addons/settings/fnc_initDisplayMain.sqf @@ -28,7 +28,7 @@ if (_file != "") then { uiNamespace setVariable [QGVAR(userconfig), compileFinal str _userconfig]; -private _volatile = getNumber (configFile >> QGVAR(volatile)) == 1; +private _volatile = (getNumber (configFile >> QGVAR(volatile)) == 1) && {!hasInterface}; uiNamespace setVariable [QGVAR(volatile), _volatile]; if (_volatile) then { WARNING("Server settings changes will be lost upon game restart."); From 1230453bb6e7699aef4cffe3691e234230f63572 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 16 Oct 2023 19:37:06 -0500 Subject: [PATCH 06/10] Get volatile state at runtime --- addons/settings/fnc_initDisplayMain.sqf | 6 ------ addons/settings/initSettings.sqf | 3 ++- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/addons/settings/fnc_initDisplayMain.sqf b/addons/settings/fnc_initDisplayMain.sqf index 125d2dde4..b741e9ffc 100644 --- a/addons/settings/fnc_initDisplayMain.sqf +++ b/addons/settings/fnc_initDisplayMain.sqf @@ -28,12 +28,6 @@ if (_file != "") then { uiNamespace setVariable [QGVAR(userconfig), compileFinal str _userconfig]; -private _volatile = (getNumber (configFile >> QGVAR(volatile)) == 1) && {!hasInterface}; -uiNamespace setVariable [QGVAR(volatile), _volatile]; -if (_volatile) then { - WARNING("Server settings changes will be lost upon game restart."); -}; - private _ctrlAddonOptions = _display displayCtrl IDC_MAIN_ADDONOPTIONS; if (isNil QUOTE(ADDON)) then { diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index ff269d675..3d1bec34f 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -1,7 +1,7 @@ // inline function, don't include script_component.hpp if (isNil QGVAR(default)) then { - private _volatile = uiNamespace getVariable QGVAR(volatile); + private _volatile = isServer && {!hasInterface} && {(getNumber (configFile >> QGVAR(volatile))) == 1}; GVAR(allSettings) = []; GVAR(default) = [] call CBA_fnc_createNamespace; @@ -13,6 +13,7 @@ if (isNil QGVAR(default)) then { if (isNil QGVAR(server)) then { GVAR(server) = NAMESPACE_NULL; GVAR(serverHashNamespace) = [profileNamespace, uiNamespace] select _volatile; + if (_volatile) then { WARNING("Server settings changes will be lost upon game restart."); }; }; if (isServer) then { From 686fb174f2ec3572c5757d88e26e8bee02cc724f Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Tue, 17 Oct 2023 18:43:41 +0200 Subject: [PATCH 07/10] Get server hash namespace at runtime --- addons/settings/fnc_clear.sqf | 2 +- addons/settings/fnc_init.sqf | 2 +- addons/settings/fnc_set.sqf | 4 ++-- addons/settings/initSettings.sqf | 3 +-- addons/settings/script_component.hpp | 2 ++ 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/settings/fnc_clear.sqf b/addons/settings/fnc_clear.sqf index ce8e2e3f8..3dd744213 100644 --- a/addons/settings/fnc_clear.sqf +++ b/addons/settings/fnc_clear.sqf @@ -77,7 +77,7 @@ switch (toLower _source) do { case "server": { if (!isServer) exitWith {}; - GVAR(serverHashNamespace) setVariable [QGVAR(hash), HASH_NULL]; + GET_SERVER_NAMESPACE setVariable [QGVAR(hash), HASH_NULL]; saveProfileNamespace; GVAR(client) call CBA_fnc_deleteNamespace; GVAR(client) = [] call CBA_fnc_createNamespace; diff --git a/addons/settings/fnc_init.sqf b/addons/settings/fnc_init.sqf index be7b841c8..5e996a5ee 100644 --- a/addons/settings/fnc_init.sqf +++ b/addons/settings/fnc_init.sqf @@ -166,7 +166,7 @@ GVAR(default) setVariable [_setting, [_defaultValue, _setting, _settingType, _se private _settingInfo = GVAR(userconfig) getVariable _setting; if (isNil "_settingInfo") then { - private _settingsHash = GVAR(serverHashNamespace) getVariable [QGVAR(hash), HASH_NULL]; + private _settingsHash = GET_SERVER_NAMESPACE getVariable [QGVAR(hash), HASH_NULL]; _settingInfo = [_settingsHash, toLower _setting] call CBA_fnc_hashGet; }; diff --git a/addons/settings/fnc_set.sqf b/addons/settings/fnc_set.sqf index 24c98e9a6..f7e15a1c8 100644 --- a/addons/settings/fnc_set.sqf +++ b/addons/settings/fnc_set.sqf @@ -118,7 +118,7 @@ switch (toLower _source) do { private _defaultValue = [_setting, "default"] call FUNC(get); private _defaultPriority = SANITIZE_PRIORITY(_setting,0,_source); - private _settingsHash = GVAR(serverHashNamespace) getVariable [QGVAR(hash), HASH_NULL]; + private _settingsHash = GET_SERVER_NAMESPACE getVariable [QGVAR(hash), HASH_NULL]; if ([_value, _priority] isEqualTo [_defaultValue, _defaultPriority]) then { [_settingsHash, toLower _setting] call CBA_fnc_hashRem; @@ -126,7 +126,7 @@ switch (toLower _source) do { [_settingsHash, toLower _setting, [_value, _priority]] call CBA_fnc_hashSet; }; - GVAR(serverHashNamespace) setVariable [QGVAR(hash), _settingsHash]; + GET_SERVER_NAMESPACE setVariable [QGVAR(hash), _settingsHash]; saveProfileNamespace; }; diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index 3d1bec34f..9b9c1cc5a 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -12,13 +12,12 @@ if (isNil QGVAR(default)) then { if (isNil QGVAR(server)) then { GVAR(server) = NAMESPACE_NULL; - GVAR(serverHashNamespace) = [profileNamespace, uiNamespace] select _volatile; - if (_volatile) then { WARNING("Server settings changes will be lost upon game restart."); }; }; if (isServer) then { missionNamespace setVariable [QGVAR(server), true call CBA_fnc_createNamespace, true]; missionNamespace setVariable [QGVAR(volatile), _volatile, true]; + if (_volatile) then {WARNING("Server settings changes will be lost upon game restart.")}; }; // --- read userconfig file diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index 234740a1c..5eb9538e1 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -128,6 +128,8 @@ #define SET_TEMP_NAMESPACE_VALUE(setting,value,source) GET_TEMP_NAMESPACE(source) setVariable [setting, [value, GET_TEMP_NAMESPACE_PRIORITY(setting,source)]]; SET_TEMP_NAMESPACE_AWAITING_RESTART(setting) #define SET_TEMP_NAMESPACE_PRIORITY(setting,priority,source) GET_TEMP_NAMESPACE(source) setVariable [setting, [GET_TEMP_NAMESPACE_VALUE(setting,source), priority]]; SET_TEMP_NAMESPACE_AWAITING_RESTART(setting) +#define GET_SERVER_NAMESPACE (with missionNamespace do {if (GVAR(volatile)) then {uiNamespace} else {profileNamespace}}) + #define TEMP_PRIORITY(setting) (call {private _arr = [\ (uiNamespace getVariable QGVAR(clientTemp)) getVariable [setting, [nil, [setting, "client"] call FUNC(priority)]] select 1,\ (uiNamespace getVariable QGVAR(missionTemp)) getVariable [setting, [nil, [setting, "mission"] call FUNC(priority)]] select 1,\ From 18f785d1470f28e1013daa50c7e0035cc2b53002 Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Tue, 17 Oct 2023 19:05:54 +0200 Subject: [PATCH 08/10] Always use uiNamespace on clients --- addons/settings/initSettings.sqf | 2 +- addons/settings/script_component.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index 9b9c1cc5a..1ca51b7cc 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -1,7 +1,7 @@ // inline function, don't include script_component.hpp if (isNil QGVAR(default)) then { - private _volatile = isServer && {!hasInterface} && {(getNumber (configFile >> QGVAR(volatile))) == 1}; + private _volatile = isDedicated && {(getNumber (configFile >> QGVAR(volatile))) == 1}; GVAR(allSettings) = []; GVAR(default) = [] call CBA_fnc_createNamespace; diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index 5eb9538e1..4b4f2b0be 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -128,7 +128,7 @@ #define SET_TEMP_NAMESPACE_VALUE(setting,value,source) GET_TEMP_NAMESPACE(source) setVariable [setting, [value, GET_TEMP_NAMESPACE_PRIORITY(setting,source)]]; SET_TEMP_NAMESPACE_AWAITING_RESTART(setting) #define SET_TEMP_NAMESPACE_PRIORITY(setting,priority,source) GET_TEMP_NAMESPACE(source) setVariable [setting, [GET_TEMP_NAMESPACE_VALUE(setting,source), priority]]; SET_TEMP_NAMESPACE_AWAITING_RESTART(setting) -#define GET_SERVER_NAMESPACE (with missionNamespace do {if (GVAR(volatile)) then {uiNamespace} else {profileNamespace}}) +#define GET_SERVER_NAMESPACE (with missionNamespace do {if (isDedicated && {GVAR(volatile)}) then {uiNamespace} else {profileNamespace}}) #define TEMP_PRIORITY(setting) (call {private _arr = [\ (uiNamespace getVariable QGVAR(clientTemp)) getVariable [setting, [nil, [setting, "client"] call FUNC(priority)]] select 1,\ From 87d40e9e62263b9d6485cc2424ea0da43766adff Mon Sep 17 00:00:00 2001 From: Filip Maciejewski Date: Tue, 17 Oct 2023 19:34:16 +0200 Subject: [PATCH 09/10] Update template comment --- template/cba_settings_userconfig/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/cba_settings_userconfig/config.cpp b/template/cba_settings_userconfig/config.cpp index d09e8f0d8..50d772df4 100644 --- a/template/cba_settings_userconfig/config.cpp +++ b/template/cba_settings_userconfig/config.cpp @@ -13,5 +13,5 @@ class CfgPatches { }; }; -// Uncommenting this will make any changes to "Server" settings be lost upon game restart +// Uncommenting this will make any changes to "Server" settings be lost upon game restart, applies only to dedicated servers // cba_settings_volatile = 1; From e669a165cf86e094a97520f95beb893204482ac9 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Sat, 21 Oct 2023 02:23:18 -0500 Subject: [PATCH 10/10] rename to `GET_LOCAL_SETTINGS_NAMESPACE` --- addons/settings/fnc_clear.sqf | 2 +- addons/settings/fnc_init.sqf | 2 +- addons/settings/fnc_set.sqf | 4 ++-- addons/settings/initSettings.sqf | 3 +-- addons/settings/script_component.hpp | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/addons/settings/fnc_clear.sqf b/addons/settings/fnc_clear.sqf index 3dd744213..c3c34ff7b 100644 --- a/addons/settings/fnc_clear.sqf +++ b/addons/settings/fnc_clear.sqf @@ -77,7 +77,7 @@ switch (toLower _source) do { case "server": { if (!isServer) exitWith {}; - GET_SERVER_NAMESPACE setVariable [QGVAR(hash), HASH_NULL]; + GET_LOCAL_SETTINGS_NAMESPACE setVariable [QGVAR(hash), HASH_NULL]; saveProfileNamespace; GVAR(client) call CBA_fnc_deleteNamespace; GVAR(client) = [] call CBA_fnc_createNamespace; diff --git a/addons/settings/fnc_init.sqf b/addons/settings/fnc_init.sqf index 5e996a5ee..3b35a4981 100644 --- a/addons/settings/fnc_init.sqf +++ b/addons/settings/fnc_init.sqf @@ -166,7 +166,7 @@ GVAR(default) setVariable [_setting, [_defaultValue, _setting, _settingType, _se private _settingInfo = GVAR(userconfig) getVariable _setting; if (isNil "_settingInfo") then { - private _settingsHash = GET_SERVER_NAMESPACE getVariable [QGVAR(hash), HASH_NULL]; + private _settingsHash = GET_LOCAL_SETTINGS_NAMESPACE getVariable [QGVAR(hash), HASH_NULL]; _settingInfo = [_settingsHash, toLower _setting] call CBA_fnc_hashGet; }; diff --git a/addons/settings/fnc_set.sqf b/addons/settings/fnc_set.sqf index f7e15a1c8..1ace681f5 100644 --- a/addons/settings/fnc_set.sqf +++ b/addons/settings/fnc_set.sqf @@ -118,7 +118,7 @@ switch (toLower _source) do { private _defaultValue = [_setting, "default"] call FUNC(get); private _defaultPriority = SANITIZE_PRIORITY(_setting,0,_source); - private _settingsHash = GET_SERVER_NAMESPACE getVariable [QGVAR(hash), HASH_NULL]; + private _settingsHash = GET_LOCAL_SETTINGS_NAMESPACE getVariable [QGVAR(hash), HASH_NULL]; if ([_value, _priority] isEqualTo [_defaultValue, _defaultPriority]) then { [_settingsHash, toLower _setting] call CBA_fnc_hashRem; @@ -126,7 +126,7 @@ switch (toLower _source) do { [_settingsHash, toLower _setting, [_value, _priority]] call CBA_fnc_hashSet; }; - GET_SERVER_NAMESPACE setVariable [QGVAR(hash), _settingsHash]; + GET_LOCAL_SETTINGS_NAMESPACE setVariable [QGVAR(hash), _settingsHash]; saveProfileNamespace; }; diff --git a/addons/settings/initSettings.sqf b/addons/settings/initSettings.sqf index 1ca51b7cc..ad6c8c122 100644 --- a/addons/settings/initSettings.sqf +++ b/addons/settings/initSettings.sqf @@ -1,8 +1,6 @@ // inline function, don't include script_component.hpp if (isNil QGVAR(default)) then { - private _volatile = isDedicated && {(getNumber (configFile >> QGVAR(volatile))) == 1}; - GVAR(allSettings) = []; GVAR(default) = [] call CBA_fnc_createNamespace; @@ -16,6 +14,7 @@ if (isNil QGVAR(default)) then { if (isServer) then { missionNamespace setVariable [QGVAR(server), true call CBA_fnc_createNamespace, true]; + private _volatile = isDedicated && {(getNumber (configFile >> QGVAR(volatile))) == 1}; missionNamespace setVariable [QGVAR(volatile), _volatile, true]; if (_volatile) then {WARNING("Server settings changes will be lost upon game restart.")}; }; diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index 4b4f2b0be..9d7cb42a5 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -128,7 +128,7 @@ #define SET_TEMP_NAMESPACE_VALUE(setting,value,source) GET_TEMP_NAMESPACE(source) setVariable [setting, [value, GET_TEMP_NAMESPACE_PRIORITY(setting,source)]]; SET_TEMP_NAMESPACE_AWAITING_RESTART(setting) #define SET_TEMP_NAMESPACE_PRIORITY(setting,priority,source) GET_TEMP_NAMESPACE(source) setVariable [setting, [GET_TEMP_NAMESPACE_VALUE(setting,source), priority]]; SET_TEMP_NAMESPACE_AWAITING_RESTART(setting) -#define GET_SERVER_NAMESPACE (with missionNamespace do {if (isDedicated && {GVAR(volatile)}) then {uiNamespace} else {profileNamespace}}) +#define GET_LOCAL_SETTINGS_NAMESPACE (with missionNamespace do {if (isDedicated && {GVAR(volatile)}) then {uiNamespace} else {profileNamespace}}) #define TEMP_PRIORITY(setting) (call {private _arr = [\ (uiNamespace getVariable QGVAR(clientTemp)) getVariable [setting, [nil, [setting, "client"] call FUNC(priority)]] select 1,\