From 2b3b6083cb05ec9ea90d448ff61e1f270306ce6d Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Mon, 29 Feb 2016 14:06:14 -0600 Subject: [PATCH] Try to handle bad 3den mission modules --- .../common/functions/fnc_readSettingFromModule.sqf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/common/functions/fnc_readSettingFromModule.sqf b/addons/common/functions/fnc_readSettingFromModule.sqf index f7cb361c1b..a08f21c83e 100644 --- a/addons/common/functions/fnc_readSettingFromModule.sqf +++ b/addons/common/functions/fnc_readSettingFromModule.sqf @@ -24,5 +24,15 @@ if (isNil {_logic getVariable _moduleVariable}) exitWith { ACE_LOGWARNING_2("Warning in %1 module: %2 setting is missing. Probably an obsolete version of the module is used in the mission.",typeOf _logic,_moduleVariable); }; +private _value = _logic getVariable _moduleVariable; +if ((missionVersion > 12) && {_value isEqualTo -1}) then { + //3den missions will save modules with value = 0 as -1 + //If the setting has a "values" array, we should be able to assume that -1 is not a valid number as it would not be a valid index for the array + if (isArray (configFile >> "ACE_Settings" >> _settingName >> "values")) then { + ACE_LOGWARNING_1("3den Mission - Module For Setting [%1] is saved as (-1), switching to (0)",_settingName); + _value = 0; + }; +}; + // Set the setting globally and force it -[_settingName, _logic getVariable _moduleVariable, true, true] call FUNC(setSetting); +[_settingName, _value, true, true] call FUNC(setSetting);