diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-24 09:36:54 +0100 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-24 14:13:17 +0100 |
commit | 7851c4f7a2673477cf80a38842d77efbe5a0a915 (patch) | |
tree | bf061675545f6054aa8802d55549b951ec3eb0d7 /src/network | |
parent | 9fbc3a8ca364922bc1129a35c1a37addab5f023c (diff) | |
download | minetest-7851c4f7a2673477cf80a38842d77efbe5a0a915.tar.gz minetest-7851c4f7a2673477cf80a38842d77efbe5a0a915.tar.bz2 minetest-7851c4f7a2673477cf80a38842d77efbe5a0a915.zip |
Don't send an InventoryAction at each setInventoryModified, we only need one SendInventory per inventory modification
Client doesn't like to receive multiples SendInventory for one action, this can trigger glitches on clients (sometimes due to incorrect UDP packet ordering due to UDP protocol)
This fix issue #2544
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/serverpackethandler.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index f6438d311..7d5a9bc71 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -952,8 +952,8 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) ma->from_inv.applyCurrentPlayer(player->getName()); ma->to_inv.applyCurrentPlayer(player->getName()); - setInventoryModified(ma->from_inv); - setInventoryModified(ma->to_inv); + setInventoryModified(ma->from_inv, false); + setInventoryModified(ma->to_inv, false); bool from_inv_is_current_player = (ma->from_inv.type == InventoryLocation::PLAYER) && @@ -1006,7 +1006,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) da->from_inv.applyCurrentPlayer(player->getName()); - setInventoryModified(da->from_inv); + setInventoryModified(da->from_inv, false); /* Disable dropping items out of craftpreview @@ -1033,7 +1033,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) ca->craft_inv.applyCurrentPlayer(player->getName()); - setInventoryModified(ca->craft_inv); + setInventoryModified(ca->craft_inv, false); //bool craft_inv_is_current_player = // (ca->craft_inv.type == InventoryLocation::PLAYER) && @@ -1052,6 +1052,8 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt) a->apply(this, playersao, this); // Eat the action delete a; + + SendInventory(playersao); } void Server::handleCommand_ChatMessage(NetworkPacket* pkt) |