aboutsummaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2019-08-25 10:55:27 +0200
committerSmallJoker <mk939@ymail.com>2019-09-09 19:19:54 +0200
commitfae6242d4ef6ca34d131054484acf5efc2fcba70 (patch)
tree46d865c5f8af0bb7e67e0c105db85be210891fe1 /src/network
parenta57f951e021efb11fb7d5779d63aa36ede7a41b4 (diff)
downloadminetest-fae6242d4ef6ca34d131054484acf5efc2fcba70.tar.gz
minetest-fae6242d4ef6ca34d131054484acf5efc2fcba70.tar.bz2
minetest-fae6242d4ef6ca34d131054484acf5efc2fcba70.zip
Send cumulated inventory changes only each step (#8856)
Applies to player and detached inventories
Diffstat (limited to 'src/network')
-rw-r--r--src/network/serverpackethandler.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 1965d87aa..6cb3b3520 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -313,7 +313,7 @@ void Server::handleCommand_Init2(NetworkPacket* pkt)
sendMediaAnnouncement(pkt->getPeerId(), lang);
// Send detached inventories
- sendDetachedInventories(pkt->getPeerId());
+ sendDetachedInventories(pkt->getPeerId(), false);
// Send time of day
u16 time = m_env->getTimeOfDay();
@@ -608,10 +608,9 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
ma->from_inv.applyCurrentPlayer(player->getName());
ma->to_inv.applyCurrentPlayer(player->getName());
- setInventoryModified(ma->from_inv, false);
- if (ma->from_inv != ma->to_inv) {
- setInventoryModified(ma->to_inv, false);
- }
+ setInventoryModified(ma->from_inv);
+ if (ma->from_inv != ma->to_inv)
+ setInventoryModified(ma->to_inv);
bool from_inv_is_current_player =
(ma->from_inv.type == InventoryLocation::PLAYER) &&
@@ -676,7 +675,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
da->from_inv.applyCurrentPlayer(player->getName());
- setInventoryModified(da->from_inv, false);
+ setInventoryModified(da->from_inv);
/*
Disable dropping items out of craftpreview
@@ -712,7 +711,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
ca->craft_inv.applyCurrentPlayer(player->getName());
- setInventoryModified(ca->craft_inv, false);
+ setInventoryModified(ca->craft_inv);
//bool craft_inv_is_current_player =
// (ca->craft_inv.type == InventoryLocation::PLAYER) &&
@@ -731,8 +730,6 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
a->apply(this, playersao, this);
// Eat the action
delete a;
-
- SendInventory(playersao, true);
}
void Server::handleCommand_ChatMessage(NetworkPacket* pkt)