2015-05-13 21:33:14 +00:00
|
|
|
/*
|
|
|
|
* Author: jaynus
|
|
|
|
*
|
|
|
|
* Master single PFH abstraction for all rounds being tracked by frag/spall
|
|
|
|
*
|
|
|
|
* Arguments:
|
2015-06-17 03:39:37 +00:00
|
|
|
*
|
2015-05-13 21:33:14 +00:00
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*/
|
2015-05-14 00:06:10 +00:00
|
|
|
//#define DEBUG_MODE_FULL
|
2015-05-13 21:33:14 +00:00
|
|
|
#include "script_component.hpp"
|
2015-05-14 00:06:10 +00:00
|
|
|
//PARAMS_2(_pfhArgs,_handle);
|
2015-05-13 21:33:14 +00:00
|
|
|
|
|
|
|
if (!GVAR(enabled)) exitWith {};
|
|
|
|
|
2015-06-19 03:04:48 +00:00
|
|
|
private["_gcIndex", "_iter"];
|
2015-05-13 21:33:14 +00:00
|
|
|
_gcIndex = [];
|
2015-05-14 00:06:10 +00:00
|
|
|
|
|
|
|
_iter = 0;
|
2015-06-19 03:04:48 +00:00
|
|
|
while { (count GVAR(objects)) > 0 && { _iter < (GVAR(MaxTrackPerFrame) min (count GVAR(objects))) } } do {
|
2015-05-13 21:33:14 +00:00
|
|
|
private["_object", "_args"];
|
2015-06-19 03:04:48 +00:00
|
|
|
if(GVAR(lastIterationIndex) >= (count GVAR(objects))) then {
|
2015-05-14 00:06:10 +00:00
|
|
|
GVAR(lastIterationIndex) = 0;
|
|
|
|
};
|
|
|
|
_object = GVAR(objects) select GVAR(lastIterationIndex);
|
2015-06-17 03:39:37 +00:00
|
|
|
|
2015-05-13 21:33:14 +00:00
|
|
|
if(!isNil "_object") then {
|
2015-06-17 03:39:37 +00:00
|
|
|
_args = GVAR(arguments) select GVAR(lastIterationIndex);
|
|
|
|
|
|
|
|
if(!(_args call FUNC(pfhRound))) then {
|
|
|
|
_gcIndex pushBack GVAR(lastIterationIndex); // Add it to the GC if it returns false
|
2015-05-13 21:33:14 +00:00
|
|
|
};
|
|
|
|
};
|
2015-05-14 00:06:10 +00:00
|
|
|
_iter = _iter + 1;
|
|
|
|
GVAR(lastIterationIndex) = GVAR(lastIterationIndex) + 1;
|
|
|
|
};
|
2015-05-13 21:33:14 +00:00
|
|
|
|
|
|
|
// clean up dead object references
|
|
|
|
private["_deletionCount", "_deleteIndex"];
|
|
|
|
_deletionCount = 0;
|
|
|
|
{
|
2015-05-14 00:06:10 +00:00
|
|
|
TRACE_1("GC Projectile", _x);
|
|
|
|
_deleteIndex = _x - _deletionCount;
|
2015-05-13 21:33:14 +00:00
|
|
|
GVAR(objects) deleteAt _deleteIndex;
|
|
|
|
GVAR(arguments) deleteAt _deleteIndex;
|
2015-06-17 03:39:37 +00:00
|
|
|
|
2015-05-13 21:33:14 +00:00
|
|
|
_deletionCount = _deletionCount + 1;
|
2015-06-19 03:04:48 +00:00
|
|
|
} forEach _gcIndex;
|