From 94a5df795c6d591042d8c29dc4548afdd1074190 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 18 Sep 2019 18:47:09 +0200 Subject: Inventory: Properly revert client predictions (#8945) Caused by incremental inventory sending Previously everything was overwritten by serializing the entire inventory --- src/inventorymanager.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/inventorymanager.cpp') diff --git a/src/inventorymanager.cpp b/src/inventorymanager.cpp index fccfdea16..57b561477 100644 --- a/src/inventorymanager.cpp +++ b/src/inventorymanager.cpp @@ -348,6 +348,13 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame /* If no items will be moved, don't go further */ if (count == 0) { + // Undo client prediction. See 'clientApply' + if (from_inv.type == InventoryLocation::PLAYER) + list_from->setModified(); + + if (to_inv.type == InventoryLocation::PLAYER) + list_to->setModified(); + infostream<<"IMoveAction::apply(): move was completely disallowed:" <<" count="<setInventoryModified(from_inv); + + // Revert client prediction. See 'clientApply' + if (from_inv.type == InventoryLocation::PLAYER) + list_from->setModified(); return; } -- cgit v1.2.3