OC integration: extractItems voiding excess items
Garagoth opened this issue ยท 3 comments
This line is extracting count
items instead of insertedSim.getCount()
and then inserting what was extracted, so when destination inventory has less space available then extracted all remaining items are lost.
Also, I'm not sure that line 322 and 323 are correct... line 327 would match only if insertedSim.getCount() was greater then transferAmount, which is not possible?
Regards,
Garagoth.
Yes, it should extract count
and not insertedSim.getCount()
since insertedSim
is the remainder after the insertion, NOT the items inserted?
It probably needs transferableAmount
instead of count
in the extractItem
call on line 332, and needs to handle overflow (which it currently doesn't).
Can you verify my theory?
Ah, true, insertedSim is the remainder, correct. Night time reading, apologies.
So maybe, if in line 332 we already know the we can extract count
and should be able to insert transferableAmount
(from simulations), then we can first insert transferableAmount
, get remainder of what was left (should be 0 most of time?), and then extract from RS network transferableAmount - inserted.getCount()
, this way overflowing items are handled - by never extracting them from network...
... or you can insert remainder into network again, but that is more operations on network, so worse performance (I imagine inserting is not trivial).