From 4594e3e28e44476d80aca350c0d2c0163e7fda4d Mon Sep 17 00:00:00 2001 From: Ghostrider-DbD- Date: Thu, 12 Jan 2017 05:24:37 -0500 Subject: [PATCH] Update GMS_fnc_updateMissionQue.sqf Updated method for deleting an element from the nested array. See: https://community.bistudio.com/wiki/Array#Subtraction --- .../Missions/GMS_fnc_updateMissionQue.sqf | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf index 37a018e..0c6be39 100644 --- a/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf +++ b/@epochhive/addons/custom_server/Compiles/Missions/GMS_fnc_updateMissionQue.sqf @@ -11,15 +11,10 @@ if (blck_debugON) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 if (_mission isEqualTo (_x select 2)) exitWith { private _element = _x; - private _temp = []; - // first, remove the element from the array - { - if !(_mission isEqualTo (_x select 2)) then {_temp pushback _x}; - } forEach blck_pendingMissions; - //[_element,blck_pendingMissions] call blck_fnc_deleteFromArray; - blck_pendingMissions = _temp; - if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: _element = %1",_element];}; - // update the mission information + if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions began as %1",blck_pendingMissions];}; + blck_pendingMissions set[_forEachIndex, -1]; + blck_pendingMissions = blck_pendingMissions - [-1]; + if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions after deleteing element = %1 resulted in %2",_element,blck_pendingMissions];}; if (toLower(_status) isEqualTo "active") then { _element set[6, -1]; _element set[7,_coords]; @@ -31,9 +26,7 @@ if (blck_debugON) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 _element set [7,[0,0,0]]; }; if (blck_debugON) then {diag_log format["_fnc_updateMissionQue:: -- >> _element updated to %1",_x,_element];}; - // re-insert the mission information into the array blck_pendingMissions pushback _element; if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions];}; }; }forEach blck_pendingMissions; -