Merge pull request #3476 from acemod/3den_-1

Try to handle -1 from eden modules
This commit is contained in:
Nicolás Badano 2016-02-29 20:17:52 -03:00
commit b69827aea8
2 changed files with 12 additions and 2 deletions

View File

@ -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 (_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_2("Module For Setting [%1] is saved as (-1), switching to (0) - missionVersion [%2]",_settingName,missionVersion);
_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);

View File

@ -33,4 +33,4 @@ if !(_activated) exitWith {};
[_logic, QGVAR(bleedingCoefficient), "bleedingCoefficient"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(painCoefficient), "painCoefficient"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(keepLocalSettingsSynced), "keepLocalSettingsSynced"] call EFUNC(common,readSettingFromModule);
[_logic, QGVAR(delayUnconCaptive), "delayUnconCaptive"] call EFUNC(common,readSettingFromModule);
// [_logic, QGVAR(delayUnconCaptive), "delayUnconCaptive"] call EFUNC(common,readSettingFromModule);