@@ -312,9 +312,12 @@ _backpackItems = _inventory select 2 select 1;
312312
313313// add containers
314314_containers = [_uniform ,_vest ,_backpack ];
315- private _invCallArray = [{removeUniform player ;player forceAddUniform _uniform ;},// todo remove
316- {removeVest player ;player addVest _vest ;},
317- {removeBackpackGlobal player ;player addBackpack _backpack ;}];
315+ private _removeContainerFuncs = [{removeUniform player ;},{removeVest player ;},{removeBackpackGlobal player ;}];
316+ private _addContainerFuncs = [
317+ {player forceAddUniform (_this select 0 );},
318+ {player addVest (_this select 0 );},
319+ {player addBackpack (_this select 0 );}
320+ ];
318321{
319322 _item = _x ;
320323 if ! (_item isEqualTo " " )then {
@@ -324,20 +327,22 @@ private _invCallArray = [{removeUniform player;player forceAddUniform _uniform;}
324327 IDC_RSCDISPLAYARSENAL_TAB_VEST,
325328 IDC_RSCDISPLAYARSENAL_TAB_BACKPACK
326329 ] select _foreachindex ;
327-
330+
331+ _addContainerFunc = (_addContainerFuncs select _foreachindex );
332+
328333 call {
329334 if ([_itemCounts select _index , _item ] call jn_fnc_arsenal_itemCount == - 1 ) exitWith {
330- call ( _invCallArray select _foreachindex ) ;
335+ [ _item ] call _addContainerFunc ;
331336 };
332337
333338 if ([_availableItems select _index , _item ] call jn_fnc_arsenal_itemCount > 0 ) then {
334- call ( _invCallArray select _foreachindex ) ;
339+ [ _item ] call _addContainerFunc ;
335340 [_arrayTaken ,_index ,_item ,_amount ] call _addToArray ;
336341 [_availableItems ,_index ,_item ,_amount ] call _removeFromArray ;
337342 } else {
338343 _oldItem = [_uniform_old ,_vest_old ,_backpack_old ] select _foreachindex ;
339344 if ! (_oldItem isEqualTo " " ) then {
340- call ( _invCallArray select _foreachindex ) ;
345+ [ _oldItem ] call _addContainerFunc ;
341346 _arrayReplaced = [_arrayReplaced ,[_item ,_oldItem ]] call jn_fnc_arsenal_addToArray ;
342347 [_arrayTaken ,_index ,_oldItem ,1 ] call _addToArray ;
343348 } else {
@@ -407,11 +412,23 @@ private _invCallArray = [{removeUniform player;player forceAddUniform _uniform;}
407412// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Update global
408413// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
409414
415+ private _lookupConfigName = {
416+ private _class = param [0 ];
417+ private _configs = " configName _x == _class" configClasses (configFile >> " CfgWeapons" );
418+ if (count _configs > 0 ) exitWith {
419+ [_configs select 0 ] call BIS_fnc_displayName ;
420+ };
421+ private _configs = " configName _x == _class" configClasses (configFile >> " CfgMagazines" );
422+ if (count _configs > 0 ) exitWith {
423+ [_configs select 0 ] call BIS_fnc_displayName ;
424+ };
425+ _class ;
426+ };
427+
410428_arrayAdd = [_arrayPlaced , _arrayTaken ] call _subtractArrays ; // remove items that where not added
411429_arrayRemove = [_arrayTaken , _arrayPlaced ] call _subtractArrays ;
412430
413431_arrayAdd call jn_fnc_arsenal_addItem ;
414- diag_log " adadadadada" ;
415432diag_log _arrayTaken ;
416433diag_log _arrayPlaced ;
417434_arrayRemove call jn_fnc_arsenal_removeItem ;
@@ -422,24 +439,24 @@ _arrayRemove call jn_fnc_arsenal_removeItem;
422439_reportTotal = " " ;
423440_reportReplaced = " " ;
424441{
425- _nameNew = _x select 0 ;
426- _nameOld = _x select 1 ;
427- _reportReplaced = _reportReplaced + _nameOld + " instead of " + _nameNew + " \n" ;
442+ _nameNew = [ _x select 0 ] call _lookupConfigName ;
443+ _nameOld = [ _x select 1 ] call _lookupConfigName ;
444+ _reportReplaced = _reportReplaced + _nameOld + " has been kept, because there is no " + _nameNew + " \n" ;
428445} forEach _arrayReplaced ;
429446
430447if ! (_reportReplaced isEqualTo " " )then {
431- _reportTotal = (" I keep this items because i couldn't find the other ones :\n" + _reportReplaced + " \n" );
448+ _reportTotal = (" These items were not in the Arsenal, so the originals have been kept :\n" + _reportReplaced + " \n" );
432449};
433450
434451_reportMissing = " " ;
435452{
436- _name = _x select 0 ;
453+ _name = [ _x select 0 ] call _lookupConfigName ;
437454 _amount = _x select 1 ;
438455 _reportMissing = _reportMissing + _name + " (" + (str _amount ) + " x)\n" ;
439456}forEach _arrayMissing ;
440457
441458if ! (_reportMissing isEqualTo " " )then {
442- _reportTotal = (_reportTotal + " I couldn't find the following items :\n" + _reportMissing + " \n" );
459+ _reportTotal = (_reportTotal + " These items were not in the Arsenal :\n" + _reportMissing + " \n" );
443460};
444461
445462if ! (_reportTotal isEqualTo " " )then {
0 commit comments