From 357f3a9cebcd28b88e847b9e205525b9adc0780c Mon Sep 17 00:00:00 2001 From: Dystopian Date: Sat, 16 Sep 2017 22:18:28 +0200 Subject: [PATCH] Add JIP event deleting if vehicle is deleted (#5506) --- addons/cargo/functions/fnc_setSize.sqf | 1 + addons/cargo/functions/fnc_setSpace.sqf | 1 + addons/refuel/functions/fnc_makeSource.sqf | 5 +---- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/cargo/functions/fnc_setSize.sqf b/addons/cargo/functions/fnc_setSize.sqf index 2e5c0aa441..660131045a 100644 --- a/addons/cargo/functions/fnc_setSize.sqf +++ b/addons/cargo/functions/fnc_setSize.sqf @@ -50,6 +50,7 @@ private _jipID = _object getVariable QGVAR(setSize_jipID); // Actions should be added to all future JIP players too if (isNil "_jipID") then { _jipID = [QGVAR(initObject), [_object]] call CBA_fnc_globalEventJIP; + [_jipID, _object] call CBA_fnc_removeGlobalEventJIP; // Store the ID for any future calls to this function _object setVariable [QGVAR(setSize_jipID), _jipID, true]; diff --git a/addons/cargo/functions/fnc_setSpace.sqf b/addons/cargo/functions/fnc_setSpace.sqf index 9f8ab85c68..156b0aa085 100644 --- a/addons/cargo/functions/fnc_setSpace.sqf +++ b/addons/cargo/functions/fnc_setSpace.sqf @@ -49,6 +49,7 @@ private _jipID = _vehicle getVariable QGVAR(setSpace_jipID); // Cargo menu should be added to all future JIP players too if (isNil "_jipID") then { _jipID = [QGVAR(initVehicle), [_vehicle]] call CBA_fnc_globalEventJIP; + [_jipID, _vehicle] call CBA_fnc_removeGlobalEventJIP; // Store the ID for any future calls to this function _vehicle setVariable [QGVAR(setSpace_jipID), _jipID, true]; diff --git a/addons/refuel/functions/fnc_makeSource.sqf b/addons/refuel/functions/fnc_makeSource.sqf index 2ea940f2db..05707e5301 100644 --- a/addons/refuel/functions/fnc_makeSource.sqf +++ b/addons/refuel/functions/fnc_makeSource.sqf @@ -56,8 +56,5 @@ if ( if (_fuelCargoConfig != 0 || {!isNil {_source getVariable QGVAR(initSource_jipID)}}) exitWith {}; private _jipID = [QGVAR(initSource), [_source]] call CBA_fnc_globalEventJIP; +[_jipID, _source] call CBA_fnc_removeGlobalEventJIP; _source setVariable [QGVAR(initSource_jipID), _jipID]; -_source addEventHandler ["Deleted", { - // delete event from JIP stack to prevent deleted vehicle init - cba_events_eventNamespaceJIP setVariable [(_this select 0) getVariable QGVAR(initSource_jipID), nil, true]; -}];