From 8a37b6093d781556f3361e20c8f714dfee4280d4 Mon Sep 17 00:00:00 2001 From: Josuan Albin Date: Fri, 20 Jul 2018 22:54:04 +0200 Subject: [PATCH] Arsenal - Fix locality issue for adding weapons/backpacks and remove unnecessary check in scanConfig (#6456) * Remove unnecessary itemInfo check in scanConfig I got the best tests folks, believe me, the best. I made sure this didn't break anything by making sure the array had the same number of elements before and after removing those, best tests folks. * Change onSelChangedLeft to use global variant of addWeapon and addBackpack Fix a possible locality issue when opening ace arsenal on other players. --- addons/arsenal/functions/fnc_onSelChangedLeft.sqf | 10 +++++----- addons/arsenal/functions/fnc_scanConfig.sqf | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/arsenal/functions/fnc_onSelChangedLeft.sqf b/addons/arsenal/functions/fnc_onSelChangedLeft.sqf index ebfaeb0666..6c1e76a239 100644 --- a/addons/arsenal/functions/fnc_onSelChangedLeft.sqf +++ b/addons/arsenal/functions/fnc_onSelChangedLeft.sqf @@ -57,7 +57,7 @@ switch (GVAR(currentLeftPanel)) do { call _fnc_clearPreviousWepMags; private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x}; - GVAR(center) addWeapon _item; + GVAR(center) addWeaponGlobal _item; GVAR(center) addWeaponItem [_item, [(getArray (configfile >> "cfgweapons" >> _item >> "magazines")) select 0]]; { @@ -95,7 +95,7 @@ switch (GVAR(currentLeftPanel)) do { call _fnc_clearPreviousWepMags; private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x}; - GVAR(center) addWeapon _item; + GVAR(center) addWeaponGlobal _item; GVAR(center) addWeaponItem [_item, [(getArray (configfile >> "cfgweapons" >> _item >> "magazines")) select 0]]; { @@ -132,7 +132,7 @@ switch (GVAR(currentLeftPanel)) do { call _fnc_clearPreviousWepMags; private _compatibleItems = (_item call bis_fnc_compatibleItems) apply {tolower _x}; - GVAR(center) addWeapon _item; + GVAR(center) addWeaponGlobal _item; GVAR(center) addWeaponItem [_item, [(getArray (configfile >> "cfgweapons" >> _item >> "magazines")) select 0]]; { @@ -240,7 +240,7 @@ switch (GVAR(currentLeftPanel)) do { if ((GVAR(currentItems) select 6) != _item) then { removeBackpack GVAR(center); - GVAR(center) addBackpack _item; + GVAR(center) addBackpackGlobal _item; while {count backpackItems GVAR(center) > 0} do { GVAR(center) removeItemFromBackpack (backpackItems GVAR(center) select 0); }; //--- Remove default config contents @@ -295,7 +295,7 @@ switch (GVAR(currentLeftPanel)) do { GVAR(currentItems) set [9, _item]; } else { if ((GVAR(currentItems) select 9) != _item) then { - GVAR(center) addWeapon _item; + GVAR(center) addWeaponGlobal _item; GVAR(currentItems) set [9, _item]; call FUNC(showItem); ADDBINOCULARSMAG diff --git a/addons/arsenal/functions/fnc_scanConfig.sqf b/addons/arsenal/functions/fnc_scanConfig.sqf index bf0c95248f..f5c608db78 100644 --- a/addons/arsenal/functions/fnc_scanConfig.sqf +++ b/addons/arsenal/functions/fnc_scanConfig.sqf @@ -54,15 +54,15 @@ private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in va (_cargo select 1) select ([201,301,101,302] find _itemInfoType) pushBackUnique _className; }; /* Headgear */ - case (_hasItemInfo && {_itemInfoType == 605}): { + case (_itemInfoType == 605): { (_cargo select 3) pushBackUnique _className; }; /* Uniform */\ - case (_hasItemInfo && {_itemInfoType == 801}): { + case (_itemInfoType == 801): { (_cargo select 4) pushBackUnique _className; }; /* Vest */ - case (_hasItemInfo && {_itemInfoType == 701}): { + case (_itemInfoType == 701): { (_cargo select 5) pushBackUnique _className; }; /* NVgs */ @@ -95,7 +95,7 @@ private _configCfgWeapons = configFile >> "CfgWeapons"; //Save this lookup in va (_cargo select 14) pushBackUnique _className; }; /* UAV terminals */ - case (_hasItemInfo && {_itemInfoType == 621}): { + case (_itemInfoType == 621): { (_cargo select 14) pushBackUnique _className; }; /* Weapon, at the bottom to avoid adding binos */