Update GMS_fnc_updateMissionQue.sqf

Fixed an issue whereby the array containing mission information was not correctly updated. this was caused by the fact that simple array subtraction does not work for nested arrays, hence the kludgy fix wherein a new array is built that lacks the element to be deleted.
This commit is contained in:
Ghostrider-DbD- 2017-01-12 04:33:47 -05:00 committed by GitHub
parent 0195ac0190
commit e0cf102ef4

View File

@ -2,17 +2,24 @@
Update the parameters for a mission in the list of missions running at that time.
Call with the name of the marker associated with the mission and either "Active" or "Completed"
by Ghostrider-DbD-
Last modified 10-14-16
Last modified 1-12-17
*/
params["_mission","_status",["_coords",[0,0,0]] ];
diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords];
if (blck_debugON) then {diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords = %3",_mission,_status,_coords];};
{
if (_mission isEqualTo (_x select 2)) exitWith
{
private _element = _x;
diag_log format ["_fnc_updateMissionQue :: _element = %1",_element];
blck_pendingMissions = blck_pendingMissions - _element;
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 (toLower(_status) isEqualTo "active") then {
_element set[6, -1];
_element set[7,_coords];
@ -23,9 +30,10 @@ diag_log format["_fnc_updateMissionQue :: _mission = %1 | _status = %2 | _coords
_element set[6, _waitTime];
_element set [7,[0,0,0]];
};
diag_log format["_fnc_updateMissionQue:: -- >> _element updated from %1 to %2",_x,_element];
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;
diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions];
if (blck_debugON) then {diag_log format ["_fnc_updateMissionQue :: blck_pendingMissions updated to %1",blck_pendingMissions];};
};
}forEach blck_pendingMissions;