Skip to content
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

CBA settings fixes #409

Merged
merged 1 commit into from
Jul 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addons/settings/Cfg3DEN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Cfg3DEN {
displayName = "";
tooltip = "";
defaultValue = QUOTE(NULL_HASH);
expression = QUOTE(missionNamespace setVariable [ARR_3(QUOTE(QGVAR(hash)),_value,true)]);
expression = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing semicolon at the end

wikiType = "[[Array]]";
};
};
Expand Down
2 changes: 1 addition & 1 deletion addons/settings/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ADDON = false;
["Test_Setting_1", "CHECKBOX", ["-test checkbox-", "-tooltip-"], "My Category", true] call cba_settings_fnc_init;
["Test_Setting_2", "LIST", ["-test list-", "-tooltip-"], "My Category", [[1,0], ["enabled","disabled"], 1]] call cba_settings_fnc_init;
["Test_Setting_3", "SLIDER", ["-test slider-", "-tooltip-"], "My Category", [0, 10, 5, 0]] call cba_settings_fnc_init;
["Test_Setting_4", "COLOR", ["-test color-", "-tooltip-"], "My Category", [1,1,0]] call cba_settings_fnc_init;
["Test_Setting_4", "COLOR", ["-test color-", "-tooltip-"], "My Category", [1,1,0], false, {diag_log text format ["Color Setting Changed: %1", _this];}] call cba_settings_fnc_init;
#endif

// --- init settings namespaces
Expand Down
2 changes: 1 addition & 1 deletion addons/settings/fnc_init.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ if (!isNil "_settingInfo") then {
};

// --- read previous setting values from mission
_settingsHash = missionNamespace getVariable [QGVAR(hash), "Scenario" get3DENMissionAttribute QGVAR(hash)];
_settingsHash = getMissionConfigValue QGVAR(hash);

if (isNil "_settingsHash") then {
_settingsHash = NULL_HASH;
Copy link
Contributor

@commy2 commy2 Jul 7, 2016

Choose a reason for hiding this comment

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

We could use the alternative syntax of getMissionConfigValue to set NULL_HASH as default value.

There is one problem with this though. getMissionConfigValue only reports something if the mission.sqm exists. This means that all mission settings in 3den use default unless you saved the mission once.

While this makes no difference when previewing the mission (every mission settings use default there currently too), it means that when returning from preview the actual temporary mission settings and what is shown in the settings menu becomes desynched.

test:
getMissionConfigValue "cba_settings_hash"
vs.
"Scenario" get3DENMissionAttribute "cba_settings_hash"

This could be detected with missionName (will report "tempMissionSP" and "tempMissionMP" in MP 3den, as well as "" before the first preview).

We could store another copy of these settings in ui namespace if the mission was never saved. idk if that's worth it though.

Expand Down
2 changes: 1 addition & 1 deletion addons/settings/initMissionSettings.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
0 = 0 spawn {
{
// --- read previous setting values from mission
private _settingsHash = missionNamespace getVariable [QGVAR(hash), "Scenario" get3DENMissionAttribute QGVAR(hash)];
private _settingsHash = getMissionConfigValue QGVAR(hash);

if (isNil "_settingsHash") then {
_settingsHash = NULL_HASH;
Expand Down
2 changes: 1 addition & 1 deletion addons/settings/script_component.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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(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]) || {isMultiplayer && {NAMESPACE_GETVAR(GVAR(defaultSettings),setting,[]) param [7, 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])])]
Expand Down