Skip to content

Commit

Permalink
Add warning in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
veteran29 committed Oct 12, 2023
1 parent 5404e3e commit 787d38b
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions addons/settings/fnc_gui_sourceChanged.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private _selectedAddon = uiNamespace getVariable QGVAR(addon);

(_display displayCtrl IDC_TXT_OVERWRITE_CLIENT) ctrlShow (_selectedSource isNotEqualTo "client");
(_display displayCtrl IDC_TXT_OVERWRITE_MISSION) ctrlShow (_selectedSource isEqualTo "server");
(_display displayCtrl IDC_TXT_VOLATILE_WARNING) ctrlShow (_selectedSource isEqualTo "server" && GVAR(volatile));

// enable / disable IMPORT and LOAD buttons
private _ctrlButtonImport = _display displayCtrl IDC_BTN_IMPORT;
Expand Down
9 changes: 9 additions & 0 deletions addons/settings/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ class RscDisplayGameOptions {
idc = IDC_TXT_OVERWRITE_MISSION;
x = QUOTE(POS_W(33));
};
class VolatileWarningText: OverwriteClientText {
onLoad = QUOTE((_this select 0) ctrlEnable true;);
idc = IDC_TXT_VOLATILE_WARNING;
style = ST_LEFT;
text = CSTRING(volatile);
tooltip = CSTRING(volatile_tooltip);
x = QUOTE(POS_W(1));
w = QUOTE(POS_W(24));
};
};
};
};
Expand Down
5 changes: 3 additions & 2 deletions addons/settings/initSettings.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// inline function, don't include script_component.hpp

if (isNil QGVAR(default)) then {
private _volatile = uiNamespace getVariable QGVAR(volatile);

GVAR(allSettings) = [];
GVAR(default) = [] call CBA_fnc_createNamespace;

Expand All @@ -10,13 +12,12 @@ if (isNil QGVAR(default)) then {

if (isNil QGVAR(server)) then {
GVAR(server) = NAMESPACE_NULL;

private _volatile = uiNamespace getVariable QGVAR(volatile);
GVAR(serverHashNamespace) = [profileNamespace, uiNamespace] select _volatile;
};

if (isServer) then {
missionNamespace setVariable [QGVAR(server), true call CBA_fnc_createNamespace, true];
missionNamespace setVariable [QGVAR(volatile), _volatile, true];
};

// --- read userconfig file
Expand Down
1 change: 1 addition & 0 deletions addons/settings/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#define IDC_BTN_CONFIGURE 9030
#define IDC_TXT_OVERWRITE_CLIENT 9040
#define IDC_TXT_OVERWRITE_MISSION 9041
#define IDC_TXT_VOLATILE_WARNING 9042

#define IDC_SETTING_CONTROLS_GROUP 5000
#define IDC_SETTING_BACKGROUND 5001
Expand Down
8 changes: 8 additions & 0 deletions addons/settings/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,14 @@
<Czech>Resetovat na původní hodnotu.</Czech>
<Korean>기본값으로 초기화합니다.</Korean>
</Key>
<Key ID="STR_cba_settings_volatile">
<English>Changes will not persist after server restart</English>
<Polish>Zmiany nie zostaną zachowane po restarcie serwera</Polish>
</Key>
<Key ID="STR_cba_settings_volatile_tooltip">
<English>The server is configured to discard all changes to its setting after it will be restarted.\nChanges will persist between mission restarts.</English>
<Polish>Serwer jest skonfigurowany tak, aby odrzucać wszystkie zmiany w ustawieniach gdy zostanie zrestartowany.\nZmiany zostaną zachowane między restartami misji.</Polish>
</Key>
<Key ID="STR_cba_settings_overwrite_clients">
<English>Overwrite\nClients</English>
<German>Clients\nüberschreiben</German>
Expand Down

0 comments on commit 787d38b

Please sign in to comment.