Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ SilentSpike
Timi007
Toinane
Tuupertunut
Venrix
veteran29
vivngh
2 changes: 1 addition & 1 deletion addons/inventory/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CfgPatches {
requiredVersion = REQUIRED_VERSION;
requiredAddons[] = {"zen_attributes"};
author = ECSTRING(main,Author);
authors[] = {"mharis001"};
authors[] = {"mharis001", "Venrix"};
url = ECSTRING(main,URL);
VERSION_CONFIG;
};
Expand Down
20 changes: 20 additions & 0 deletions addons/inventory/functions/fnc_confirm.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ private _object = _display getVariable QGVAR(object);
private _cargo = _display getVariable QGVAR(cargo);
_cargo params ["_itemCargo", "_weaponCargo", "_magazineCargo", "_backpackCargo"];

// Preserve nested container contents (the cargo model below only tracks backpack classes)
private _savedContainers = everyContainer _object apply {
_x params ["_type", "_container"];

[_type, _container call EFUNC(common,serializeInventory)]
};

clearItemCargoGlobal _object;
clearWeaponCargoGlobal _object;
clearMagazineCargoGlobal _object;
Expand Down Expand Up @@ -50,3 +57,16 @@ _backpackCargo params ["_backpackTypes", "_backpackCounts"];
{
_object addBackpackCargoGlobal [_x, _backpackCounts select _forEachIndex];
} forEach _backpackTypes;

// Restore preserved contents into the re-added backpacks, matching (and consuming) by class
private _allContainers = everyContainer _object;

{
_x params ["_type", "_containerData"];

private _index = _allContainers findIf {_x select 0 == _type};
if (_index != -1) then {
private _container = (_allContainers deleteAt _index) select 1;
[_container, _containerData] call EFUNC(common,deserializeInventory);
};
} forEach _savedContainers;