aboutsummaryrefslogtreecommitdiff
path: root/src/client/game.cpp
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/client/game.cpp
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/client/game.cpp')
-rw-r--r--src/client/game.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/client/game.cpp b/src/client/game.cpp
index 4d5fbfb97..5bf41bcd6 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -599,7 +599,6 @@ struct GameRunData {
bool dig_instantly;
bool digging_blocked;
bool left_punch;
- bool update_wielded_item_trigger;
bool reset_jump_timer;
float nodig_delay_timer;
float dig_time;
@@ -1018,7 +1017,6 @@ bool Game::startup(bool *kill,
// Reinit runData
runData = GameRunData();
runData.time_from_last_punch = 10.0;
- runData.update_wielded_item_trigger = true;
m_game_ui->initFlags();
@@ -3736,19 +3734,11 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime,
if (player->getWieldIndex() != runData.new_playeritem)
client->setPlayerItem(runData.new_playeritem);
- // Update local inventory if it has changed
- if (client->getLocalInventoryUpdated()) {
- //infostream<<"Updating local inventory"<<std::endl;
- runData.update_wielded_item_trigger = true;
- }
-
- if (runData.update_wielded_item_trigger) {
+ if (client->updateWieldedItem()) {
// Update wielded tool
ItemStack selected_item, hand_item;
ItemStack &tool_item = player->getWieldedItem(&selected_item, &hand_item);
camera->wield(tool_item);
-
- runData.update_wielded_item_trigger = false;
}
/*