Fixed the target speed assist feature:

*Replaced while/sleep with a PFH
This commit is contained in:
ulteq 2015-04-10 15:02:45 +02:00
parent f7944381af
commit f003ff590e

View File

@ -3,26 +3,31 @@
#define _dsp (uiNamespace getVariable "ATragMX_Display")
if !(ctrlVisible 9000) then {
private ["_startTime"];
false execVM QUOTE(PATHTOF(functions\fnc_show_target_speed_assist.sqf));
true execVM QUOTE(PATHTOF(functions\fnc_show_target_speed_assist_timer.sqf));
ctrlSetFocus (_dsp displayCtrl 9002);
[{
private ["_args", "_startTime"];
_args = _this select 0;
_startTime = _args select 0;
if (!(GVAR(speedAssistTimer))) exitWith {
GVAR(speedAssistTimer) = true;
ctrlSetText [8006, Str(Round((time - _startTime) * 10) / 10)];
_startTime = time;
[] call FUNC(calculate_target_speed_assist);
while {GVAR(speedAssistTimer)} do {
sleep 0.1;
false execVM QUOTE(PATHTOF(functions\fnc_show_target_speed_assist_timer.sqf));
true execVM QUOTE(PATHTOF(functions\fnc_show_target_speed_assist.sqf));
[_this select 1] call cba_fnc_removePerFrameHandler;
};
ctrlSetText [9001, Str(Round((time - _startTime) * 10) / 10)];
};
GVAR(speedAssistTimer) = true;
ctrlSetText [8006, Str(Round((time - _startTime) * 10) / 10)];
[] call FUNC(calculate_target_speed_assist);
false execVM QUOTE(PATHTOF(functions\fnc_show_target_speed_assist_timer.sqf));
true execVM QUOTE(PATHTOF(functions\fnc_show_target_speed_assist.sqf));
}, 0.1, [time]] call CBA_fnc_addPerFrameHandler;
};