From 1230453bb6e7699aef4cffe3691e234230f63572 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 16 Oct 2023 19:37:06 -0500 Subject: [PATCH] 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 125d2dde42..b741e9ffcc 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 ff269d675b..3d1bec34f2 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 {