This commit is contained in:
SilentSpike 2015-11-18 13:10:01 +00:00
parent a718c82780
commit 49d4f233d9
4 changed files with 14 additions and 21 deletions

View File

@ -27,10 +27,7 @@ _aceTimeSecond = floor ACE_time;
_bulletSpeed = vectorMagnitude _bulletVelocity;
if (!alive _bullet || _bulletSpeed < 100) then {
GVAR(allBullets) deleteAt _forEachIndex;
// An index was removed, remember to account for it
_forEachIndex = _forEachIndex - 1;
GVAR(allBullets) deleteAt (GVAR(allBullets) find _x);
} else {
_bulletPosition = getPosASL _bullet;
@ -40,7 +37,8 @@ _aceTimeSecond = floor ACE_time;
call compile ("ace_advanced_ballistics" callExtension format["simulate:%1:%2:%3:%4:%5:%6:%7", _index, _bulletVelocity, _bulletPosition, ACE_wind, ASLToATL(_bulletPosition) select 2, _aceTimeSecond, ACE_time - _aceTimeSecond]);
};
} forEach GVAR(allBullets);
nil
} count +GVAR(allBullets);
if (GVAR(allBullets) isEqualTo []) then {
[_this select 1] call CBA_fnc_removePerFrameHandler;

View File

@ -32,13 +32,12 @@
{
// if condition is satisifed call statement
if ((_x select 2) call (_x select 0)) then {
GVAR(waitUntilAndExecArray) deleteAt _forEachIndex;
// make sure to delete the correct handle when multiple conditions are met in one frame
GVAR(waitUntilAndExecArray) deleteAt (GVAR(waitUntilAndExecArray) find _x);
(_x select 2) call (_x select 1);
// An index was removed, remember to account for it
_forEachIndex = _forEachIndex - 1;
};
} forEach GVAR(waitUntilAndExecArray);
nil
} count +GVAR(waitUntilAndExecArray);
END_COUNTER(waitAndExec);
}, 0, []] call CBA_fnc_addPerFrameHandler;

View File

@ -43,13 +43,11 @@ GVAR(setVariablePublicPFH) = [{
if (ACE_diagTime > _syncTime) then {
// set value public
_object setVariable [_varName, _object getVariable _varName, true];
GVAR(setVariablePublicArray) deleteAt _forEachIndex;
GVAR(setVariableNames) deleteAt _forEachIndex;
// An index was removed, remember to account for it
_forEachIndex = _forEachIndex - 1;
GVAR(setVariablePublicArray) deleteAt (GVAR(setVariablePublicArray) find _x);
GVAR(setVariableNames) deleteAt (GVAR(setVariableNames) find _x);
};
} forEach GVAR(setVariablePublicArray);
nil
} count +GVAR(setVariablePublicArray);
if (GVAR(setVariablePublicArray) isEqualTo []) then {
[GVAR(setVariablePublicPFH)] call CBA_fnc_removePerFrameHandler;

View File

@ -34,10 +34,7 @@
_bulletSpeed = vectorMagnitude _bulletVelocity;
if ((!alive _bullet) || {(_bullet isKindOf "BulletBase") && {_bulletSpeed < 100}}) then {
GVAR(trackedBullets) deleteAt _forEachIndex;
// An index was removed, remember to account for it
_forEachIndex = _forEachIndex - 1;
GVAR(trackedBullets) deleteAt (GVAR(trackedBullets) find _x);
} else {
if (_isWind) then {
_trueVelocity = _bulletVelocity vectorDiff ACE_wind;
@ -53,6 +50,7 @@
};
_bullet setVelocity _bulletVelocity;
};
} forEach GVAR(trackedBullets);
nil
} count +GVAR(trackedBullets);
// END_COUNTER(pfeh);
}, GVAR(simulationInterval), [ACE_time]] call CBA_fnc_addPerFrameHandler;