]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/inventorymanager.cpp
Allow server to accept protocol 13 clients altough they don't work too well
[dragonfireclient.git] / src / inventorymanager.cpp
index e2e5378383f8d4a0956256d9aa061ec6db086dd1..4d862de66c3c9f7f6c3a706f671fa6b7c05d6627 100644 (file)
@@ -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; i<list_to->getSize(); 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);
        }