From 61029ba723d79be2b41123c7246b1f5c8e6f988f Mon Sep 17 00:00:00 2001 From: lambdatiger Date: Wed, 14 Feb 2024 17:56:05 -0600 Subject: [PATCH] Update addons/frag/functions/fnc_dev_addRound.sqf If the round isn't in the hashmap anymore, we have to stop the PFH. Brought code up to same standard as used in FUNC(dev_trackObj). - johnb432 Co-authored-by: johnb432 <58661205+johnb432@users.noreply.github.com> --- addons/frag/functions/fnc_dev_addRound.sqf | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/frag/functions/fnc_dev_addRound.sqf b/addons/frag/functions/fnc_dev_addRound.sqf index 498f6ffad5..a1cc372bb7 100644 --- a/addons/frag/functions/fnc_dev_addRound.sqf +++ b/addons/frag/functions/fnc_dev_addRound.sqf @@ -37,17 +37,22 @@ if (_isSidePlayer) then { [ { if (isGamePaused) exitWith {}; - params ["_params", "_handle"]; - _params params ["_projectile"]; + params ["_projectile", "_handle"]; + if (!alive _projectile) exitWith { [_handle] call CBA_fnc_removePerFrameHandler; }; - private _projectileArray = GVAR(dev_trackLines) getOrDefault [getObjectID _projectile, -1]; - if (_projectileArray isEqualType 0) exitWith {}; + + private _projectileArray = GVAR(dev_trackLines) get (getObjectID _projectile); + + if (isNil "_projectileArray") exitWith { + [_handle] call CBA_fnc_removePerFrameHandler; + }; + (_projectileArray#0) pushBack getPosATL _projectile; }, 0, - [_projectile] + _projectile ] call CBA_fnc_addPerFrameHandler; if (!_addProjectileEventHandlers) exitWith {};