Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NO SQUASH] Server: Correct client inventory prediction for IDropAction and IMoveAction #15742

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SmallJoker
Copy link
Member

Fixes the root cause of #15728.
The first commit is a cleanup of messy code that I encountered.

Details (same issue): #15728 (comment)

To do

This PR is Ready for Review.

How to test

diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp
index 86c18725f..45fa8fa13 100644
--- a/src/network/serverpackethandler.cpp
+++ b/src/network/serverpackethandler.cpp
@@ -711,7 +711,8 @@ void Server::handleCommand_InventoryAction(NetworkPacket* pkt)
 		da->from_inv.applyCurrentPlayer(player->getName());
 
 		m_inventory_mgr->setInventoryModified(da->from_inv);
-		mark_player_inv_list_dirty(da->from_inv, da->from_list);
+		//mark_player_inv_list_dirty(da->from_inv, da->from_list);
+		return;
 
 		/*
 			Disable dropping items out of craftpreview
  1. Drop an item. The inventory remains in an outdated state.
  2. Uncomment the mark_player_inv_list_dirty line. The client prediction is now reverted.

The affected player inventory list is now marked as modified.
This way, it will also be re-sent if the server denies the action.
Copy link
Collaborator

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants