diff --git a/addons/advanced_fatigue/initSettings.sqf b/addons/advanced_fatigue/initSettings.sqf index 8f4e5f0c9a..4e44d75132 100644 --- a/addons/advanced_fatigue/initSettings.sqf +++ b/addons/advanced_fatigue/initSettings.sqf @@ -4,7 +4,9 @@ [LSTRING(Enabled), LSTRING(Enabled_Description)], LSTRING(DisplayName), true, - true + true, + {[QGVAR(enabled), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_Settings_fnc_init; [ diff --git a/addons/common/functions/fnc_cbaSettings_convertHelper.sqf b/addons/common/functions/fnc_cbaSettings_convertHelper.sqf index 14d2b8c35a..4c64da8f0f 100644 --- a/addons/common/functions/fnc_cbaSettings_convertHelper.sqf +++ b/addons/common/functions/fnc_cbaSettings_convertHelper.sqf @@ -43,6 +43,7 @@ private _settings = configProperties [configFile >> "ACE_Settings", "(isClass _x private _category = getText (_config >> "category"); private _cbaIsGlobal = (!_isClientSettable) || _isForced; + private _warnIfChangedMidMission = _cbaIsGlobal && {(getNumber (_config >> "canBeChanged")) == 0}; if (_isForced) then {GVAR(cbaSettings_forcedSettings) pushBack (toLower _varName);}; // Basic handling of setting types CBA doesn't support: @@ -117,10 +118,11 @@ private _settings = configProperties [configFile >> "ACE_Settings", "(isClass _x _output pushBack format [" %1, // %2", _cbaValueInfo, _cbaValueInfoHint]; _output pushBack format [" %1, // isGlobal", _cbaIsGlobal]; if ((_varName select [0, 4]) == "ACE_") then { - _output pushBack format [" {[QGVAR(%1), _this] call EFUNC(common,cbaSettings_settingChanged)}", _gvarName]; + _output pushBack format [" {[QGVAR(%1), _this] call EFUNC(common,cbaSettings_settingChanged)},", _gvarName]; } else { - _output pushBack format [" {[""%1"", _this] call ace_common_fnc_cbaSettings_settingChanged}", _varName]; + _output pushBack format [" {[""%1"", _this] call ace_common_fnc_cbaSettings_settingChanged},", _varName]; }; + _output pushBack format [" %1 // Needs mission restart", _warnIfChangedMidMission]; _output pushBack "] call CBA_settings_fnc_init;"; } forEach _settings; diff --git a/addons/common/functions/fnc_cbaSettings_loadFromConfig.sqf b/addons/common/functions/fnc_cbaSettings_loadFromConfig.sqf index ef529de955..7f6637f622 100644 --- a/addons/common/functions/fnc_cbaSettings_loadFromConfig.sqf +++ b/addons/common/functions/fnc_cbaSettings_loadFromConfig.sqf @@ -32,6 +32,7 @@ private _isForced = (getNumber (_config >> "force")) > 0; private _category = getText (_config >> "category"); private _cbaIsGlobal = (!_isClientSettable) || _isForced; +private _warnIfChangedMidMission = _cbaIsGlobal && {(getNumber (_config >> "canBeChanged")) == 0}; if (_isForced) then {GVAR(cbaSettings_forcedSettings) pushBack (toLower _varName);}; // Basic handling of setting types CBA doesn't support: @@ -97,7 +98,7 @@ private _code = compile format ['["%1", _this] call FUNC(cbaSettings_settingChan TRACE_2("setting",_cbaSettingType,_cbaValueInfo); TRACE_4("",_isForced,_cbaIsGlobal,_category,_cbaValueInfo); -private _return = [_varName, _cbaSettingType, [_localizedName, _localizedDescription], _category, _cbaValueInfo, _cbaIsGlobal, _code] call CBA_settings_fnc_init; +private _return = [_varName, _cbaSettingType, [_localizedName, _localizedDescription], _category, _cbaValueInfo, _cbaIsGlobal, _code, _warnIfChangedMidMission] call CBA_settings_fnc_init; TRACE_1("returned",_return); if ((isNil "_return") || {_return != 0}) then {ERROR_1("Setting [%1] - CBA Error",_varName);}; _return diff --git a/addons/common/functions/fnc_cbaSettings_settingChanged.sqf b/addons/common/functions/fnc_cbaSettings_settingChanged.sqf index 2a2974ef24..055e9b9da6 100644 --- a/addons/common/functions/fnc_cbaSettings_settingChanged.sqf +++ b/addons/common/functions/fnc_cbaSettings_settingChanged.sqf @@ -23,10 +23,9 @@ TRACE_2("",_settingName,_newValue); ["ace_settingChanged", [_settingName, _newValue]] call CBA_fnc_localEvent; -if (_canBeChanged) exitWith {}; +if (!((toLower _settingName) in CBA_settings_needRestart)) exitWith {}; +if (_canBeChanged) exitWith {WARNING_1("update cba setting [%1] to use correct Need Restart param",_settingName);}; if (!GVAR(settingsInitFinished)) exitWith {}; // Ignore changed event before CBA_settingsInitialized -if (CBA_settings_default getVariable [_settingName, []] param [7, 0] == 0) exitWith {}; // Ignore if not a global setting -if ((getNumber (configFile >> "ACE_settings" >> _settingName >> "canBeChanged")) == 1) exitWith {}; // Ignore if flagged as ok to change -WARNING_1("Global setting [%1] changed mid-mission",_settingName); -[QGVAR(displayTextStructured), [format ["Global setting %1 changed mid-mission. Mission restart may be required to prevent issues", _settingName], 4]] call CBA_fnc_localEvent; +WARNING_1("Setting [%1] changed mid-mission",_settingName); +[QGVAR(displayTextStructured), [format ["Setting %1 changed mid-mission. Mission restart may be required to prevent issues", _settingName], 4]] call CBA_fnc_localEvent; diff --git a/addons/map/initSettings.sqf b/addons/map/initSettings.sqf index ae0e31b0ae..d184c5c1ac 100644 --- a/addons/map/initSettings.sqf +++ b/addons/map/initSettings.sqf @@ -4,7 +4,9 @@ [localize LSTRING(MapIllumination_DisplayName), localize LSTRING(MapIllumination_Description)], format["ACE %1", localize LSTRING(Module_DisplayName)], true, - true + true, + {[QGVAR(mapIllumination), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ @@ -13,7 +15,9 @@ [localize LSTRING(MapGlow_DisplayName), localize LSTRING(MapGlow_Description)], format["ACE %1", localize LSTRING(Module_DisplayName)], true, - true + true, + {[QGVAR(mapGlow), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ @@ -49,7 +53,9 @@ [localize LSTRING(DefaultChannel_DisplayName), localize LSTRING(DefaultChannel_Description)], format["ACE %1", localize LSTRING(Module_DisplayName)], [[-1, 0, 1, 2, 3, 4, 5], [ELSTRING(common,Disabled), "STR_channel_global", "STR_channel_side", "STR_channel_command", "STR_channel_group", "STR_channel_vehicle", "STR_channel_direct"], 0], - true + true, + {[QGVAR(DefaultChannel), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; // Blue Force Tracking @@ -59,7 +65,9 @@ [localize LSTRING(BFT_Enabled_DisplayName), localize LSTRING(BFT_Enabled_Description)], [format ["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(BFT_Module_DisplayName)], false, - true + true, + {[QGVAR(BFT_Enabled), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ @@ -68,7 +76,9 @@ [localize LSTRING(BFT_Interval_DisplayName), localize LSTRING(BFT_Interval_Description)], [format ["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(BFT_Module_DisplayName)], [0, 30, 1, 1], - true + true, + {[QGVAR(BFT_Interval), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ @@ -77,7 +87,9 @@ [localize LSTRING(BFT_ShowPlayerNames_DisplayName), localize LSTRING(BFT_ShowPlayerNames_Description)], [format ["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(BFT_Module_DisplayName)], false, - true + true, + {[QGVAR(BFT_ShowPlayerNames), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ @@ -86,5 +98,7 @@ [localize LSTRING(BFT_HideAiGroups_DisplayName), localize LSTRING(BFT_HideAiGroups_Description)], [format ["ACE %1", localize LSTRING(Module_DisplayName)], localize LSTRING(BFT_Module_DisplayName)], false, - true + true, + {[QGVAR(BFT_HideAiGroups), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; diff --git a/addons/nightvision/initSettings.sqf b/addons/nightvision/initSettings.sqf index 884c53055a..5b6492a2cb 100644 --- a/addons/nightvision/initSettings.sqf +++ b/addons/nightvision/initSettings.sqf @@ -6,7 +6,8 @@ localize LSTRING(Category), [0,2,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] true, // isGlobal - {[QGVAR(effectScaling), _this] call EFUNC(common,cbaSettings_settingChanged)} + {[QGVAR(effectScaling), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ QGVAR(fogScaling), "SLIDER", @@ -14,7 +15,8 @@ localize LSTRING(Category), [0,2,1,1], // [min, max, default value, trailing decimals (-1 for whole numbers only)] true, // isGlobal - {[QGVAR(fogScaling), _this] call EFUNC(common,cbaSettings_settingChanged)} + {[QGVAR(fogScaling), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ diff --git a/addons/noradio/XEH_preInit.sqf b/addons/noradio/XEH_preInit.sqf index 5be74ddf1b..61492aa36d 100644 --- a/addons/noradio/XEH_preInit.sqf +++ b/addons/noradio/XEH_preInit.sqf @@ -35,4 +35,5 @@ if (hasInterface) then { } else { [ACE_player, "isPlayer"] call EFUNC(common,unmuteUnit); }; -}] call CBA_settings_fnc_init; +}, true // Needs mission restart +] call CBA_settings_fnc_init; diff --git a/addons/repair/initSettings.sqf b/addons/repair/initSettings.sqf index c392711218..e226085a29 100644 --- a/addons/repair/initSettings.sqf +++ b/addons/repair/initSettings.sqf @@ -78,7 +78,8 @@ [localize ELSTRING(OptionsMenu,CategoryLogistics), localize "str_state_repair"], true, // default value true, // isGlobal - {[QGVAR(addSpareParts), _this] call EFUNC(common,cbaSettings_settingChanged)} + {[QGVAR(addSpareParts), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ diff --git a/addons/vehiclelock/initSettings.sqf b/addons/vehiclelock/initSettings.sqf index 238268a8dc..30de8a692c 100644 --- a/addons/vehiclelock/initSettings.sqf +++ b/addons/vehiclelock/initSettings.sqf @@ -15,7 +15,8 @@ LSTRING(DisplayName), false, // default value true, // isGlobal - {[QGVAR(lockVehicleInventory), _this] call EFUNC(common,cbaSettings_settingChanged)} + {[QGVAR(lockVehicleInventory), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init; [ @@ -24,5 +25,6 @@ LSTRING(DisplayName), [[-1,0,1,2],["str_cfg_envsounds_default", LSTRING(VehicleStartingLockState_AsIs), LSTRING(VehicleStartingLockState_Locked), LSTRING(VehicleStartingLockState_Unlocked)], 0], // [values, titles, defaultIndex] true, // isGlobal - {[QGVAR(vehicleStartingLockState), _this] call EFUNC(common,cbaSettings_settingChanged)} + {[QGVAR(vehicleStartingLockState), _this] call EFUNC(common,cbaSettings_settingChanged)}, + true // Needs mission restart ] call CBA_settings_fnc_init;