Optimize PFEH Funcs

This commit is contained in:
PabstMirror 2015-10-03 23:05:46 -05:00
parent c75d219b65
commit 59da3e1c35
2 changed files with 20 additions and 24 deletions

View File

@ -8,29 +8,23 @@
* Return Value:
* Turret Index <ARRAY>
*
* Example:
* [ace_player] call ace_common_fnc_getTurretIndex
*
* Public: Yes
*/
#include "script_component.hpp"
params ["_unit"];
private ["_vehicle", "_turrets", "_units", "_index"];
_vehicle = vehicle _unit;
local _vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {[]};
_turrets = allTurrets [_vehicle, true];
_units = [];
scopeName "main";
{
_units pushBack (_vehicle turretUnit _x);
false
} count _turrets;
if (_unit == (_vehicle turretUnit _x)) then {_x breakOut "main"};
nil
} count allTurrets [_vehicle, true];
_index = _units find _unit;
if (_index == -1) exitWith {[]};
_turrets select _index;
[]

View File

@ -1,26 +1,26 @@
/*
* Author: ?
* ?
* Author: jaynus
* PFEH to set all Ace Time Variables
*
* Arguments:
* ?
* None
*
* Return Value:
* ?
* None
*
* Public: ?
* Public: No
*/
#include "script_component.hpp"
private ["_lastTickTime", "_lastGameTime", "_delta"];
BEGIN_COUNTER(timePFH);
_lastTickTime = ACE_diagTime;
_lastGameTime = ACE_gameTime;
local _lastTickTime = ACE_diagTime;
local _lastGameTime = ACE_gameTime;
ACE_gameTime = time;
ACE_diagTime = diag_tickTime;
_delta = ACE_diagTime - _lastTickTime;
local _delta = ACE_diagTime - _lastTickTime;
if (ACE_gameTime <= _lastGameTime) then {
TRACE_1("paused",_delta);
@ -36,3 +36,5 @@ if (ACE_gameTime <= _lastGameTime) then {
ACE_virtualTime = ACE_virtualTime + (_delta * accTime);
ACE_time = ACE_virtualTime;
};
END_COUNTER(timePFH);