diff --git a/addons/settings/XEH_postInit.sqf b/addons/settings/XEH_postInit.sqf index 031726f61..d5475be79 100644 --- a/addons/settings/XEH_postInit.sqf +++ b/addons/settings/XEH_postInit.sqf @@ -6,10 +6,16 @@ diag_log text "[CBA] (settings): No server settings after postInit phase."; }; + //Event to read modules + ["CBA_beforeSettingsInitialized", []] call CBA_fnc_localEvent; + GVAR(ready) = true; { [QGVAR(refreshSetting), _x] call CBA_fnc_localEvent; - } forEach GVAR(allSettings); + } forEach GVAR(allSettings); + + diag_log text format ["[CBA] (settings): Settings Initialized"]; + ["CBA_settingsInitialized", []] call CBA_fnc_localEvent; } call CBA_fnc_execNextFrame; // --- autosave mission and server presets diff --git a/addons/settings/XEH_preInit.sqf b/addons/settings/XEH_preInit.sqf index 5af03c6d8..5eaea7002 100644 --- a/addons/settings/XEH_preInit.sqf +++ b/addons/settings/XEH_preInit.sqf @@ -63,4 +63,18 @@ if (isServer) then { }] call CBA_fnc_addEventHandler; }; +// event to modify mission settings +[QGVAR(setSettingMission), { + params ["_setting", "_value", ["_forced", false, [false]]]; + + if ([_setting, "mission"] call FUNC(isForced)) exitWith { + diag_log text format ["[CBA] (settings): Setting %1 already forced, ignoring setSettingMission.", _setting]; + }; + if (!([_setting, _value] call FUNC(check))) exitWith { + diag_log text format ["[CBA] (settings): Value %1 is invalid for setting %2.", _value, _setting]; + }; + + GVAR(missionSettings) setVariable [_setting, [_value, _forced]]; +}] call CBA_fnc_addEventHandler; + ADDON = true; diff --git a/addons/settings/fnc_init.sqf b/addons/settings/fnc_init.sqf index 3579e76ac..fddb6bbf7 100644 --- a/addons/settings/fnc_init.sqf +++ b/addons/settings/fnc_init.sqf @@ -161,7 +161,7 @@ if (!isNil "_settingInfo") then { if (isServer) then { [QGVAR(refreshSetting), _setting] call CBA_fnc_globalEvent; } else { - [QGVAR(refreshSetting), _setting] call CBA_fnc_localEvent; + [QGVAR(refreshSetting), _setting] call CBA_fnc_localEvent; }; 0 diff --git a/addons/settings/fnc_isForced.sqf b/addons/settings/fnc_isForced.sqf index bfa6bf0cd..0a675d0a1 100644 --- a/addons/settings/fnc_isForced.sqf +++ b/addons/settings/fnc_isForced.sqf @@ -23,7 +23,7 @@ switch (toLower _source) do { GET_FORCED(clientSettings,_setting); }; case ("server"): { - GET_FORCED(serverSettings,_setting); + GET_FORCED(serverSettings,_setting) || {(!GET_FORCED(missionSettings,_setting)) && {(isMultiplayer && {NAMESPACE_GETVAR(GVAR(defaultSettings),_setting,[]) param [7, false]})}}; }; case ("mission"): { GET_FORCED(missionSettings,_setting); diff --git a/addons/settings/fnc_isOverwritten.sqf b/addons/settings/fnc_isOverwritten.sqf index 84157b209..79bd8bde5 100644 --- a/addons/settings/fnc_isOverwritten.sqf +++ b/addons/settings/fnc_isOverwritten.sqf @@ -23,10 +23,10 @@ switch (toLower _source) do { [_setting, "mission"] call FUNC(isForced) || {[_setting, "server"] call FUNC(isForced)} }; case ("server"): { - false + (!([_setting, "server"] call FUNC(isForced))) && {[_setting, "mission"] call FUNC(isForced)} }; case ("mission"): { - [_setting, "server"] call FUNC(isForced) + (!([_setting, "mission"] call FUNC(isForced))) || {[_setting, "server"] call FUNC(isForced)} }; default {nil}; }; diff --git a/addons/settings/gui_createMenu_force.sqf b/addons/settings/gui_createMenu_force.sqf index 58d7a334e..41c153f9e 100644 --- a/addons/settings/gui_createMenu_force.sqf +++ b/addons/settings/gui_createMenu_force.sqf @@ -17,11 +17,6 @@ private _data = [_setting, _source]; _ctrlSettingForce setVariable [QGVAR(linkedControls), _linkedControls]; _ctrlSettingForce setVariable [QGVAR(data), _data]; -if (_isGlobal) then { - _ctrlSettingForce ctrlSetChecked true; - _ctrlSettingForce ctrlEnable false; -}; - _ctrlSettingForce ctrlAddEventHandler ["CheckedChanged", { params ["_control", "_state"]; diff --git a/addons/settings/script_component.hpp b/addons/settings/script_component.hpp index ca1c94191..2bc43cb8e 100644 --- a/addons/settings/script_component.hpp +++ b/addons/settings/script_component.hpp @@ -1,6 +1,5 @@ #define COMPONENT settings #include "\x\cba\addons\main\script_mod.hpp" -#include "\x\cba\addons\main\script_macros.hpp" #include "\a3\ui_f\hpp\defineDIKCodes.inc" #include "\a3\ui_f\hpp\defineCommonGrids.inc" @@ -15,6 +14,8 @@ #define DEBUG_SETTINGS DEBUG_SETTINGS_SETTINGS #endif +#include "\x\cba\addons\main\script_macros.hpp" + #define IDC_ADDONS_GROUP 4301 #define IDC_BTN_CONFIGURE_ADDONS 4302 #define IDC_BTN_CLIENT 9000 @@ -76,7 +77,7 @@ #define NAMESPACE_GETVAR(namespace,varname,default) ([namespace getVariable varname] param [0, default]) #define GET_VALUE(namespace,setting) ((GVAR(namespace) getVariable setting) param [0]) -#define GET_FORCED(namespace,setting) ((NAMESPACE_GETVAR(GVAR(namespace),setting,[]) param [1, false]) || {isMultiplayer && {NAMESPACE_GETVAR(GVAR(defaultSettings),setting,[]) param [7, false]}}) +#define GET_FORCED(namespace,setting) (NAMESPACE_GETVAR(GVAR(namespace),setting,[]) param [1, false]) #define GET_TEMP_NAMESPACE(source) ([ARR_3(GVAR(clientSettingsTemp),GVAR(serverSettingsTemp),GVAR(missionSettingsTemp))] param [[ARR_3('client','server','mission')] find toLower source]) #define SET_TEMP_NAMESPACE_VALUE(setting,value,source) GET_TEMP_NAMESPACE(source) setVariable [ARR_2(setting,[ARR_2(value,(GET_TEMP_NAMESPACE(source) getVariable setting) param [1])])] diff --git a/addons/settings/stringtable.xml b/addons/settings/stringtable.xml index 4961adbb6..15c5b629a 100644 --- a/addons/settings/stringtable.xml +++ b/addons/settings/stringtable.xml @@ -63,7 +63,16 @@ Default + Výchozí Voreinst. + По умолчанию + Domyślnie + Predefinito + Predet. + Par défaut + デフォルト + 기본값 + Padrão Setting is overwritten. Check 'Server' or 'Mission' tab.