From 1819b7c23b3e7d1470d6306421582efe51a45a25 Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Fri, 8 May 2020 11:19:24 -0400 Subject: [PATCH] Cache new expedition before sending client updates Compass updates get data from the expedition cache so it needs to be cached first. Currently this doesn't affect anything because compass isn't sent to CreateExpedition and has to be set post-creation. In the future this will make the order of client messages more live accurate though --- zone/expedition.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zone/expedition.cpp b/zone/expedition.cpp index 7be333b0c..ade863363 100644 --- a/zone/expedition.cpp +++ b/zone/expedition.cpp @@ -128,8 +128,11 @@ Expedition* Expedition::TryCreate( expedition->SaveMembers(request); expedition->SaveLockouts(request); - expedition->SendUpdatesToZoneMembers(); - expedition->SendWorldExpeditionUpdate(); // cache in other zones + + auto inserted = zone->expedition_cache.emplace(expedition_id, std::move(expedition)); + + inserted.first->second->SendUpdatesToZoneMembers(); + inserted.first->second->SendWorldExpeditionUpdate(); // cache in other zones Client* leader_client = request.GetLeaderClient(); @@ -137,7 +140,6 @@ Expedition* Expedition::TryCreate( leader_client, leader.name, Chat::Yellow, EXPEDITION_AVAILABLE, { request.GetExpeditionName() } ); - auto inserted = zone->expedition_cache.emplace(expedition_id, std::move(expedition)); return inserted.first->second.get(); }