This commit is contained in:
Magnetar 2018-10-04 16:33:29 +02:00
parent 3b181cb1b0
commit 05b8b5bd42
22 changed files with 39 additions and 34 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -16,4 +16,4 @@
params ["_keySetOne", "_keySetTwo"];
count (_keySetOne arrayIntersect _keySetTwo) > 0
!((_keySetOne arrayIntersect _keySetTwo) isEqualTo [])

View File

@ -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

View File

@ -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], [""]]

View File

@ -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;
};

View File

@ -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"

View File

@ -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

View File

@ -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 {};

View File

@ -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);
};

View File

@ -18,4 +18,4 @@ params ["_unit", "_deviceID"];
private _ownedIDs = _unit getvariable [QGVAR(ownedDevices), []];
(_deviceID in _ownedIDs)
_deviceID in _ownedIDs

View File

@ -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;

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -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;
};

View File

@ -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;
};

View File

@ -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;
};
};
};

View File

@ -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;

View File

@ -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);
};
};