diff --git a/addons/bft/functions/fnc_chatMessage_getId.sqf b/addons/bft/functions/fnc_chatMessage_getId.sqf index 3830343b47..932f9ede29 100644 --- a/addons/bft/functions/fnc_chatMessage_getId.sqf +++ b/addons/bft/functions/fnc_chatMessage_getId.sqf @@ -20,7 +20,8 @@ params ["_deviceId", "_otherDeviceId"]; private _id = QGVAR(chatMessages); -private _deviceIds = [_deviceId, _otherDeviceId] sort true; +private _deviceIds = [_deviceId, _otherDeviceId]; +_deviceIds sort true; { _id = _id + _x; diff --git a/addons/bft/functions/fnc_chatMessages_get.sqf b/addons/bft/functions/fnc_chatMessages_get.sqf index 1c1dcfc18e..a8ee4f2a8b 100644 --- a/addons/bft/functions/fnc_chatMessages_get.sqf +++ b/addons/bft/functions/fnc_chatMessages_get.sqf @@ -24,7 +24,7 @@ params ["_deviceId", "_otherDeviceId"]; private _deviceDataOne = [_deviceId] call FUNC(getDeviceData); private _deviceDataTwo = [_otherDeviceId] call FUNC(getDeviceData); -if (_deviceDataOne isEqualTo [] || _deviceDataTwo isEqualTo []) exitwith {[]}; // neither are valid devices +if (_deviceDataOne isEqualTo [] || {_deviceDataTwo isEqualTo []}) exitwith {[]}; // neither are valid devices private _messagesId = [_deviceId, _otherDeviceId] call FUNC(chatMessage_getId); diff --git a/addons/bft/functions/fnc_checkItem.sqf b/addons/bft/functions/fnc_checkItem.sqf index 2dcf52cdca..3af5b13afe 100644 --- a/addons/bft/functions/fnc_checkItem.sqf +++ b/addons/bft/functions/fnc_checkItem.sqf @@ -18,9 +18,10 @@ params ["_unit", "_item"]; if !(local _unit) exitwith {}; -if (isText (configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) && {getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) != ""}) then { +private _configEntry = configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType); +if (isText _configEntry && {(getText _configEntry) != ""}) then { - if !(isClass (configFile >> "ACE_BFT" >> "Devices" >> (getText(configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType))))) exitwith {}; + if !(isClass (configFile >> "ACE_BFT" >> "Devices" >> (getText _configEntry))) exitwith {}; systemChat format["%1 BFT enabled item %2", _unit, _item]; diag_log format["%1 BFT enabled item %2", _unit, _item]; @@ -34,7 +35,7 @@ if (isText (configFile >> "CfgWeapons" >> _item >> QGVAR(deviceType)) && {getTex private _previousMags = magazinesDetail _unit; _unit addMagazine _magazine; 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 _newMagName = _newMags select 0; private _magID = [_newMagName] call FUNC(getMagazineID); diff --git a/addons/bft/functions/fnc_encryptionKeyMatch.sqf b/addons/bft/functions/fnc_encryptionKeyMatch.sqf index d5b63574d2..3869afc3b8 100644 --- a/addons/bft/functions/fnc_encryptionKeyMatch.sqf +++ b/addons/bft/functions/fnc_encryptionKeyMatch.sqf @@ -16,4 +16,4 @@ params ["_keySetOne", "_keySetTwo"]; -count (_keySetOne arrayIntersect _keySetTwo) > 0 +!((_keySetOne arrayIntersect _keySetTwo) isEqualTo []) diff --git a/addons/bft/functions/fnc_generateEncryptionKey.sqf b/addons/bft/functions/fnc_generateEncryptionKey.sqf index 6fcb05a6d5..75733e3a42 100644 --- a/addons/bft/functions/fnc_generateEncryptionKey.sqf +++ b/addons/bft/functions/fnc_generateEncryptionKey.sqf @@ -15,7 +15,7 @@ private _newKeyArray = []; for "_i" from 1 to 15 /* step +1 */ do { - _newKeyArray pushback (48 + floor(random(74))); + _newKeyArray pushback (48 + floor (random 74)); }; -(toString _newKeyArray) +toString _newKeyArray diff --git a/addons/bft/functions/fnc_getEncryptionKey.sqf b/addons/bft/functions/fnc_getEncryptionKey.sqf index 6380c8f786..e311f01aa3 100644 --- a/addons/bft/functions/fnc_getEncryptionKey.sqf +++ b/addons/bft/functions/fnc_getEncryptionKey.sqf @@ -20,4 +20,4 @@ if (typeName _side == "OBJECT") then { _side = str side _side; }; -(missionNamespace getvariable [format[QGVAR(%1_encryptionKey), _side], [""]]) +missionNamespace getvariable [format[QGVAR(%1_encryptionKey), _side], [""]] diff --git a/addons/bft/functions/fnc_getInterfaces.sqf b/addons/bft/functions/fnc_getInterfaces.sqf index 4dbf0bc7e4..67e5580466 100644 --- a/addons/bft/functions/fnc_getInterfaces.sqf +++ b/addons/bft/functions/fnc_getInterfaces.sqf @@ -29,8 +29,9 @@ private _interfaces = []; if (_deviceOwner isKindOf "ParachuteBase" || {_deviceOwner isKindOf "CAManBase"}) then { // personal device private _deviceType = D_GET_DEVICETYPE(_deviceData); - if (isText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface")) then { - private _interface = getText (configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface"); + private _config = configFile >> "ACE_BFT" >> "Devices" >> _deviceType >> "interface"; + if (isText _config) then { + private _interface = getText _config; if (_interface != "") then { _interfaces pushBack _interface; }; diff --git a/addons/bft/functions/fnc_getTypeIcon.sqf b/addons/bft/functions/fnc_getTypeIcon.sqf index ebbfc76eff..679c354618 100644 --- a/addons/bft/functions/fnc_getTypeIcon.sqf +++ b/addons/bft/functions/fnc_getTypeIcon.sqf @@ -16,8 +16,9 @@ params ["_side", "_type"]; -if (isClass (configFile >> "ACE_BFT" >> "Types" >> _type)) exitwith { - getText (configFile >> "ACE_BFT" >> "Types" >> _type >> "iconPath"); +private _config = configFile >> "ACE_BFT" >> "Types" >> _type; +if (isClass _config) exitwith { + getText (_config >> "iconPath"); }; "\A3\ui_f\data\map\markers\nato\b_inf.paa" diff --git a/addons/bft/functions/fnc_handleDeviceDataChanged.sqf b/addons/bft/functions/fnc_handleDeviceDataChanged.sqf index 5fd94f8d6d..46eb9c3d5b 100644 --- a/addons/bft/functions/fnc_handleDeviceDataChanged.sqf +++ b/addons/bft/functions/fnc_handleDeviceDataChanged.sqf @@ -41,7 +41,7 @@ if (_this select 1) then { // add new if (!(D_GET_OWNER(_data) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_data) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_data)) && alive D_GET_OWNER(_data)}) exitwith {}; if (D_GET_DEVICE_STATE_VALUE(_data) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {}; private _displayData = _data call FUNC(deviceDataToMapData); - if (count _displayData > 0) then { + if !(_displayData isEqualTo []) then { GVAR(availableDevices) pushback _displayData; }; } else { // update existing diff --git a/addons/bft/functions/fnc_handleRegisteredEncryptionKeysChanged.sqf b/addons/bft/functions/fnc_handleRegisteredEncryptionKeysChanged.sqf index fbfd5f107f..297579bfa9 100644 --- a/addons/bft/functions/fnc_handleRegisteredEncryptionKeysChanged.sqf +++ b/addons/bft/functions/fnc_handleRegisteredEncryptionKeysChanged.sqf @@ -28,7 +28,7 @@ if (_add) then { // Adding a new key isn't nice. Now we got to add new shit and loop through the massive data collection. yay? { if !(isNull D_GET_OWNER(_x)) then { - if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_data)}) exitwith {}; + if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_x)}) exitwith {}; if (D_GET_DEVICE_STATE_VALUE(_x) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {}; private _encryptionKeys = D_GET_ENCRYPTION(_x); if !([_encryptionKeys, _newEncryptionKeys] call FUNC(encryptionKeyMatch)) exitWith {}; diff --git a/addons/bft/functions/fnc_handleRegisteredModeChanged.sqf b/addons/bft/functions/fnc_handleRegisteredModeChanged.sqf index ca0c505f01..cdadcc831a 100644 --- a/addons/bft/functions/fnc_handleRegisteredModeChanged.sqf +++ b/addons/bft/functions/fnc_handleRegisteredModeChanged.sqf @@ -27,7 +27,7 @@ if (count _viewModes == 0) exitWith {}; if (_add) then { { if !(isNull D_GET_OWNER(_x)) then { - if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_data)}) exitwith {}; + if (!(D_GET_OWNER(_x) isKindOf "CAManBAse") && {D_GET_DEVICE_STATE_VALUE(_x) isEqualTo STATE_NORMAL} && {!(isEngineOn D_GET_OWNER(_x)) && alive D_GET_OWNER(_x)}) exitwith {}; if (D_GET_DEVICE_STATE_VALUE(_x) in [STATE_OFFLINE, STATE_DESTROYED]) exitwith {}; private _deviceModes = D_GET_DEVICEMODES(_x); if !([_deviceModes, _viewModes] call FUNC(encryptionKeyMatch)) exitWith {}; @@ -42,7 +42,7 @@ if (_add) then { }; } foreach GVAR(deviceData); } else { // if we remove one, we only have to check the already available devices - private ["_device","_i"]; + private ["_device"]; for "_i" from (count GVAR(availableDevices) - 1) to 0 step -1 do { _device = GVAR(availableDevices) select _i; @@ -52,6 +52,6 @@ if (_add) then { }; }; }; -if (count GVAR(currentOpenedDevice) > 0) then { +if !(GVAR(currentOpenedDevice) isEqualTo []) then { [GVAR(currentOpenedDevice)] call FUNC(removeDeviceByOwner); }; diff --git a/addons/bft/functions/fnc_handleSyncedArrayUpdate.sqf b/addons/bft/functions/fnc_handleSyncedArrayUpdate.sqf index de6e27bb77..697524edb6 100644 --- a/addons/bft/functions/fnc_handleSyncedArrayUpdate.sqf +++ b/addons/bft/functions/fnc_handleSyncedArrayUpdate.sqf @@ -26,7 +26,7 @@ private _variable = missionNamespace getvariable [_varName, []]; { private _compareID = if (typeName _x == "ARRAY") then {_x select 0} else {_x}; if (_compareID isEqualTo _elementID) exitwith { - _variable set[_forEachIndex, _data]; + _variable set [_forEachIndex, _data]; ["bft_syncedArrayChanged", [1, _data, _x]] call CBA_fnc_localEvent; }; } forEach _variable; diff --git a/addons/bft/functions/fnc_isDeviceOwned.sqf b/addons/bft/functions/fnc_isDeviceOwned.sqf index 37ddadf90e..9a5d730841 100644 --- a/addons/bft/functions/fnc_isDeviceOwned.sqf +++ b/addons/bft/functions/fnc_isDeviceOwned.sqf @@ -18,4 +18,4 @@ params ["_unit", "_deviceID"]; private _ownedIDs = _unit getvariable [QGVAR(ownedDevices), []]; -(_deviceID in _ownedIDs) +_deviceID in _ownedIDs diff --git a/addons/bft/functions/fnc_setDeviceAppData.sqf b/addons/bft/functions/fnc_setDeviceAppData.sqf index d295e50ef1..d9fe160652 100644 --- a/addons/bft/functions/fnc_setDeviceAppData.sqf +++ b/addons/bft/functions/fnc_setDeviceAppData.sqf @@ -18,7 +18,7 @@ params ["_deviceID", "_deviceData"]; private _data = [_deviceID] call FUNC(getDeviceData); -if (count _data == 0) exitwith {}; +if (_data isEqualTo []) exitwith {}; if (_deviceData isEqualTo (_data select 3)) exitwith {}; ["bft_updateDeviceData", [_deviceID, _deviceData]] call CBA_fnc_globalEvent; diff --git a/addons/bft/functions/fnc_syncedArrayGetNextID.sqf b/addons/bft/functions/fnc_syncedArrayGetNextID.sqf index 4d7c572378..6a883a67ef 100644 --- a/addons/bft/functions/fnc_syncedArrayGetNextID.sqf +++ b/addons/bft/functions/fnc_syncedArrayGetNextID.sqf @@ -18,7 +18,7 @@ params ["_varName"]; private _variable = missionNamespace getvariable [_varName, []]; private _nextID = 0; -if (count _variable > 0) then { +if !(_variable isEqualTo []) then { _nextID = ((_variable select (count _variable - 1)) select 0) + 1; }; diff --git a/addons/bft/functions/fnc_syncedArrayPushback.sqf b/addons/bft/functions/fnc_syncedArrayPushback.sqf index f12dd105ad..8f7cf36a8c 100644 --- a/addons/bft/functions/fnc_syncedArrayPushback.sqf +++ b/addons/bft/functions/fnc_syncedArrayPushback.sqf @@ -16,6 +16,6 @@ params ["_varName", "_data"]; -if (typeName _data == "ARRAY" && {(count _data == 0)}) exitwith {}; +if (typeName _data == "ARRAY" && {_data isEqualTo []}) exitwith {}; ["bft_syncedArrayPushback", [_varName, _data]] call CBA_fnc_globalEvent; diff --git a/addons/bft/functions/fnc_syncedArrayUpdate.sqf b/addons/bft/functions/fnc_syncedArrayUpdate.sqf index 7a405ad1dd..c6d1c0ea2b 100644 --- a/addons/bft/functions/fnc_syncedArrayUpdate.sqf +++ b/addons/bft/functions/fnc_syncedArrayUpdate.sqf @@ -16,6 +16,6 @@ params ["_varName", "_data"]; -if (typeName _data == "ARRAY" && (count _data == 0)) exitwith {}; +if (typeName _data == "ARRAY" && {_data isEqualTo []}) exitwith {}; ["bft_syncedArrayUpdate", _this] call CBA_fnc_globalEvent; diff --git a/addons/bft/functions/fnc_updateRegisteredEncryptionKeys.sqf b/addons/bft/functions/fnc_updateRegisteredEncryptionKeys.sqf index 9f46684120..d7a7f7ccdd 100644 --- a/addons/bft/functions/fnc_updateRegisteredEncryptionKeys.sqf +++ b/addons/bft/functions/fnc_updateRegisteredEncryptionKeys.sqf @@ -30,14 +30,14 @@ if (isNil "_add") then { if (_add) then { // figure out the real difference _keys = _keys - GVAR(registeredEncyptionKeys); - if (count _keys > 0) then { + if !(_keys isEqualTo []) then { GVAR(registeredEncyptionKeys) = GVAR(registeredEncyptionKeys) + _keys; _changed = true; }; } else { // figure out the real difference _keys = GVAR(registeredEncyptionKeys) - (GVAR(registeredEncyptionKeys) - _keys); - if (count _keys > 0) then { + if !(_keys isEqualTo []) then { GVAR(registeredEncyptionKeys) = GVAR(registeredEncyptionKeys) - _keys; _changed = true; }; diff --git a/addons/bft/functions/fnc_updateRegisteredModes.sqf b/addons/bft/functions/fnc_updateRegisteredModes.sqf index a110efb288..179bbe457e 100644 --- a/addons/bft/functions/fnc_updateRegisteredModes.sqf +++ b/addons/bft/functions/fnc_updateRegisteredModes.sqf @@ -30,14 +30,14 @@ if (isNil "_add") then { if (_add) then { // figure out the real difference _modes = _modes - GVAR(registeredViewModes); - if (count _modes > 0) then { + if !(_modes isEqualTo []) then { GVAR(registeredViewModes) = GVAR(registeredViewModes) + _modes; _changed = true; }; } else { // figure out the real difference _modes = GVAR(registeredViewModes) - (GVAR(registeredViewModes) - _modes); - if (count _modes > 0) then { + if !(_modes isEqualTo []) then { GVAR(registeredViewModes) = GVAR(registeredViewModes) - _modes; _changed = true; }; diff --git a/addons/bft/functions/fnc_validateInventory.sqf b/addons/bft/functions/fnc_validateInventory.sqf index 87f4653fa1..35d0cb02db 100644 --- a/addons/bft/functions/fnc_validateInventory.sqf +++ b/addons/bft/functions/fnc_validateInventory.sqf @@ -26,7 +26,7 @@ private _matchedIDs = []; { private _magID = [_x] call FUNC(getMagazineID); private _data = [_magID] call FUNC(getDeviceData); - if (count _data > 0) then { + if !(_data isEqualTo []) then { if !(_magID in _ownedDevices) then { systemChat format["validate - new picked up ID: %1 %2", _unit, _magID]; diag_log format["validate - new picked up ID: %1 %2", _unit, _magID]; @@ -36,8 +36,9 @@ private _matchedIDs = []; } else { if (!(_magId in GVAR(pendingIdAssignmentList))) then { private _magazine = (magazines _unit) select _forEachIndex; - if (getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)) != "") then { - ["bft_itemCreated", [_unit, getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)), _magazine, _magID]] call CBA_fnc_serverEvent; + private _configText = getText (configFile >> "CfgMagazines" >> _magazine >> QGVAR(type)); + if (_configText != "") then { + ["bft_itemCreated", [_unit, _configText, _magazine, _magID]] call CBA_fnc_serverEvent; }; }; }; diff --git a/addons/bft_devices/functions/fnc_processNotifications.sqf b/addons/bft_devices/functions/fnc_processNotifications.sqf index 199b27afc4..746bead52c 100644 --- a/addons/bft_devices/functions/fnc_processNotifications.sqf +++ b/addons/bft_devices/functions/fnc_processNotifications.sqf @@ -23,7 +23,7 @@ disableSerialization; // make sure there is no PFH already, the interface is open and notifications are available -if (isNil QGVAR(processNotificationsPFH) && !(I_CLOSED) && count GVAR(notificationCache) != 0) then { +if (isNil QGVAR(processNotificationsPFH) && {!I_CLOSED} && {!(GVAR(notificationCache) isEqualTo [])}) then { private _displayName = I_GET_NAME; private _display = uiNamespace getVariable _displayName; private _ctrl = _display displayCtrl IDC_NOTIFICATION; diff --git a/addons/bft_devices/functions/fnc_setSettings.sqf b/addons/bft_devices/functions/fnc_setSettings.sqf index ceab500df8..686b908b9c 100644 --- a/addons/bft_devices/functions/fnc_setSettings.sqf +++ b/addons/bft_devices/functions/fnc_setSettings.sqf @@ -74,10 +74,10 @@ private _combinedPropertiesUpdate = [] call CBA_fnc_hashCreate; if (!I_CLOSED) then { call { if (!_updateInterface) exitWith {}; - if (count _combinedPropertiesUpdate > 0) exitWith { + if !(_combinedPropertiesUpdate isEqualTo []) exitWith { [_combinedPropertiesUpdate] call FUNC(ifUpdate); }; - if (count _commonPropertiesUpdate > 0) then { + if !(_commonPropertiesUpdate isEqualTo []) then { [_commonPropertiesUpdate] call FUNC(ifUpdate); }; };