1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix inventory replace bug

This commit is contained in:
est31 2015-08-19 02:28:37 +02:00
parent c2d23ff9cc
commit 1fadf7f21e
3 changed files with 12 additions and 7 deletions

View file

@ -375,8 +375,9 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
If something is wrong (source item is empty, destination is the
same as source), nothing happens
*/
bool did_swap = false;
move_count = list_from->moveItem(from_i,
list_to, to_i, count, !caused_by_move_somewhere);
list_to, to_i, count, !caused_by_move_somewhere, &did_swap);
// If source is infinite, reset it's stack
if (src_can_take_count == -1) {
@ -397,7 +398,7 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
}
}
}
if (move_count > 0) {
if (move_count > 0 || did_swap) {
list_from->deleteItem(from_i);
list_from->addItem(from_i, from_stack_was);
}