Skip to content

Commit f41d364

Browse files
committed
Fixes arsenal bug with magazine UI not populating correctly
1 parent cdd5c56 commit f41d364

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

A3-Antistasi/JeroenArsenal/JNA/fn_vehicleArsenal.sqf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ switch _mode do {
367367
];
368368

369369
//loop all magazines and find usable
370+
//First, search mags in Arsenal
370371
_magazines = [];
371372
{
372373
_itemAvailable = _x select 0;
@@ -376,6 +377,16 @@ switch _mode do {
376377
_magazines set [count _magazines,[_itemAvailable, _amountAvailable]];
377378
};
378379
} forEach (jna_dataList select IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL);
380+
381+
//Then add mags in the car, but say we have none available - we'll add available number later
382+
{
383+
_itemAvailable = _x select 0;
384+
385+
if(_itemAvailable in _usableMagazines)then{
386+
//Use addToArray to avoid duplicating the type if they're already in the arsenal
387+
_magazines = [_magazines, [_itemAvailable,0]] call jn_fnc_arsenal_addToArray
388+
};
389+
} forEach (jnva_loadout select IDC_RSCDISPLAYARSENAL_TAB_CARGOMAGALL);
379390
//return
380391
_magazines;
381392
}else{
@@ -414,12 +425,14 @@ switch _mode do {
414425
IDC_RSCDISPLAYARSENAL_TAB_SECONDARYWEAPON,
415426
IDC_RSCDISPLAYARSENAL_TAB_HANDGUN
416427
];
417-
428+
429+
private _magazineItemsInTab = [];
418430
{
419431
_item = _x;
420432
_amount = [_items, _item] call jn_fnc_arsenal_itemCount;
421-
jnva_loadout set [_index,[jnva_loadout select _index,[_item,_amount]] call jn_fnc_arsenal_addToArray];
433+
_magazineItemsInTab = [_magazineItemsInTab, [_item,_amount]] call jn_fnc_arsenal_addToArray;
422434
} forEach _itemsUnique2;
435+
jnva_loadout set [_index,_magazineItemsInTab];
423436

424437
}else{
425438
{

0 commit comments

Comments
 (0)