Skip to content

Commit

Permalink
Merge pull request #171 from jokoho48/fixPFHLoop
Browse files Browse the repository at this point in the history
fix RTP issue in PFH main Loop
  • Loading branch information
ViperMaul committed Oct 10, 2015
2 parents 0fca421 + 5ed791d commit 7a2a3f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion addons/common/fnc_removePerFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ Author:
#include "script_component.hpp"

params ["_publicHandle"];

if (isNil "_publicHandle" || {(_publicHandle < 0)} || {!((count GVAR(PFHhandles)) >= _publicHandle)}) exitWith { // Nil/no handle, nil action or handle is larger than Public Handle Array
WARNING("Invalid or not existing PFH ID.");
};

private "_handle";
if (isNil "_publicHandle" || (_publicHandle < 0)) exitWith {}; // Nil/no handle, nil action
_handle = GVAR(PFHhandles) select _publicHandle;
if (isNil "_handle") exitWith {}; // Nil handle, nil action
GVAR(PFHhandles) set [_publicHandle, nil];
Expand Down
6 changes: 4 additions & 2 deletions addons/common/init_perFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ FUNC(onFrame) = {
// GVAR(fpsCount) = GVAR(fpsCount) + 1;
// player sideChat format["c: %1", GVAR(perFrameHandlerArray)];
{

if !(isNil "_x") then {
if (_x params ["_func", "_delay", "_delta", "", "_args", "_idPFH"]) then {
_handlerData = _x;
if (_handlerData params ["_func", "_delay", "_delta", "", "_args", "_idPFH"]) then {
if (diag_tickTime > _delta) then {
[_args, _idPFH] call _func;
_delta = diag_tickTime + _delay;
//TRACE_1("data", _data);
_x set [2, _delta];
_handlerData set [2, _delta];
};
};
};
Expand Down

0 comments on commit 7a2a3f3

Please sign in to comment.