Skip to content

Commit d516869

Browse files
committed
Dont't send item event confirmation if empty state
1 parent 59f1fdf commit d516869

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/items/network_item_manager.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
278278

279279
// 2) Apply all events to current confirmed state:
280280
int current_time = m_confirmed_state_time;
281+
bool has_state = count > 0;
281282
while(count > 0)
282283
{
283284
// 1) Decode the event in the message
@@ -331,8 +332,11 @@ void NetworkItemManager::restoreState(BareNetworkString *buffer, int count)
331332
} // while count >0
332333

333334
// Inform the server which events have been received.
334-
if (auto gp = GameProtocol::lock())
335-
gp->sendItemEventConfirmation(World::getWorld()->getTicksSinceStart());
335+
if (has_state)
336+
{
337+
if (auto gp = GameProtocol::lock())
338+
gp->sendItemEventConfirmation(World::getWorld()->getTicksSinceStart());
339+
}
336340

337341
// Forward the confirmed item state till the world time:
338342
int dt = World::getWorld()->getTicksSinceStart() - current_time;

0 commit comments

Comments
 (0)