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/server.cpp | |
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/server.cpp')
-rw-r--r-- | src/server.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp index 52183980f..8c76fdc16 100644 --- a/src/server.cpp +++ b/src/server.cpp @@ -1290,13 +1290,16 @@ Inventory* Server::getInventory(const InventoryLocation &loc) } return NULL; } -void Server::setInventoryModified(const InventoryLocation &loc) +void Server::setInventoryModified(const InventoryLocation &loc, bool playerSend) { switch(loc.type){ case InventoryLocation::UNDEFINED: break; case InventoryLocation::PLAYER: { + if (!playerSend) + return; + Player *player = m_env->getPlayer(loc.name.c_str()); if(!player) return; |