true atomic EnttWorld

This commit is contained in:
2024-07-23 01:10:20 +02:00
parent 392eaeab83
commit 89d5ad5f54
16 changed files with 61 additions and 35 deletions

View File

@@ -16,7 +16,7 @@ KeepAliveHandler::KeepAliveHandler(network::EnetConnection& a_Connection, EnttWo
KeepAliveHandler::~KeepAliveHandler() {}
void KeepAliveHandler::Handle(std::uint16_t a_PeerId, const protocol::data::KeepAlive& a_KeepAlive) {
auto world = m_World.load();
AtomicEnttWorld world = m_World;
world->GetRegistry().view<KeepAliveSessionComponent>().each([a_PeerId, &a_KeepAlive](auto& keepAliveSession) {
if (keepAliveSession.m_PeerId == a_PeerId && keepAliveSession.m_LastKeepAliveId == a_KeepAlive.m_KeepAliveId) {
keepAliveSession.m_LastTime = Nz::GetElapsedMilliseconds();