Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RPT issue in PFH main Loop #171

Merged
merged 3 commits into from
Oct 10, 2015
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion addons/common/fnc_removePerFrameHandler.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ Author:

params ["_publicHandle"];
private "_handle";
if (isNil "_publicHandle" || (_publicHandle < 0)) exitWith {}; // Nil/no handle, nil action
if ((isNil "_publicHandle" || (_publicHandle < 0)) && {(count GVAR(PFHhandles)) < _publicHandle}) exitWith { // Nil/no handle, nil action or handle is larger than Public Handle Array
WARNING("PFH ID allready Removed or handle Not Exist or handle is smaller than 0");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PFH ID already removed or handle does not exist or handle is smaller than 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go with Invalid or not existing PFH ID.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's even better.

};
_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