Skip to content

Settings - Fix Settings UI checkbox display, code cleanup - #1851

Open
LinkIsGrim wants to merge 4 commits into
CBATeam:masterfrom
LinkIsGrim:settings-fix-overwrite-visibility
Open

Settings - Fix Settings UI checkbox display, code cleanup#1851
LinkIsGrim wants to merge 4 commits into
CBATeam:masterfrom
LinkIsGrim:settings-fix-overwrite-visibility

Conversation

@LinkIsGrim

Copy link
Copy Markdown
Contributor

When merged this pull request will:

  • Replace Settings - Fix showing Mission checkboxes when on Mission tab #1839.

  • Fix the greyed out "Mission" overwrite checkboxes appearing on the Mission and Client tabs after changing category, by putting the checkboxes back after the row's controls group is shown, rather than by skipping the ctrlShow.

  • Handle other edge cases:

    • Clearing the search bar, or unfolding a sub-category, on the Mission or Client tab. Both bring a row back with ctrlShow, which shows every control inside it again, so the checkboxes the source doesn't use reappeared.
    • Toggling "Configure Base Game" and back to "Configure Addons" from the vanilla options menu. ctrlShow true on the addons group shows every category built inside it, so all of them were drawn on top of each other, and every row a search or a folded sub-category had hidden came back. Only the selected category is shown now, and its rows are re-filtered once the source is known again.
    • The "Overwrite mission" checkbox enabling itself on a row that can't be edited. gui_setOverwriteVisible used to ctrlEnable _show unconditionally, undoing gui_setRowEnabled for a setting locked by userconfig, the mission or the server config. It now only ever takes the enable away, so it can't fight gui_setRowEnabled or the row's updateUI_priority when it is re-applied.
  • Cleanup:

    • gui_setOverwriteVisible takes the row instead of a single checkbox and works both out from the row's own source and isGlobal, so it is repeatable and there is one place that knows which checkboxes a source uses. Removes the duplicated condition in gui_retargetRow.
    • gui_addonChanged iterates the options groups hashmap directly instead of keys + get.
    • Trailing whitespace in fnc_check.sqf and fnc_gui_addonChanged.sqf.

@PabstMirror PabstMirror added this to the 3.19.1 milestone Aug 23, 2026
Comment thread addons/settings/fnc_gui_setOverwriteVisible.sqf Outdated
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 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hemtt complains about help[L-S19]: Unneeded Not

Suggested change
if (_source isEqualTo "mission" && !ROW_IS_LOCAL_ONLY(_controlsGroup)) then {
private _isLocalOnly = ROW_IS_LOCAL_ONLY(_controlsGroup);
if (_source isEqualTo "mission" && !_isLocalOnly) then {

case "TIME": {
_settingData params ["_min", "_max"];
_value isEqualType 0 && {_value >= _min} && {_value <= _max} && {round _value == _value}
_value isEqualType 0 && {_value >= _min} && {_value <= _max} && {round _value == _value}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_value isEqualType 0 && {_value >= _min} && {_value <= _max} && {round _value == _value}
_value isEqualType 0 && {_value >= _min} && {_value <= _max} && {round _value isEqualTo _value}

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}}};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case "mission": {CAN_SET_MISSION_SETTINGS && !_isLocalOnly && {isNil {GVAR(missionConfig) getVariable _setting}}};
case "mission": {CAN_SET_MISSION_SETTINGS && !_isLocalOnly && {GVAR(missionConfig) isNil _setting}};

I do see the others use the older way.

Comment on lines +247 to +251
#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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#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)
#define IS_GLOBAL_SETTING(setting) (GVAR(default) getVariable [setting, []] param [7, 0] isEqualTo SETTING_GLOBAL_ONLY)
#define IS_LOCAL_SETTING(setting) (GVAR(default) getVariable [setting, []] param [7, 0] isEqualTo 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)]) isEqualTo SETTING_LOCAL_ONLY)

private _rowOrder = _ctrlOptionsGroup getVariable [QGVAR(rowOrder), []];
private _headerIndex = _rowOrder findIf {!isNil {_x getVariable QGVAR(members)}};

if (_headerIndex == -1) then {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (_headerIndex == -1) then {
if (_headerIndex isEqualTo -1) then {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants