Skip to content

Commit ba28ec5

Browse files
authored
General - Replace count with findIf (#11243)
1 parent e7ab2c5 commit ba28ec5

File tree

17 files changed

+26
-26
lines changed

17 files changed

+26
-26
lines changed

addons/ai/functions/fnc_garrison.sqf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if (_topDownFilling) then {
8585
_buildingsIndex = _buildingsIndex apply {
8686
_x select {
8787
private _testedPos = _x;
88-
({(_x select 1) isEqualTo _testedPos} count (missionNamespace getVariable [QGVAR(garrison_unitMoveList), []])) == 0
88+
(missionNamespace getVariable [QGVAR(garrison_unitMoveList), []]) findIf {(_x select 1) isEqualTo _testedPos} == -1
8989
}
9090
};
9191

@@ -105,13 +105,13 @@ private _unitMoveList = [];
105105

106106
private _fnc_comparePos = {
107107
params ["_nearestUnits", "_pos"];
108-
({
108+
(_nearestUnits findIf {
109109
if (surfaceIsWater getPos _x) then {
110110
floor ((getPosASL _x) select 2) == floor ((AGLToASL _pos) select 2)
111111
} else {
112112
floor ((getPosATL _x) select 2) == floor (_pos select 2)
113113
};
114-
} count _nearestUnits) > 0
114+
}) != -1
115115
};
116116

117117
// Do the placement
@@ -268,7 +268,7 @@ private _garrison_unitMoveList = missionNamespace getVariable [QGVAR(garrison_un
268268

269269
_garrison_unitMoveList = _garrison_unitMoveList select {
270270
_x params ["_testedUnit", "_testedPos"];
271-
({(_x select 0) isEqualTo _testedUnit} count _unitMoveList == 0)
271+
_unitMoveList findIf {(_x select 0) isEqualTo _testedUnit} == -1
272272
};
273273

274274
_garrison_unitMoveList append _unitMoveList;

addons/ai/functions/fnc_garrisonMove.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ if (isNil QGVAR(garrison_moveUnitPFH)) then {
7777
[QGVAR(AISection), [[_unit], ["PATH"], false], _unit] call CBA_fnc_targetEvent;
7878
[QGVAR(AISection), [[_unit], ["FSM"], true], _unit] call CBA_fnc_targetEvent;
7979

80-
if ({(_x select 0) in units _unit && {!isPlayer (_x select 0)}} count _unitMoveList == 0) then {
80+
if (_unitMoveList findIf {(_x select 0) in units _unit && {!isPlayer (_x select 0)}} == -1) then {
8181
[QGVAR(enableAttack), [[_unit], true], _unit] call CBA_fnc_targetEvent;
8282
};
8383

addons/common/functions/fnc_displayIcon.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private _refresh = {
8585
};
8686

8787
if (_show) then {
88-
if ({_x select 0 == _iconId} count _list == 0) then {
88+
if (_list findIf {_x select 0 == _iconId} == -1) then {
8989
_list pushBack [_iconId, _icon, _color, CBA_missionTime];
9090
} else {
9191
{

addons/dagr/functions/fnc_menuInit.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ GVAR(menuRun) = true;
523523
(__dsp displayCtrl __mainText) ctrlSetText "Connecting...";
524524
};
525525
if (CBA_missionTime - GVAR(busyTimer) > 0.6) then {
526-
if (({_x isKindOf ["ACE_Vector", configFile >> "CfgWeapons"]} count (weapons ACE_player)) > 0) then {
526+
if ((weapons ACE_player) findIf {_x isKindOf ["ACE_Vector", configFile >> "CfgWeapons"]} != -1) then {
527527
GVAR(displaySelection) = "VECTOR";
528528
(__dsp displayCtrl __mainText) ctrlSetText "Vector Connected";
529529
GVAR(vectorConnected) = true;

addons/fastroping/functions/fnc_canCutRopes.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ params ["_vehicle"];
1919
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
2020

2121
(_deployedRopes isNotEqualTo []) &&
22-
{{(_x select 5)} count (_deployedRopes) == 0}
22+
{_deployedRopes findIf {_x select 5} == -1}

addons/fastroping/functions/fnc_canFastRope.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
2121

2222
((driver _vehicle != _unit) &&
2323
{_deployedRopes isNotEqualTo []} &&
24-
{{!(_x select 5) && !(_x select 6)} count (_deployedRopes) > 0} &&
24+
{_deployedRopes findIf {!(_x select 5) && !(_x select 6)} != -1} &&
2525
{getPos _vehicle select 2 > 2})

addons/fastroping/functions/fnc_deployAI.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ DFUNC(deployAIRecursive) = {
8080
[{
8181
params ["_vehicle"];
8282
private _deployedRopes = _vehicle getVariable [QGVAR(deployedRopes), []];
83-
({!(_x select 5)} count (_deployedRopes)) > 0
83+
(_deployedRopes findIf {!(_x select 5)}) != -1
8484
}, FUNC(deployAIRecursive), _this] call CBA_fnc_waitUntilAndExecute;
8585
}, [_vehicle, _unitsToDeploy], 1] call CBA_fnc_waitAndExecute;
8686
} else {
8787
[{
8888
private _deployedRopes = _this getVariable [QGVAR(deployedRopes), []];
89-
({_x select 5} count (_deployedRopes)) == 0
89+
_deployedRopes findIf {_x select 5} == -1
9090
}, {
9191
[_this] call FUNC(cutRopes);
9292
driver _this enableAI "MOVE";

addons/huntir/functions/fnc_huntir.sqf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ createDialog QGVAR(cam_dialog_off);
8484
GVAR(state) = "noGDS";
8585
[QGVAR(monitorNoGDS), [ACE_player]] call CBA_fnc_localEvent;
8686
};
87-
if (_elapsedTime > 5 && {{_x getHitPointDamage "HitCamera" < 0.25} count _nearestHuntIRs > 0}) then {
87+
if (_elapsedTime > 5 && {_nearestHuntIRs findIf {_x getHitPointDamage "HitCamera" < 0.25} != -1}) then {
8888
GVAR(state) = "connecting";
8989
[QGVAR(monitorConnecting), [ACE_player]] call CBA_fnc_localEvent;
9090
};

addons/map/functions/fnc_blueForceTrackingUpdate.sqf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then {
3333

3434
if (GVAR(BFT_HideAiGroups)) then {
3535
_groupsToDrawMarkers = _groupsToDrawMarkers select {
36-
{
36+
(units _x) findIf {
3737
_x call EFUNC(common,isPlayer);
38-
} count units _x > 0;
38+
} != -1;
3939
};
4040
};
4141

@@ -55,9 +55,9 @@ if (GVAR(BFT_Enabled) and {(!isNil "ACE_player") and {alive ACE_player}}) then {
5555
} forEach _playersToDrawMarkers;
5656

5757
_groupsToDrawMarkers = _groupsToDrawMarkers select {
58-
{
58+
(units _x) findIf {
5959
!(_x call EFUNC(common,isPlayer));
60-
} count units _x > 0;
60+
} != -1;
6161
};
6262
};
6363

addons/medical_feedback/XEH_postInit.sqf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ GVAR(bloodTickCounter) = 0;
124124
#ifdef DISABLE_VANILLA_DAMAGE_EFFECTS
125125
TRACE_1("disabling vanilla bleeding feedback effects",_this);
126126
[{
127-
{isNil _x} count [
127+
[
128128
"BIS_fnc_feedback_damageCC",
129129
"BIS_fnc_feedback_damageRadialBlur",
130130
"BIS_fnc_feedback_damageBlur"
131-
] == 0
131+
] findIf {isNil _x} == -1
132132
}, {
133133
{
134134
ppEffectDestroy _x;

0 commit comments

Comments
 (0)