Skip to content

Commit 97ca733

Browse files
committed
Scene: pack() now reset client stat
1 parent dcf738b commit 97ca733

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

sources/C_scene.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,8 +1163,15 @@ void Scene::pack(fge::net::Packet& pck)
11631163
}
11641164
void Scene::pack(fge::net::Packet& pck, fge::net::Identity const& id)
11651165
{
1166-
this->g_perClientSyncs.emplace(std::piecewise_construct, std::forward_as_tuple(id),
1167-
std::forward_as_tuple(this->g_updateCount));
1166+
auto result = this->g_perClientSyncs.emplace(std::piecewise_construct, std::forward_as_tuple(id),
1167+
std::forward_as_tuple(this->g_updateCount));
1168+
if (!result.second)
1169+
{
1170+
result.first->second._lastUpdateCount = this->g_updateCount;
1171+
std::queue<SceneNetEvent>().swap(result.first->second._networkEvents);
1172+
this->forceUncheckClient(id);
1173+
}
1174+
11681175
this->pack(pck);
11691176
}
11701177
std::optional<fge::net::Error> Scene::unpack(fge::net::Packet const& pck)

0 commit comments

Comments
 (0)