diff --git a/addons/main/script_mod.hpp b/addons/main/script_mod.hpp index ec100c6..10d52eb 100644 --- a/addons/main/script_mod.hpp +++ b/addons/main/script_mod.hpp @@ -8,7 +8,7 @@ #define VERSION_AR MAJOR,MINOR,PATCHLVL,BUILD #define VERSION_PLUGIN MAJOR.MINOR.PATCHLVL.BUILD -#define REQUIRED_VERSION 2.16 +#define REQUIRED_VERSION 2.18 #ifdef COMPONENT_BEAUTIFIED #define COMPONENT_NAME QUOTE(DUI - COMPONENT_BEAUTIFIED) diff --git a/addons/nametags/XEH_postInit.sqf b/addons/nametags/XEH_postInit.sqf index 6aa424a..9cbf701 100644 --- a/addons/nametags/XEH_postInit.sqf +++ b/addons/nametags/XEH_postInit.sqf @@ -2,8 +2,6 @@ if !(hasInterface) exitWith {}; -GVAR(targetedFade) = 1; - call FUNC(cacheLoop); player setVariable [QGVAR(name), name player]; diff --git a/addons/nametags/functions/fnc_onDraw.sqf b/addons/nametags/functions/fnc_onDraw.sqf index 7a8f11d..abc7587 100644 --- a/addons/nametags/functions/fnc_onDraw.sqf +++ b/addons/nametags/functions/fnc_onDraw.sqf @@ -10,6 +10,7 @@ if ((ctrlPosition _ctrl) isNotEqualTo _pos) then { private _target = cursorObject; private _player = call CBA_fnc_currentUnit; +private _targetedFade = 1; if (GVAR(useLIS)) then { private _skipVicCheck = (netId _target) isEqualTo "1:0"; // only ever true when cursorObject returns the weapon of a @@ -42,10 +43,7 @@ if (GVAR(useLIS)) then { } forEach _lis; }; -if (isNull _target || {!(player call EFUNC(main,canHudBeShown)) || {unitIsUAV _target}}) then { - GVAR(targetedFade) = 1; -} else { - +if !(isNull _target || {!(player call EFUNC(main,canHudBeShown)) || {unitIsUAV _target}}) then { private _effectiveCommander = effectiveCommander _target; if !(isNull _effectiveCommander) then { _target = _effectiveCommander; @@ -59,8 +57,8 @@ if (isNull _target || {!(player call EFUNC(main,canHudBeShown)) || {unitIsUAV _t _targetSide isEqualTo _playerSide; }; if (_target isKindOf "AllVehicles" && {_areFriendly}) then { - GVAR(targetedFade) = [_target, _player] call FUNC(calculateFadeValue); - if (GVAR(targetedFade) < 1) then { + _targetedFade = (([_target, _player] call FUNC(calculateFadeValue)) min 1) max 0; + if (_targetedFade < 1) then { private _color = EGVAR(main,colors_custom) getVariable ["otherName", "#33FF00"]; // Other Group Default Color private _colorGroup = EGVAR(main,colors_custom) getVariable ["otherGroup", "#99D999"]; // Other Group Default Color if ((group _target) isEqualTo (group _player)) then { @@ -93,17 +91,8 @@ if (isNull _target || {!(player call EFUNC(main,canHudBeShown)) || {unitIsUAV _t // TODO(joko): Add Extra Fade for Group? _ctrl ctrlSetStructuredText parseText (_data joinString ""); }; - } else { - GVAR(targetedFade) = 1; }; }; -GVAR(targetedFade) = (GVAR(targetedFade) min 1) max 0; - -private _fadeIn = GVAR(targetedFade) <= ctrlFade _ctrl; -_ctrl ctrlSetFade GVAR(targetedFade); -if (_fadeIn) then { - _ctrl ctrlCommit GVAR(fadeInTime); -} else { - _ctrl ctrlCommit GVAR(fadeOutTime); -}; +_ctrl ctrlSetFade _targetedFade; +_ctrl ctrlCommit ([GVAR(fadeOutTime), GVAR(fadeInTime)] select (_targetedFade <= ctrlFade _ctrl)); diff --git a/addons/radar/functions/fnc_cacheLoop.sqf b/addons/radar/functions/fnc_cacheLoop.sqf index e8b2dd3..4b48119 100644 --- a/addons/radar/functions/fnc_cacheLoop.sqf +++ b/addons/radar/functions/fnc_cacheLoop.sqf @@ -13,14 +13,15 @@ if (GVAR(syncGroup) && {isMultiplayer && {GVAR(sortType) isEqualTo "none" && {lo // if both compass and namelist are not enabled, just remove the controls if there are any if !(diwako_dui_enable_compass || diwako_dui_namelist) exitWith { - for "_i" from 0 to (count GVAR(namebox_lists)) do { + { ctrlDelete ctrlParentControlsGroup (GVAR(namebox_lists) deleteAt 0); - }; + } forEach GVAR(namebox_lists); "diwako_dui_namebox" cutRsc ["diwako_dui_RscNameBox","PLAIN", 0, true]; }; _group = (group _player) getVariable [QGVAR(syncGroup), _group]; -if (diwako_dui_compass_hide_blip_alone_group && {(count _group) <= 1}) then { +private _isAloneInGroup = (count _group) <= 1; +if (diwako_dui_compass_hide_blip_alone_group && {_isAloneInGroup}) then { _group = []; }; @@ -168,10 +169,10 @@ private _lists = GVAR(namebox_lists); // delete all name list controls if not active if (!diwako_dui_namelist || {GVAR(namelist_hideWhenLeader) && (leader _player) isEqualTo _player}) exitWith { - if ((count _lists) > 0) then { - for "_i" from (count _lists) -1 to 0 step -1 do { - ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); - }; + if (_lists isNotEqualTo []) then { + { + ctrlDelete ctrlParentControlsGroup (_lists deleteAt _forEachIndex); + } forEachReversed _lists; "diwako_dui_namebox" cutText ["","PLAIN"]; }; }; @@ -208,12 +209,10 @@ ctrlPosition _grpCtrl params ["", "", "", "_height"]; private _curNameListHeight = (_height / pixelH) - ((15 * _uiScale) max 15); // no need to show any names if you are alone in the group -if (count _group <= 1) exitWith { - if ((count _lists) > 0) then { - for "_i" from (count _lists) -1 to 0 step -1 do { - ctrlDelete ctrlParentControlsGroup (_lists deleteAt _i); - }; - }; +if (_isAloneInGroup) exitWith { + { + ctrlDelete ctrlParentControlsGroup (_lists deleteAt _forEachIndex); + } forEachReversed _lists; }; if !(ctrlShown _grpCtrl) then { _grpCtrl ctrlShow true; diff --git a/addons/radar/functions/fnc_compassPFH.sqf b/addons/radar/functions/fnc_compassPFH.sqf index 96120d6..a12c9bf 100644 --- a/addons/radar/functions/fnc_compassPFH.sqf +++ b/addons/radar/functions/fnc_compassPFH.sqf @@ -14,7 +14,6 @@ if !(diwako_dui_enable_compass) exitWith { private _player = [] call CBA_fnc_currentUnit; private _grp = GVAR(group); -private _pointers = GVAR(pointers); if (diwako_dui_compass_hide_alone_group && {count (units group _player) <= 1}) exitWith { _compassCtrl ctrlShow false; @@ -65,22 +64,22 @@ if ([_player] call EFUNC(main,canHudBeShown)) then { ctrlDelete _x; } forEach (_ctrls - _usedCtrls); - if (diwako_dui_compass_hide_blip_alone_group && { _grp isEqualTo (missionNamespace getVariable ["diwako_dui_special_track", []]) && {(count _usedCtrls) > 0}}) then { + if (diwako_dui_compass_hide_blip_alone_group && { + _grp isEqualTo (missionNamespace getVariable ["diwako_dui_special_track", []]) && { + _usedCtrls isNotEqualTo []}}) then { _usedCtrls pushBack (([[_player], _display, _dir, _playerDir, _player, _ctrlGrp] call FUNC(displayUnitOnCompass)) select 0); }; _ctrlGrp setVariable ["diwako_dui_ctrlArr", _usedCtrls]; - if (_pointers isNotEqualTo []) then { - for "_i" from (count _pointers) -1 to 0 step -1 do { - (_pointers select _i) params [["_pointer", controlNull], "_pointerPos"]; - if (isNull _pointer) then { - _pointers deleteAt _i; - } else { - _pointer ctrlSetAngle [(((_player getRelDir (_pointerPos)) - (_dir - _playerDir) ) mod 360), 0.5, 0.5, false]; - _pointer ctrlCommit 0; - }; + { + _x params [["_pointer", controlNull], "_pointerPos"]; + if (isNull _pointer) then { + GVAR(pointers) deleteAt _forEachIndex; + } else { + _pointer ctrlSetAngle [(((_player getRelDir (_pointerPos)) - (_dir - _playerDir) ) mod 360), 0.5, 0.5, false]; + _pointer ctrlCommit 0; }; - }; + } forEachReversed GVAR(pointers); if !(isNil "diwako_dui_custom_code") then { /* diff --git a/tools/sqf_linter_LogChecker.py b/tools/sqf_linter_LogChecker.py index 17d1527..96d21e6 100644 --- a/tools/sqf_linter_LogChecker.py +++ b/tools/sqf_linter_LogChecker.py @@ -1,7 +1,7 @@ import sys import os -defaultFalsePositives = 38 # Change 0 to Current number of false positives +defaultFalsePositives = 42 # Change 0 to Current number of false positives def main(): f = open("sqf.log", "r") log = f.readlines()