Inventory: Release resizes-locked lists on all on_-callbacks

This commit is contained in:
Desour 2023-10-23 00:31:10 +02:00 committed by DS
parent 1a562ca144
commit a464b41d99

@ -592,17 +592,22 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
Report move to endpoints Report move to endpoints
*/ */
list_to.reset(); list_to.reset();
list_from.reset();
// Source = destination => move // Source = destination => move
if (from_inv == to_inv) { if (from_inv == to_inv) {
onMove(count, player); onMove(count, player);
if (did_swap) { if (did_swap) {
// Item is now placed in source list // Item is now placed in source list
list_from = get_borrow_checked_invlist(inv_from, from_list);
if (list_from) {
src_item = list_from->getItem(from_i); src_item = list_from->getItem(from_i);
list_from.reset();
swapDirections(); swapDirections();
onMove(src_item.count, player); onMove(src_item.count, player);
swapDirections(); swapDirections();
} }
}
mgr->setInventoryModified(from_inv); mgr->setInventoryModified(from_inv);
} else { } else {
int src_item_count = src_item.count; int src_item_count = src_item.count;
@ -616,11 +621,15 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
src_item.count = src_item_count; src_item.count = src_item_count;
if (did_swap) { if (did_swap) {
// Item is now placed in source list // Item is now placed in source list
list_from = get_borrow_checked_invlist(inv_from, from_list);
if (list_from) {
src_item = list_from->getItem(from_i); src_item = list_from->getItem(from_i);
list_from.reset();
swapDirections(); swapDirections();
onPutAndOnTake(src_item, player); onPutAndOnTake(src_item, player);
swapDirections(); swapDirections();
} }
}
mgr->setInventoryModified(to_inv); mgr->setInventoryModified(to_inv);
mgr->setInventoryModified(from_inv); mgr->setInventoryModified(from_inv);
} }