Update GMS_fnc_updateMissionQue.sqf

Updated method for deleting an element from the nested array. See:
https://community.bistudio.com/wiki/Array#Subtraction
This commit is contained in:
Ghostrider-DbD- 2017-01-12 05:24:37 -05:00 committed by GitHub
parent 6097404fa2
commit 4594e3e28e

View File

@ -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;