From d5168691e11acdce4fb698d5d8096538c1429cf2 Mon Sep 17 00:00:00 2001 From: Benau Date: Wed, 18 Jul 2018 13:33:37 +0800 Subject: [PATCH] Dont't send item event confirmation if empty state --- src/items/network_item_manager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/items/network_item_manager.cpp b/src/items/network_item_manager.cpp index 70a218050..f07235b28 100644 --- a/src/items/network_item_manager.cpp +++ b/src/items/network_item_manager.cpp @@ -278,6 +278,7 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count) // 2) Apply all events to current confirmed state: int current_time = m_confirmed_state_time; + bool has_state = count > 0; while(count > 0) { // 1) Decode the event in the message @@ -331,8 +332,11 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count) } // while count >0 // Inform the server which events have been received. - if (auto gp = GameProtocol::lock()) - gp->sendItemEventConfirmation(World::getWorld()->getTicksSinceStart()); + if (has_state) + { + if (auto gp = GameProtocol::lock()) + gp->sendItemEventConfirmation(World::getWorld()->getTicksSinceStart()); + } // Forward the confirmed item state till the world time: int dt = World::getWorld()->getTicksSinceStart() - current_time;