From 1ca2701d3c648ce62be08b1a3b3fcbe897253cb5 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Thu, 26 Dec 2024 19:13:17 -0600 Subject: [PATCH] General - Optimize `isNotEqualTo` (#619) * General - Optimize `isNotEqualTo` * Update addons/missionMaking/functions/fnc_onMissionSave.sqf --- addons/aiCfgFixes/functions/fnc_generateAmmo.sqf | 2 +- addons/miscFixes/XEH_serverPostInit.sqf | 2 +- .../functions/fnc_onMissionSave.sqf | 16 ++++++++-------- .../functions/fnc_acreSideControlBabelChange.sqf | 2 +- .../recruits/functions/fnc_updateRecruitInfo.sqf | 2 +- addons/respawn/functions/fnc_addGroupClient.sqf | 2 +- .../functions/fnc_ui_handleAdminUnload.sqf | 2 +- .../functions/fnc_ui_handleGroupChange.sqf | 2 +- addons/safeStart/XEH_postInit.sqf | 2 +- addons/settings/XEH_preInit.sqf | 2 +- .../spectate/functions/fnc_ui_handleDraw3D.sqf | 2 +- addons/spectate/functions/fnc_updateList.sqf | 4 ++-- addons/vz99/functions/fnc_doReload.sqf | 4 ++-- addons/vz99/functions/fnc_handleFired.sqf | 2 +- addons/zeusFactory/functions/fnc_factoryLoop.sqf | 2 +- .../functions/fnc_createEntityDismounts.sqf | 2 +- .../zeusHC/functions/fnc_createEntityLocal.sqf | 2 +- .../zeusHC/functions/fnc_transferGroupsToHC.sqf | 2 +- 18 files changed, 27 insertions(+), 27 deletions(-) diff --git a/addons/aiCfgFixes/functions/fnc_generateAmmo.sqf b/addons/aiCfgFixes/functions/fnc_generateAmmo.sqf index af75046d4..f5e46949d 100644 --- a/addons/aiCfgFixes/functions/fnc_generateAmmo.sqf +++ b/addons/aiCfgFixes/functions/fnc_generateAmmo.sqf @@ -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 { diff --git a/addons/miscFixes/XEH_serverPostInit.sqf b/addons/miscFixes/XEH_serverPostInit.sqf index b2787e8a7..62ae52797 100644 --- a/addons/miscFixes/XEH_serverPostInit.sqf +++ b/addons/miscFixes/XEH_serverPostInit.sqf @@ -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; }; diff --git a/addons/missionMaking/functions/fnc_onMissionSave.sqf b/addons/missionMaking/functions/fnc_onMissionSave.sqf index 0360d1f7f..5c62f206a 100644 --- a/addons/missionMaking/functions/fnc_onMissionSave.sqf +++ b/addons/missionMaking/functions/fnc_onMissionSave.sqf @@ -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]; }; @@ -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]; }; @@ -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 { @@ -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]; }; diff --git a/addons/radios/functions/fnc_acreSideControlBabelChange.sqf b/addons/radios/functions/fnc_acreSideControlBabelChange.sqf index edecc3fb4..432a1fd9b 100644 --- a/addons/radios/functions/fnc_acreSideControlBabelChange.sqf +++ b/addons/radios/functions/fnc_acreSideControlBabelChange.sqf @@ -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; }; diff --git a/addons/recruits/functions/fnc_updateRecruitInfo.sqf b/addons/recruits/functions/fnc_updateRecruitInfo.sqf index 2e7d0aafc..8ea370fb4 100644 --- a/addons/recruits/functions/fnc_updateRecruitInfo.sqf +++ b/addons/recruits/functions/fnc_updateRecruitInfo.sqf @@ -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 = { diff --git a/addons/respawn/functions/fnc_addGroupClient.sqf b/addons/respawn/functions/fnc_addGroupClient.sqf index a299fa2de..4ae8a7fae 100644 --- a/addons/respawn/functions/fnc_addGroupClient.sqf +++ b/addons/respawn/functions/fnc_addGroupClient.sqf @@ -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]; }; diff --git a/addons/respawn/functions/fnc_ui_handleAdminUnload.sqf b/addons/respawn/functions/fnc_ui_handleAdminUnload.sqf index 0c7e451b0..520959d51 100644 --- a/addons/respawn/functions/fnc_ui_handleAdminUnload.sqf +++ b/addons/respawn/functions/fnc_ui_handleAdminUnload.sqf @@ -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; }; diff --git a/addons/respawn/functions/fnc_ui_handleGroupChange.sqf b/addons/respawn/functions/fnc_ui_handleGroupChange.sqf index a68621790..e0053152e 100644 --- a/addons/respawn/functions/fnc_ui_handleGroupChange.sqf +++ b/addons/respawn/functions/fnc_ui_handleGroupChange.sqf @@ -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; }; }; diff --git a/addons/safeStart/XEH_postInit.sqf b/addons/safeStart/XEH_postInit.sqf index b8f97ee98..f6b84a4db 100644 --- a/addons/safeStart/XEH_postInit.sqf +++ b/addons/safeStart/XEH_postInit.sqf @@ -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; diff --git a/addons/settings/XEH_preInit.sqf b/addons/settings/XEH_preInit.sqf index d9c1ffbd1..fd8de198e 100644 --- a/addons/settings/XEH_preInit.sqf +++ b/addons/settings/XEH_preInit.sqf @@ -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; diff --git a/addons/spectate/functions/fnc_ui_handleDraw3D.sqf b/addons/spectate/functions/fnc_ui_handleDraw3D.sqf index c7bf756a0..678822b62 100644 --- a/addons/spectate/functions/fnc_ui_handleDraw3D.sqf +++ b/addons/spectate/functions/fnc_ui_handleDraw3D.sqf @@ -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; diff --git a/addons/spectate/functions/fnc_updateList.sqf b/addons/spectate/functions/fnc_updateList.sqf index 2cb026e0d..0edf40c4c 100644 --- a/addons/spectate/functions/fnc_updateList.sqf +++ b/addons/spectate/functions/fnc_updateList.sqf @@ -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 { @@ -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 { diff --git a/addons/vz99/functions/fnc_doReload.sqf b/addons/vz99/functions/fnc_doReload.sqf index 1454ca6fc..fc10de21a 100644 --- a/addons/vz99/functions/fnc_doReload.sqf +++ b/addons/vz99/functions/fnc_doReload.sqf @@ -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]]; }; diff --git a/addons/vz99/functions/fnc_handleFired.sqf b/addons/vz99/functions/fnc_handleFired.sqf index fb498d688..83cd5e990 100644 --- a/addons/vz99/functions/fnc_handleFired.sqf +++ b/addons/vz99/functions/fnc_handleFired.sqf @@ -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]]; }; diff --git a/addons/zeusFactory/functions/fnc_factoryLoop.sqf b/addons/zeusFactory/functions/fnc_factoryLoop.sqf index 19e0bb623..72a81d378 100644 --- a/addons/zeusFactory/functions/fnc_factoryLoop.sqf +++ b/addons/zeusFactory/functions/fnc_factoryLoop.sqf @@ -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); diff --git a/addons/zeusHC/functions/fnc_createEntityDismounts.sqf b/addons/zeusHC/functions/fnc_createEntityDismounts.sqf index 764ebe998..426ee3779 100644 --- a/addons/zeusHC/functions/fnc_createEntityDismounts.sqf +++ b/addons/zeusHC/functions/fnc_createEntityDismounts.sqf @@ -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; diff --git a/addons/zeusHC/functions/fnc_createEntityLocal.sqf b/addons/zeusHC/functions/fnc_createEntityLocal.sqf index 012971070..deed9497b 100644 --- a/addons/zeusHC/functions/fnc_createEntityLocal.sqf +++ b/addons/zeusHC/functions/fnc_createEntityLocal.sqf @@ -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; }; }; diff --git a/addons/zeusHC/functions/fnc_transferGroupsToHC.sqf b/addons/zeusHC/functions/fnc_transferGroupsToHC.sqf index cb9086a36..ccd0bad68 100644 --- a/addons/zeusHC/functions/fnc_transferGroupsToHC.sqf +++ b/addons/zeusHC/functions/fnc_transferGroupsToHC.sqf @@ -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);