X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Finventorymanager.cpp;h=4d862de66c3c9f7f6c3a706f671fa6b7c05d6627;hb=420de7ad5e1bf2d8017705dcddcdcd03709d4410;hp=e2e5378383f8d4a0956256d9aa061ec6db086dd1;hpb=6a16075912d016926ee0361fb85f9979c119be52;p=dragonfireclient.git diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index e2e537838..4d862de66 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -332,6 +332,18 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame // If source is infinite, reset it's stack if(src_can_take_count == -1){ + // If destination stack is of different type and there are leftover + // items, attempt to put the leftover items to a different place in the + // destination inventory. + // The client-side GUI will try to guess if this happens. + if(from_stack_was.name != to_stack_was.name){ + for(u32 i=0; igetSize(); i++){ + if(list_to->getItem(i).empty()){ + list_to->changeItem(i, to_stack_was); + break; + } + } + } list_from->deleteItem(from_i); list_from->addItem(from_i, from_stack_was); } @@ -339,6 +351,8 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame if(dst_can_put_count == -1){ list_to->deleteItem(to_i); list_to->addItem(to_i, to_stack_was); + list_from->deleteItem(from_i); + list_from->addItem(from_i, from_stack_was); list_from->takeItem(from_i, count); }