summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorSmallJoker <SmallJoker@users.noreply.github.com>2019-08-24 19:07:38 +0200
committerGitHub <noreply@github.com>2019-08-24 19:07:38 +0200
commit0b4f424f414380b7a46270e1389e8aa0524d8fba (patch)
tree5731cbe72bb3178d697b3cda43b838f26ba34f7d /src/network
parent008b80fe1ca9d46610b8971e2ac92fb56da8e69f (diff)
downloadminetest-0b4f424f414380b7a46270e1389e8aa0524d8fba.tar.gz
minetest-0b4f424f414380b7a46270e1389e8aa0524d8fba.tar.bz2
minetest-0b4f424f414380b7a46270e1389e8aa0524d8fba.zip
Inventory: Send dirty lists where appropriate (#8742)
This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time. Raises protocol version to 38 to ensure correct backwards-compatible code.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/clientpackethandler.cpp2
-rw-r--r--src/network/networkprotocol.h5
-rw-r--r--src/network/serverpackethandler.cpp8
3 files changed, 9 insertions, 6 deletions
diff --git a/src/network/clientpackethandler.cpp b/src/network/clientpackethandler.cpp
index 520fcfa81..91829474e 100644
--- a/src/network/clientpackethandler.cpp
+++ b/src/network/clientpackethandler.cpp
@@ -333,7 +333,7 @@ void Client::handleCommand_Inventory(NetworkPacket* pkt)
player->inventory.deSerialize(is);
- m_inventory_updated = true;
+ m_update_wielded_item = true;
delete m_inventory_from_server;
m_inventory_from_server = new Inventory(player->inventory);
diff --git a/src/network/networkprotocol.h b/src/network/networkprotocol.h
index 451518bbf..05737d0a9 100644
--- a/src/network/networkprotocol.h
+++ b/src/network/networkprotocol.h
@@ -195,9 +195,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
ContentFeatures version 13
Add full Euler rotations instead of just yaw
Add TOCLIENT_PLAYER_SPEED
+ PROTOCOL VERSION 38:
+ Incremental inventory sending mode
+ Unknown inventory serialization fields no longer throw an error
*/
-#define LATEST_PROTOCOL_VERSION 37
+#define LATEST_PROTOCOL_VERSION 38
#define LATEST_PROTOCOL_VERSION_STRING TOSTRING(LATEST_PROTOCOL_VERSION)
// Server's supported network protocol range
diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 5ad60f48a..1965d87aa 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -732,7 +732,7 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
// Eat the action
delete a;
- SendInventory(playersao);
+ SendInventory(playersao, true);
}
void Server::handleCommand_ChatMessage(NetworkPacket* pkt)
@@ -1310,7 +1310,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
// Apply returned ItemStack
if (playersao->setWieldedItem(item)) {
- SendInventory(playersao);
+ SendInventory(playersao, true);
}
}
@@ -1346,7 +1346,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
item, playersao, pointed)) {
// Apply returned ItemStack
if (playersao->setWieldedItem(item)) {
- SendInventory(playersao);
+ SendInventory(playersao, true);
}
}
@@ -1364,7 +1364,7 @@ void Server::handleCommand_Interact(NetworkPacket *pkt)
if (m_script->item_OnSecondaryUse(
item, playersao)) {
if( playersao->setWieldedItem(item)) {
- SendInventory(playersao);
+ SendInventory(playersao, true);
}
}
} // action == INTERACT_ACTIVATE