General - Change count to isEqualTo where appropriate (#9921)

count -> isEqualTo
This commit is contained in:
johnb432 2024-04-06 20:57:08 +02:00 committed by GitHub
parent 8f46ffd8d5
commit dce7da60c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 28 additions and 37 deletions

View File

@ -33,7 +33,7 @@ if (_startingPos isEqualTo [0,0,0]) exitWith {
[LSTRING(GarrisonInvalidPosition)] call EFUNC(common,displayTextStructured); [LSTRING(GarrisonInvalidPosition)] call EFUNC(common,displayTextStructured);
}; };
if (count _unitsArray == 0 || {isNull (_unitsArray select 0)}) exitWith { if (_unitsArray isEqualTo [] || {isNull (_unitsArray select 0)}) exitWith {
TRACE_1("fnc_garrison: Units error",_unitsArray); TRACE_1("fnc_garrison: Units error",_unitsArray);
[LSTRING(GarrisonNoUnits)] call EFUNC(common,displayTextStructured); [LSTRING(GarrisonNoUnits)] call EFUNC(common,displayTextStructured);
}; };
@ -43,7 +43,7 @@ if (_fillingRadius >= 50) then {
_buildings = [_buildings] call CBA_fnc_shuffle; _buildings = [_buildings] call CBA_fnc_shuffle;
}; };
if (count _buildings == 0) exitWith { if (_buildings isEqualTo []) exitWith {
TRACE_1("fnc_garrison: Building error",_buildings); TRACE_1("fnc_garrison: Building error",_buildings);
[LSTRING(GarrisonNoBuilding)] call EFUNC(common,displayTextStructured); [LSTRING(GarrisonNoBuilding)] call EFUNC(common,displayTextStructured);
}; };

View File

@ -58,7 +58,7 @@ if (_switch) then {
private _newGroup = createGroup (_x select 1); private _newGroup = createGroup (_x select 1);
[_unit] joinSilent _newGroup; [_unit] joinSilent _newGroup;
}; };
if (count units _currentGroup == 0) then { if (units _currentGroup isEqualTo []) then {
deleteGroup _currentGroup; deleteGroup _currentGroup;
}; };
_previousGroupsList set [_forEachIndex, objNull]; _previousGroupsList set [_forEachIndex, objNull];

View File

@ -64,7 +64,7 @@ if (_insertChildrenCode isNotEqualTo {}) then {
// Collect dynamic children class actions // Collect dynamic children class actions
{ {
private _action = [_x select 2, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); private _action = [_x select 2, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree);
if ((count _action) > 0) then { if (_action isNotEqualTo []) then {
_activeChildren pushBack _action; _activeChildren pushBack _action;
}; };
} forEach _dynamicChildren; } forEach _dynamicChildren;
@ -73,7 +73,7 @@ if (_insertChildrenCode isNotEqualTo {}) then {
// Collect children class actions // Collect children class actions
{ {
private _action = [_object, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); private _action = [_object, _x, _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree);
if ((count _action) > 0) then { if (_action isNotEqualTo []) then {
_activeChildren pushBack _action; _activeChildren pushBack _action;
}; };
} forEach _origActionChildren; } forEach _origActionChildren;
@ -85,7 +85,7 @@ if (_insertChildrenCode isNotEqualTo {}) then {
// Check if the action is children of the original action // Check if the action is children of the original action
if (_pPath isEqualTo _fullPath) then { if (_pPath isEqualTo _fullPath) then {
private _action = [_object, [_actionData,[]], _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree); private _action = [_object, [_actionData,[]], _fullPath, _distanceToBasePoint] call FUNC(collectActiveActionTree);
if ((count _action) > 0) then { if (_action isNotEqualTo []) then {
_activeChildren pushBack _action; _activeChildren pushBack _action;
}; };
}; };

View File

@ -22,10 +22,10 @@ params ["_unit", "_target"];
[_unit, "GestureGo"] call EFUNC(common,doGesture); [_unit, "GestureGo"] call EFUNC(common,doGesture);
private _chance = [0.5, 0.8] select (count weapons _unit > 0); private _chance = [0.5, 0.8] select (weapons _unit isNotEqualTo []);
{ {
if (count weapons _x == 0 && {random 1 < _chance}) then { if (weapons _x isEqualTo [] && {random 1 < _chance}) then {
[QGVAR(getDown), [_x], [_x]] call CBA_fnc_targetEvent; [QGVAR(getDown), [_x], [_x]] call CBA_fnc_targetEvent;
}; };
} forEach (_target nearEntities ["Civilian", SEND_RADIUS]); } forEach (_target nearEntities ["Civilian", SEND_RADIUS]);

View File

@ -22,10 +22,10 @@ params ["_unit"];
[_unit, "GestureGo"] call EFUNC(common,doGesture); [_unit, "GestureGo"] call EFUNC(common,doGesture);
private _chance = [0.5, 0.8] select (count weapons _unit > 0); private _chance = [0.5, 0.8] select (weapons _unit isNotEqualTo []);
{ {
if (count weapons _x == 0 && {random 1 < _chance}) then { if (weapons _x isEqualTo [] && {random 1 < _chance}) then {
private _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE); private _position = getPosASL _unit vectorAdd (eyeDirection _unit vectorMultiply SEND_DISTANCE);
_position set [2, 0]; _position set [2, 0];

View File

@ -103,7 +103,7 @@ private _finalOwner = objNull;
TRACE_2("",count _spots,_spots); TRACE_2("",count _spots,_spots);
if ((count _spots) > 0) then { if (_spots isNotEqualTo []) then {
private _bucketList = nil; private _bucketList = nil;
private _bucketPos = nil; private _bucketPos = nil;
private _c = 0; private _c = 0;

View File

@ -19,7 +19,7 @@
*/ */
params ["_input", "_points", ["_randomRound", false]]; params ["_input", "_points", ["_randomRound", false]];
if (count _points < 1) exitWith { if (_points isEqualTo []) exitWith {
//TODO: sensible default/error value //TODO: sensible default/error value
0 0
}; };

View File

@ -72,7 +72,7 @@ if (_isActive || { CBA_missionTime >= _timeWhenActive }) then {
}; };
_nearestObjects = _nearestObjects select { !isNull _x }; _nearestObjects = _nearestObjects select { !isNull _x };
// Select closest object to the expected position to be the current radar target // Select closest object to the expected position to be the current radar target
if ((count _nearestObjects) <= 0) exitWith { if (_nearestObjects isEqualTo []) exitWith {
_projectile setMissileTarget objNull; _projectile setMissileTarget objNull;
_searchPos _searchPos
}; };
@ -117,4 +117,3 @@ if !(isNull _target) then {
_launchParams set [0, _target]; _launchParams set [0, _target];
_expectedTargetPos _expectedTargetPos

View File

@ -57,7 +57,7 @@ private _missionRoot = str missionConfigFile select [0, count str missionConfigF
}; };
} forEach _splittedList; } forEach _splittedList;
if (count _ambianceSounds == 0) exitWith {}; if (_ambianceSounds isEqualTo []) exitWith {};
{ {
if ((_x find ".") == -1) then { if ((_x find ".") == -1) then {
_ambianceSounds set [_forEachIndex, _x + ".wss"]; _ambianceSounds set [_forEachIndex, _x + ".wss"];
@ -80,7 +80,7 @@ TRACE_1("",_ambianceSounds);
private _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]}; private _allUnits = if (isMultiplayer) then {playableUnits} else {[ACE_player]};
// Check if there are enough players to even start playing this sound. // Check if there are enough players to even start playing this sound.
if (count _allUnits > 0) then { if (_allUnits isNotEqualTo []) then {
// find the position from which we are going to play this sound from. // find the position from which we are going to play this sound from.
private _newPosASL = if (_followPlayers) then { private _newPosASL = if (_followPlayers) then {
// Select a target unit at random. // Select a target unit at random.

View File

@ -31,7 +31,7 @@ if (_weaponBarrelClass == "") then {
// Find all spare barrel the player has // Find all spare barrel the player has
private _allBarrels = [_assistant, _weaponBarrelClass] call CBA_fnc_getMagazineIndex; private _allBarrels = [_assistant, _weaponBarrelClass] call CBA_fnc_getMagazineIndex;
TRACE_1("_allBarrels",_allBarrels); TRACE_1("_allBarrels",_allBarrels);
if ((count _allBarrels) < 1) exitWith {}; if (_allBarrels isEqualTo []) exitWith {};
// Determine which on is coolest // Determine which on is coolest
private _coolestTemp = 10000; private _coolestTemp = 10000;

View File

@ -32,7 +32,7 @@ if (_weaponBarrelClass == "") then {
}; };
private _allBarrels = [_unit, _weaponBarrelClass] call CBA_fnc_getMagazineIndex; private _allBarrels = [_unit, _weaponBarrelClass] call CBA_fnc_getMagazineIndex;
TRACE_1("_allBarrels",_allBarrels); TRACE_1("_allBarrels",_allBarrels);
if ((count _allBarrels) < 1) exitWith {}; if (_allBarrels isEqualTo []) exitWith {};
// Determine the temp of each barrel // Determine the temp of each barrel
private _temps = []; private _temps = [];

View File

@ -100,7 +100,7 @@ private _barrelLength = _weaponConfig select 2;
private _muzzleVelocity = 0; private _muzzleVelocity = 0;
private _bc = 0; private _bc = 0;
if (count (_ammoConfig select 6) > 0) then { if ((_ammoConfig select 6) isNotEqualTo []) then {
_bc = (_ammoConfig select 6) select 0; _bc = (_ammoConfig select 6) select 0;
}; };
private _transonicStabilityCoef = _ammoConfig select 4; private _transonicStabilityCoef = _ammoConfig select 4;

View File

@ -38,7 +38,7 @@ private _engineerRequired = if (isNumber (_config >> "requiredEngineer")) then {
if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false}; if !([_caller, _engineerRequired] call FUNC(isEngineer)) exitWith {false};
private _items = _config call FUNC(getRepairItems); private _items = _config call FUNC(getRepairItems);
if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false}; if (_items isNotEqualTo [] && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false};
private _return = true; private _return = true;
if (getText (_config >> "condition") != "") then { if (getText (_config >> "condition") != "") then {

View File

@ -20,17 +20,9 @@
*/ */
params ["_hitPoint", "_textLocalized", "_textDefault", ["_trackArray", []]]; params ["_hitPoint", "_textLocalized", "_textDefault", ["_trackArray", []]];
_trackArray params [["_trackNames", []], ["_trackStrings", []], ["_trackAmount", []]];
private _track = (count _trackArray > 0); private _track = _trackArray isNotEqualTo [];
private _trackNames = [];
private _trackStrings = [];
private _trackAmount = [];
if (_track) then {
_trackNames = _trackArray select 0;
_trackStrings = _trackArray select 1;
_trackAmount = _trackArray select 2;
};
// Prepare first part of the string from stringtable // Prepare first part of the string from stringtable
//IGNORE_STRING_WARNING(str_ace_repair_hit); //IGNORE_STRING_WARNING(str_ace_repair_hit);

View File

@ -44,7 +44,7 @@ if ((isEngineOn _target) && {!GVAR(autoShutOffEngineWhenStartingRepair)}) exitWi
}; };
private _items = _config call FUNC(getRepairItems); private _items = _config call FUNC(getRepairItems);
if (count _items > 0 && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false}; if (_items isNotEqualTo [] && {!([_caller, _items] call FUNC(hasItems))}) exitWith {false};
private _return = true; private _return = true;
if (getText (_config >> "condition") != "") then { if (getText (_config >> "condition") != "") then {

View File

@ -48,7 +48,7 @@ class CfgVehicles {
selection = ""; selection = "";
displayName = CSTRING(PickUp); displayName = CSTRING(PickUp);
distance = 5; distance = 5;
condition = QUOTE((alive _target) && (count (crew _target) == 0)); condition = QUOTE((alive _target) && {(crew _target) isEqualTo []});
statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup)); statement = QUOTE([ARR_2(_target,_player)] call FUNC(pickup));
showDisabled = 0; showDisabled = 0;
exceptions[] = {}; exceptions[] = {};

View File

@ -27,7 +27,7 @@ if (GVAR(EnableSafeZone)) then {
private _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers); private _allNearestPlayers = [position _unit, GVAR(SafeZoneRadius)] call FUNC(nearestPlayers);
private _nearestEnemyPlayers = _allNearestPlayers select {((side GVAR(OriginalGroup)) getFriend side _x < 0.6) && !(_x getVariable [QGVAR(IsPlayerControlled), false])}; private _nearestEnemyPlayers = _allNearestPlayers select {((side GVAR(OriginalGroup)) getFriend side _x < 0.6) && !(_x getVariable [QGVAR(IsPlayerControlled), false])};
if (count _nearestEnemyPlayers > 0) exitWith { if (_nearestEnemyPlayers isNotEqualTo []) exitWith {
_leave = true; _leave = true;
}; };
}; };

View File

@ -124,7 +124,7 @@ private _chanceOfDetonation = 0;
private _explosiveAmmoCount = 0; private _explosiveAmmoCount = 0;
private _nonExplosiveAmmoCount = 0; private _nonExplosiveAmmoCount = 0;
if (count (_currentVehicleAmmo select 0) isNotEqualTo 0) then { if ((_currentVehicleAmmo select 0) isNotEqualTo []) then {
private _magConfig = configFile >> "CfgMagazines"; private _magConfig = configFile >> "CfgMagazines";
private _ammoConfig = configFile >> "CfgAmmo"; private _ammoConfig = configFile >> "CfgAmmo";
private _countOfExplodableAmmo = 0; private _countOfExplodableAmmo = 0;

View File

@ -30,7 +30,7 @@ if (_useCustom) then {
private _previousMags = magazinesDetail _unit; private _previousMags = magazinesDetail _unit;
_unit addMagazine ["ACE_key_customKeyMagazine", 1]; //addMagazine array has global effects _unit addMagazine ["ACE_key_customKeyMagazine", 1]; //addMagazine array has global effects
private _newMags = (magazinesDetail _unit) - _previousMags; private _newMags = (magazinesDetail _unit) - _previousMags;
if ((count _newMags) == 0) exitWith {ERROR("failed to add magazine (inventory full?)");}; if (_newMags isEqualTo []) exitWith {ERROR("failed to add magazine (inventory full?)");};
private _keyMagazine = _newMags select 0; private _keyMagazine = _newMags select 0;
TRACE_2("setting up key on server",_veh,_keyMagazine); TRACE_2("setting up key on server",_veh,_keyMagazine);
//Have the server run add the key to the vehicle's key array: //Have the server run add the key to the vehicle's key array:

View File

@ -22,7 +22,7 @@ private _weapons = _vehicle weaponsTurret _turret;
if ( if (
count _weapons > 1 count _weapons > 1
|| {count _weapons > 0 && {!(_weapons select 0 in ["SmokeLauncher", "BWA3_SmokeLauncher"])}} // @todo somebody might use custom smoke launcher weapons aswell, maybe ... || {_weapons isNotEqualTo [] && {!(_weapons select 0 in ["SmokeLauncher", "BWA3_SmokeLauncher"])}} // @todo somebody might use custom smoke launcher weapons aswell, maybe ...
) then { ) then {
//This doesn't work reliably for vehilces with additional weapons for the commander. Select smoke launcher instead. //This doesn't work reliably for vehilces with additional weapons for the commander. Select smoke launcher instead.

View File

@ -69,7 +69,7 @@ if ([_unit] call EFUNC(common,isPlayer)) exitWith {
} else { } else {
// Direct fire - Get a target position that will work // Direct fire - Get a target position that will work
private _lis = lineIntersectsSurfaces [eyePos _unit, _targetASL, _unit, _vehicle]; private _lis = lineIntersectsSurfaces [eyePos _unit, _targetASL, _unit, _vehicle];
if ((count _lis) > 0) then { // If point is hidden, unit won't fire, do a ray cast to find where they should shoot at if (_lis isNotEqualTo []) then { // If point is hidden, unit won't fire, do a ray cast to find where they should shoot at
_targetASL = ((_lis select 0) select 0); _targetASL = ((_lis select 0) select 0);
TRACE_1("using ray cast pos",_mousePosASL distance _targetASL); TRACE_1("using ray cast pos",_mousePosASL distance _targetASL);
}; };