Skip to content

Commit

Permalink
General - Optimize isNotEqualTo (#619)
Browse files Browse the repository at this point in the history
* General - Optimize `isNotEqualTo`

* Update addons/missionMaking/functions/fnc_onMissionSave.sqf
  • Loading branch information
PabstMirror authored Dec 27, 2024
1 parent 3edaa9d commit 1ca2701
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion addons/aiCfgFixes/functions/fnc_generateAmmo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ _ammoToGenerate = _ammoToGenerateCorrect;
private _retAmmo = [];
{
// _x = ammo_config
if (!(configName(_x) isEqualTo "")) then {
if (configName(_x) isNotEqualTo "") then {
if (configName(inheritsFrom(_x)) isEqualTo "") then {
// nothing
} else {
Expand Down
2 changes: 1 addition & 1 deletion addons/miscFixes/XEH_serverPostInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ DFUNC(updateHCPosition) = {
((_hcs select 1) select _forEachIndex) params ["_groupCount", "_position"];
if (_groupCount > 0) then {
private _groupAvgPos = _position vectorMultiply (1 / _groupCount);
if (!(_playerAvgPos isEqualTo [])) then {
if (_playerAvgPos isNotEqualTo []) then {
_groupAvgPos = (_playerAvgPos vectorAdd _groupAvgPos) vectorMultiply 0.5;
};

Expand Down
16 changes: 8 additions & 8 deletions addons/missionMaking/functions/fnc_onMissionSave.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private _floatingUnits = [];
_floatingUnits pushBack _x;
};
} forEach _allUnits;
if (!(_floatingUnits isEqualTo [])) then {
if (_floatingUnits isNotEqualTo []) then {
_problems pushBack ["Possible Fall Damage (Soldier placed above ground level)", _floatingUnits];
};

Expand All @@ -163,10 +163,10 @@ private _classesNone= [];
};
if (!isClass(_path)) exitWith {};
} forEach _allUnits;
if (!(_classesFallback isEqualTo [])) then {
if (_classesFallback isNotEqualTo []) then {
_problems pushBack ["Minor: Unit placed that are using fallback", _classesFallback];
};
if (!(_classesNone isEqualTo [])) then {
if (_classesNone isNotEqualTo []) then {
_problems pushBack ["Unit placed that have no loadout", _classesNone];
};

Expand Down Expand Up @@ -198,7 +198,7 @@ private _checkDeprecatedGear = [];
if (_x != "") then {
private _ammoCount = 0;
private _weaponMags = [_weapon] call CBA_fnc_compatibleMagazines;
if (!(_weaponMags isEqualTo [])) then { // Prevents alerts for weapons that have no magazines (e.g. CSW)
if (_weaponMags isNotEqualTo []) then { // Prevents alerts for weapons that have no magazines (e.g. CSW)
{
_x params ["_xMagName", "_xAmmo"];
if (_xMagName in _weaponMags) then {
Expand Down Expand Up @@ -255,16 +255,16 @@ private _checkDeprecatedGear = [];

} forEach _allUnits;

if (!(_checkWeapons isEqualTo [])) then {
if (_checkWeapons isNotEqualTo []) then {
_problems pushBack ["Units missing weapons", _checkWeapons];
};
if (!(_checkMagazines isEqualTo [])) then {
if (_checkMagazines isNotEqualTo []) then {
_problems pushBack ["Units missing magazines", _checkMagazines];
};
if (!(_checkMedical isEqualTo [])) then {
if (_checkMedical isNotEqualTo []) then {
_problems pushBack ["Units missing medical", _checkMedical];
};
if (!(_checkDeprecatedGear isEqualTo [])) then {
if (_checkDeprecatedGear isNotEqualTo []) then {
_problems pushBack ["Units using gear from mod we will drop", _checkDeprecatedGear];
};

Expand Down
2 changes: 1 addition & 1 deletion addons/radios/functions/fnc_acreSideControlBabelChange.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ private _languages = [];

TRACE_1("selected languages",_languages);

if !(_languages isEqualTo []) then {
if (_languages isNotEqualTo []) then {
switch (lbCurSel _ctrlSide) do {
case (0): { GVAR(westDefaultLanguages) = _languages; };
case (1): { GVAR(eastDefaultLanguages) = _languages; };
Expand Down
2 changes: 1 addition & 1 deletion addons/recruits/functions/fnc_updateRecruitInfo.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if !(isNull MESSAGE_DISPLAY) then {
} count units (group player); // count used for speed, ensure `nil` is above this line

TRACE_2("Groups",GVAR(oldSquad),_units);
if !(GVAR(oldSquad) isEqualTo _units) then {
if (GVAR(oldSquad) isNotEqualTo _units) then {
GVAR(oldSquad) = _units;
private _recruits = [];
private _recruitCount = {
Expand Down
2 changes: 1 addition & 1 deletion addons/respawn/functions/fnc_addGroupClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ params [
];

private _groupIndex = tvAdd [GROUP_TREE_IDC, [], format ["%1 (%2)", _configText, _groupDisplayName]];
if !(_configTexture isEqualTo "") then {
if (_configTexture isNotEqualTo "") then {
tvSetPicture [GROUP_TREE_IDC, [_groupIndex], _configTexture];
tvSetPictureColor [GROUP_TREE_IDC, [_groupIndex], _configColor];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/respawn/functions/fnc_ui_handleAdminUnload.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TRACE_1("params",_this);
GVAR(adminUpdateEH) = nil;

// reset spectate state
if !(GVAR(currentSpecChat) isEqualTo GVAR(oldSpecChat)) then {
if (GVAR(currentSpecChat) isNotEqualTo GVAR(oldSpecChat)) then {
[GVAR(oldSpecChat)] call acre_api_fnc_setSpectator;
};

Expand Down
2 changes: 1 addition & 1 deletion addons/respawn/functions/fnc_ui_handleGroupChange.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ lbClear ADMIN_CONFIG_COMBO_IDC;
_markerTexture = _unitMarkerTexture;
};

if !(_unitMarkerColor isEqualTo [0,0,0,0]) then {
if (_unitMarkerColor isNotEqualTo [0,0,0,0]) then {
_markerColor = _unitMarkerColor;
};
};
Expand Down
2 changes: 1 addition & 1 deletion addons/safeStart/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if(hasInterface) then {
private _markerName = "_USER_DEFINED missionEndMarker_0";
private _markerExists = allMapMarkers find _markerName;

if !(_markerExists isEqualTo -1) then {deleteMarkerLocal _markerName;};
if (_markerExists isNotEqualTo -1) then {deleteMarkerLocal _markerName;};

_markerStr call BIS_fnc_stringToMarkerLocal;
}] call CBA_fnc_addEventHandler;
Expand Down
2 changes: 1 addition & 1 deletion addons/settings/XEH_preInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if (isServer) then {
{
_x params ["_settingName", "_settingValue", "", ["_skipWarning", false]];
TRACE_2("",_settingName,_settingValue);
if (!((missionNamespace getVariable [_settingName, -999]) isEqualTo _settingValue)) then {
if ((missionNamespace getVariable [_settingName, -999]) isNotEqualTo _settingValue) then {
if (_skipWarning) exitWith {};
private _log = format ["Warning: Setting [%1] not expected [%2] current [%3]", _settingName, _settingValue, missionNamespace getVariable _settingName];
["potato_adminMsg", [_log, "Mission"]] call CBA_fnc_globalEvent;
Expand Down
2 changes: 1 addition & 1 deletion addons/spectate/functions/fnc_ui_handleDraw3D.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ if !(GVAR(mapOpen) || GVAR(fullMapOpen)) then {
private _oldLoc = [];
{
_x params ["_locNew", "_colorNew"];
if !(_oldLoc isEqualTo []) then {
if (_oldLoc isNotEqualTo []) then {
drawLine3D [_oldLoc, _locNew, _colorNew];
};
_oldLoc = _locNew;
Expand Down
4 changes: 2 additions & 2 deletions addons/spectate/functions/fnc_updateList.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private _newList = [
nil
} count (units _x); // count used for speed, ensure nil above this line

if !(_unitsInfo isEqualTo []) then {
if (_unitsInfo isNotEqualTo []) then {
_newGroups pushBack (str _group);
{
if (_groupSide == (_newList select _forEachIndex) select 0) exitWith {
Expand All @@ -62,7 +62,7 @@ private _newList = [

TRACE_1("New List:",_newList);

if !(GVAR(curList) isEqualTo _newList) then {
if (GVAR(curList) isNotEqualTo _newList) then {
// Remove groups/units that are no longer there
for "_sideIndex" from (LIST_CTR tvCount []) to 1 step -1 do {
for "_groupIndex" from (LIST_CTR tvCount [_sideIndex - 1]) to 1 step -1 do {
Expand Down
4 changes: 2 additions & 2 deletions addons/vz99/functions/fnc_doReload.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ TRACE_2("params",_mortarVeh,_player);

//If we have a round loaded, exit
private _loadedFull = magazinesAmmoFull _mortarVeh;
if (!(_loadedFull isEqualTo [])) exitWith {TRACE_1("loaded",_loadedFull);};
if (_loadedFull isNotEqualTo []) exitWith {TRACE_1("loaded",_loadedFull);};

//Make sure empty mag is removed so it "autoloads"
private _loadedEmpty = _mortarVeh magazinesTurret [0];
if (!(_loadedEmpty isEqualTo [])) then {
if (_loadedEmpty isNotEqualTo []) then {
TRACE_1("removing empty mag",_loadedEmpty);
_mortarVeh removeMagazinesTurret [(_loadedEmpty select 0), [0]];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/vz99/functions/fnc_handleFired.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if (!local _mortarVeh) exitWith {};

//Remove the empty magazine, so a new one will load correctly
private _loadedEmpty = _mortarVeh magazinesTurret [0];
if (!(_loadedEmpty isEqualTo [])) then {
if (_loadedEmpty isNotEqualTo []) then {
TRACE_1("removing empty mag",_loadedEmpty);
_mortarVeh removeMagazinesTurret [(_loadedEmpty select 0), [0]];
};
Expand Down
2 changes: 1 addition & 1 deletion addons/zeusFactory/functions/fnc_factoryLoop.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ _activeGroups = _activeGroups select {
_args set [3, _activeGroups];

// Fill out current group in progress
if (!(_newGroupParams isEqualTo [])) exitWith {
if (_newGroupParams isNotEqualTo []) exitWith {
_newGroupParams params ["_placeLogic", "_group", "_soldierList"];
TRACE_3("_newGroupParams",_placeLogic,_group,_soldierList);

Expand Down
2 changes: 1 addition & 1 deletion addons/zeusHC/functions/fnc_createEntityDismounts.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ _modelOffset = _modelOffset vectorAdd ((vectorNormalized _modelOffset) vectorMul
};

//Wait for area to be clear of other units/parachutes
if ((_attachedVehicle isKindOf "Air") && {!((_attachedVehicle nearEntities 15) isEqualTo [_attachedVehicle])}) exitWith {};
if ((_attachedVehicle isKindOf "Air") && {(_attachedVehicle nearEntities 15) isNotEqualTo [_attachedVehicle]}) exitWith {};

private _unitType = _createUnits deleteAt 0;
private _posAGL = _attachedVehicle modelToWorld _modelOffset;
Expand Down
2 changes: 1 addition & 1 deletion addons/zeusHC/functions/fnc_createEntityLocal.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (_createVic != "") then {
if (isNull _attachedVehicle) then {
private _nearestVehicles = nearestObjects [_posATL, ["Car", "Tank", "Air"], 50];
TRACE_1("not attached",_nearestVehicles);
if !(_nearestVehicles isEqualTo []) then {
if (_nearestVehicles isNotEqualTo []) then {
_attachedVehicle = _nearestVehicles select 0;
};
};
Expand Down
2 changes: 1 addition & 1 deletion addons/zeusHC/functions/fnc_transferGroupsToHC.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ TRACE_1("Time between transfers",_timeBetweenTransfers);

//loop all groups
{
if (!(isPlayer (leader _x)) && !((units _x) isEqualTo []) && !((groupOwner _x) in _hcIDs) && (_force || _x getVariable [QGVAR(addGroupToHC), false])) then {
if (!(isPlayer (leader _x)) && ((units _x) isNotEqualTo []) && !((groupOwner _x) in _hcIDs) && (_force || _x getVariable [QGVAR(addGroupToHC), false])) then {
private _newOwner = [] call FUNC(getSpawnMachineId);
private _status = _x setGroupOwner _newOwner;
INFO_3("Group [%1] moved to [%2] with status [%3]",_x,_newOwner,_status);
Expand Down

0 comments on commit 1ca2701

Please sign in to comment.