From 3502efddba4278c10c04afda096cf66dfa4e7f74 Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Wed, 25 Oct 2017 19:43:01 +0200 Subject: [PATCH] Change the way weapons are checked in fillLoadoutsList --- .../functions/fnc_fillLoadoutsList.sqf | 66 ++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/addons/arsenal/functions/fnc_fillLoadoutsList.sqf b/addons/arsenal/functions/fnc_fillLoadoutsList.sqf index 079ee3b744..c492118e67 100644 --- a/addons/arsenal/functions/fnc_fillLoadoutsList.sqf +++ b/addons/arsenal/functions/fnc_fillLoadoutsList.sqf @@ -24,53 +24,45 @@ GVAR(loadoutsList) = []; private _weaponCheck = { params ["_dataPath"]; - for "_sub_subIndex" from 0 to 6 do { - switch (_sub_subIndex) do { - case 0; - case 1; - case 2; - case 3; - case 6: { - if ((count _dataPath) != 0) then { + if (count _dataPath != 0) then { + { + if (_x isEqualType "") then { - private _item = _dataPath select _sub_subIndex; + private _item = _x; - if (_item != "") then { - if (isClass (_weaponCfg >> _item)) then { + if (_item != "") then { + if (isClass (_weaponCfg >> _item)) then { + if !(CHECK_WEAPON_OR_ACC) then { - if !(CHECK_WEAPON_OR_ACC) then { - - _dataPath set [_sub_subIndex, ""]; - _unavailableItemsAmount = _unavailableItemsAmount + 1; - }; - } else { - - _dataPath set [_sub_subIndex, ""]; - _nullItemsAmount = _nullItemsAmount + 1; - }; - }; - }; - }; - - case 4; - case 5: { - if (((count _dataPath) != 0)) then { - - private _mag = (_dataPath select _sub_subIndex) select 0; - - if (isClass (_magCfg >> _mag)) then { - - if !(_mag in (GVAR(virtualItems) select 2)) then { - _dataPath set [_sub_subIndex, []]; + _dataPath set [_forEachIndex, ""]; _unavailableItemsAmount = _unavailableItemsAmount + 1; }; } else { - _dataPath set [_sub_subIndex, []]; + + _dataPath set [_forEachIndex, ""]; + _nullItemsAmount = _nullItemsAmount + 1; + }; + }; + + } else { + + if (count _x != 0) then { + private _mag = _x select 0; + + if (isClass (_magCfg >> _mag)) then { + if !(_mag in (GVAR(virtualItems) select 2)) then { + + _dataPath set [_forEachIndex, []]; + _unavailableItemsAmount = _unavailableItemsAmount + 1; + }; + } else { + + _dataPath set [_forEachIndex, []]; _nullItemsAmount = _nullItemsAmount + 1; }; }; }; - }; + } foreach _dataPath; }; };