From a2b6166aa0f70b0ab11eede862f90d0b172c448e Mon Sep 17 00:00:00 2001 From: commy2 Date: Sun, 4 Oct 2015 11:43:13 +0200 Subject: [PATCH] optimization waitUntilAndExecute, add comments --- addons/common/XEH_postInit.sqf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/common/XEH_postInit.sqf b/addons/common/XEH_postInit.sqf index 6f9f95f38f..29c798fb31 100644 --- a/addons/common/XEH_postInit.sqf +++ b/addons/common/XEH_postInit.sqf @@ -31,11 +31,12 @@ //Handle the waitUntilAndExec array: _deleted = 0; { - _x params ["_condition", "_code", "_args"]; - if ((_args call _condition)) then { + // if condition is satisifed call statement + if ((_x select 2) call (_x select 0)) then { + // make sure to delete the correct handle when multiple conditions are met in one frame GVAR(waitUntilAndExecArray) deleteAt (_forEachIndex - _deleted); _deleted = _deleted + 1; - _args call _code; + (_x select 2) call (_x select 1); }; } forEach GVAR(waitUntilAndExecArray); }, 0, []] call CBA_fnc_addPerFrameHandler;