diff options
author | SmallJoker <SmallJoker@users.noreply.github.com> | 2019-08-24 19:07:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-24 19:07:38 +0200 |
commit | 0b4f424f414380b7a46270e1389e8aa0524d8fba (patch) | |
tree | 5731cbe72bb3178d697b3cda43b838f26ba34f7d /src/client/game.cpp | |
parent | 008b80fe1ca9d46610b8971e2ac92fb56da8e69f (diff) | |
download | minetest-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.cpp | 12 |
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; } /* |