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: * Return Value:
* Turret Index <ARRAY> * Turret Index <ARRAY>
* *
* Example:
* [ace_player] call ace_common_fnc_getTurretIndex
*
* Public: Yes * Public: Yes
*/ */
#include "script_component.hpp" #include "script_component.hpp"
params ["_unit"]; params ["_unit"];
private ["_vehicle", "_turrets", "_units", "_index"]; local _vehicle = vehicle _unit;
_vehicle = vehicle _unit;
if (_unit == _vehicle) exitWith {[]}; if (_unit == _vehicle) exitWith {[]};
_turrets = allTurrets [_vehicle, true]; scopeName "main";
_units = [];
{ {
_units pushBack (_vehicle turretUnit _x); if (_unit == (_vehicle turretUnit _x)) then {_x breakOut "main"};
false nil
} count _turrets; } 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: * Arguments:
* ? * None
* *
* Return Value: * Return Value:
* ? * None
* *
* Public: ? * Public: No
*/ */
#include "script_component.hpp" #include "script_component.hpp"
private ["_lastTickTime", "_lastGameTime", "_delta"]; BEGIN_COUNTER(timePFH);
_lastTickTime = ACE_diagTime; local _lastTickTime = ACE_diagTime;
_lastGameTime = ACE_gameTime; local _lastGameTime = ACE_gameTime;
ACE_gameTime = time; ACE_gameTime = time;
ACE_diagTime = diag_tickTime; ACE_diagTime = diag_tickTime;
_delta = ACE_diagTime - _lastTickTime; local _delta = ACE_diagTime - _lastTickTime;
if (ACE_gameTime <= _lastGameTime) then { if (ACE_gameTime <= _lastGameTime) then {
TRACE_1("paused",_delta); TRACE_1("paused",_delta);
@ -36,3 +36,5 @@ if (ACE_gameTime <= _lastGameTime) then {
ACE_virtualTime = ACE_virtualTime + (_delta * accTime); ACE_virtualTime = ACE_virtualTime + (_delta * accTime);
ACE_time = ACE_virtualTime; ACE_time = ACE_virtualTime;
}; };
END_COUNTER(timePFH);