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.
This commit is contained in:
Josuan Albin 2018-07-20 22:54:04 +02:00 committed by PabstMirror
parent 0b19a8d527
commit 8a37b6093d
2 changed files with 9 additions and 9 deletions

View File

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

View File

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