From 9d687b9b3eaef4033e2d74a1d8be7c9ac9daf19c Mon Sep 17 00:00:00 2001 From: commy2 Date: Tue, 20 Jan 2015 18:26:31 +0100 Subject: [PATCH] vector: fix potential error in FOS, prep settings, config --- .../functions/fnc_convertToTexturesFOS.sqf | 9 +++++-- addons/vector/functions/fnc_onKeyDown.sqf | 26 +++++++++++++++++++ addons/vector/functions/fnc_onKeyHold.sqf | 7 ++++- 3 files changed, 39 insertions(+), 3 deletions(-) diff --git a/addons/vector/functions/fnc_convertToTexturesFOS.sqf b/addons/vector/functions/fnc_convertToTexturesFOS.sqf index 79fe40962f..2a93f93548 100644 --- a/addons/vector/functions/fnc_convertToTexturesFOS.sqf +++ b/addons/vector/functions/fnc_convertToTexturesFOS.sqf @@ -15,8 +15,8 @@ _number = round (_number select _coordinate); _isNegative = _number < 0; _number = abs _number; -if (_number >= 10000) exitWith { - [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return +if (_number > 9999) exitWith { + [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return }; private ["_digit0", "_digit1", "_digit2", "_digit3", "_digit4"]; @@ -236,4 +236,9 @@ switch (_coordinate) do { }; }; +// trap errors +if ({typeName _x == "STRING"} count [_digit0, _digit1, _digit2, _digit3, _digit4] < 5) exitWith { + [QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa)), QUOTE(PATHTOF(rsc\vector_minus.paa))] // return +}; + [_digit0, _digit1, _digit2, _digit3, _digit4] diff --git a/addons/vector/functions/fnc_onKeyDown.sqf b/addons/vector/functions/fnc_onKeyDown.sqf index ec0b884ccc..f85a0ca030 100644 --- a/addons/vector/functions/fnc_onKeyDown.sqf +++ b/addons/vector/functions/fnc_onKeyDown.sqf @@ -29,6 +29,19 @@ switch (_this select 0) do { GVAR(isKeyDownAzimuth) = true; [false] call FUNC(showP1); + // handle 5 times clicking + if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) then { + GVAR(keyDownTabCountAzimuth) = (GETGVAR(keyDownTabCountAzimuth,0)) + 1; + GVAR(keyDownTimeAzimuth) = diag_tickTime; + } else { + GVAR(keyDownTabCountAzimuth) = 1; + }; + + // open config menu + if (GVAR(keyDownTabCountAzimuth) == 5) exitWith { + systemChat "0"; + }; + if (diag_tickTime < GVAR(keyDownTimeAzimuth) + 0.5) exitWith { "azimuth+inclination" call _fnc_setPFH; }; @@ -66,6 +79,19 @@ switch (_this select 0) do { GVAR(isKeyDownDistance) = true; [false] call FUNC(showP1); + // handle 5 times clicking + if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) then { + GVAR(keyDownTabCountDistance) = (GETGVAR(keyDownTabCountDistance,0)) + 1; + GVAR(keyDownTimeDistance) = diag_tickTime; + } else { + GVAR(keyDownTabCountDistance) = 1; + }; + + // open config menu + if (GVAR(keyDownTabCountDistance) == 5) exitWith { + systemChat "1"; + }; + if (diag_tickTime < GVAR(keyDownTimeDistance) + 0.5) exitWith { "height+distance" call _fnc_setPFH; }; diff --git a/addons/vector/functions/fnc_onKeyHold.sqf b/addons/vector/functions/fnc_onKeyHold.sqf index dded828d26..006c25853b 100644 --- a/addons/vector/functions/fnc_onKeyHold.sqf +++ b/addons/vector/functions/fnc_onKeyHold.sqf @@ -77,9 +77,14 @@ switch (_this select 0) do { case ("azimuth+inclination"): { + private "_isReady"; + _isReady = diag_tickTime > GVAR(keyDownTimeAzimuth) + 0.2; + [false] call FUNC(showCenter); - call FUNC(showAzimuthInclination); + if (_isReady) then { + call FUNC(showAzimuthInclination); + }; if (!GVAR(isKeyDownAzimuth)) then { [_this select 1] call CBA_fnc_removePerFrameHandler;