Approximate solution:
CAP_AddCurrent(base, CAP_ITEMS, PR_DisassembleItem(base, ufo->comp, ufo->condition, qfalse)); causes PR_DisassembleItem to be called twice in the inline function 'max'
This is where the inventory is added X 2
Calling PR_DisassembleItem seperately & saving size return value before calling CAP_AddCurrent(base, CAP_ITEMS, sizeret ) makes the invventory correct.
However the base stock level still adds 2 X the inventory.
Total stock is updated as PR_DisassembleItem adds each individual item to the seperate stock items so changing to
CAP_AddCurrent(base, CAP_ITEMS, 0 ) gives correct values.
This line should then do nothing (increases stock level by 0) so should be possible to delete.
Regards
Andy