Files
DayZ-Epoch/SQF/dayz_code/compile/player_weaponCheck.sqf
icomrade e54b9983dd Replace forEach with Count
Use count where you do not need _forEachIndex variable, it's quicker
than forEach.
2014-05-27 15:37:57 -04:00

36 lines
955 B
Plaintext

private ["_currentObjects","_newObjects","_checkObjects","_type","_qtyNow","_qtyBefore","_change"];
//_newObjects = [_previous,weapons player] call player_weaponCheck;
_currentObjects = _this select 0;
_checkObjects = _this select 1;
_change = false;
//Check if some of old loadout not there
_newObjects = [];
{
if (!(_x in _newObjects)) then {
_type = _x;
_qtyNow = {_x == _type} count _checkObjects;
_qtyBefore = {_x == _type} count _currentObjects;
if (_qtyNow != _qtyBefore) then {
_change = true;
};
_newObjects set [count _newObjects,_type];
};
} count _currentObjects;
//Compare current loadout with old loadout
_newObjects = [];
{
if (!(_x in _newObjects)) then {
_type = _x;
_qtyNow = {_x == _type} count _checkObjects;
_qtyBefore = {_x == _type} count _currentObjects;
if (_qtyNow != _qtyBefore) then {
_change = true;
};
_newObjects set [count _newObjects,_type];
};
} count _checkObjects;
_change;