-
Notifications
You must be signed in to change notification settings - Fork 159
Settings - Fix Settings UI checkbox display, code cleanup #1851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
27a8e5f
049e680
ff49435
f10bf4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,9 +30,14 @@ params ["_controlsGroup"]; | |||||
| private _setting = ROW_SETTING(_controlsGroup); | ||||||
| private _source = ROW_SOURCE(_controlsGroup); | ||||||
|
|
||||||
| // a local setting is never overwritten by the mission, so there is nothing a | ||||||
| // mission maker could set from here. The server keeps it: a server is a client | ||||||
| // too, and FUNC(set) writes both when it is set there. | ||||||
| private _isLocalOnly = ROW_IS_LOCAL_ONLY(_controlsGroup); | ||||||
|
|
||||||
| private _enabled = switch (_source) do { | ||||||
| case "client": {CAN_SET_CLIENT_SETTINGS && {isNil {GVAR(userconfig) getVariable _setting}}}; | ||||||
| case "mission": {CAN_SET_MISSION_SETTINGS && {isNil {GVAR(missionConfig) getVariable _setting}}}; | ||||||
| case "mission": {CAN_SET_MISSION_SETTINGS && !_isLocalOnly && {isNil {GVAR(missionConfig) getVariable _setting}}}; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I do see the others use the older way. |
||||||
| case "server": {CAN_SET_SERVER_SETTINGS && {isNil {GVAR(serverConfig) getVariable _setting}}}; | ||||||
| default {false}; | ||||||
| }; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,9 @@ _ctrlOverwriteClient setVariable [QFUNC(event), { | |||||||
| _controlsGroup setVariable [QFUNC(auto_check_overwrite), { | ||||||||
| params ["_controlsGroup", "_source"]; | ||||||||
|
|
||||||||
| if (_source isEqualTo "mission") then { | ||||||||
| // a local only setting has no "overwrite clients" to tick, and a priority | ||||||||
| // ticked in here would be sanitized away again the moment it is saved | ||||||||
| if (_source isEqualTo "mission" && !ROW_IS_LOCAL_ONLY(_controlsGroup)) then { | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hemtt complains about
Suggested change
|
||||||||
| private _ctrlOverwriteClient = _controlsGroup controlsGroupCtrl IDC_SETTING_OVERWRITE_CLIENT; | ||||||||
|
|
||||||||
| if (!cbChecked _ctrlOverwriteClient) then { | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -237,8 +237,18 @@ | |||||||||||||||||||||
| // str and format ["%1", ] on their own can only do either. | ||||||||||||||||||||||
| #define TO_STRING(var) (call {private _str = var; if (_str isEqualType "") then {_str = str _str}; format ["%1", _str]}) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define IS_GLOBAL_SETTING(setting) (GVAR(default) getVariable [setting, []] param [7, 0] == 1) | ||||||||||||||||||||||
| #define IS_LOCAL_SETTING(setting) (GVAR(default) getVariable [setting, []] param [7, 0] == 2) | ||||||||||||||||||||||
| // A setting's _isGlobal, as it is registered and as a settings menu row stores it. | ||||||||||||||||||||||
| // Every client has their own value unless something overwrites it, GLOBAL_ONLY is | ||||||||||||||||||||||
| // always overwritten for everyone, LOCAL_ONLY can't be overwritten at all. | ||||||||||||||||||||||
| #define SETTING_LOCAL_OVERRIDABLE 0 | ||||||||||||||||||||||
| #define SETTING_GLOBAL_ONLY 1 | ||||||||||||||||||||||
| #define SETTING_LOCAL_ONLY 2 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define IS_GLOBAL_SETTING(setting) (GVAR(default) getVariable [setting, []] param [7, 0] == SETTING_GLOBAL_ONLY) | ||||||||||||||||||||||
| #define IS_LOCAL_SETTING(setting) (GVAR(default) getVariable [setting, []] param [7, 0] == SETTING_LOCAL_ONLY) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // the same question asked of a row, which keeps its setting's _isGlobal | ||||||||||||||||||||||
| #define ROW_IS_LOCAL_ONLY(group) ((group getVariable [ARR_2(QGVAR(isGlobal),SETTING_LOCAL_OVERRIDABLE)]) == SETTING_LOCAL_ONLY) | ||||||||||||||||||||||
|
Comment on lines
+247
to
+251
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| #define SANITIZE_PRIORITY(setting,priority,source) (call {\ | ||||||||||||||||||||||
| private _priority = priority;\ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.