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
This commit is contained in:
hg 2020-05-08 11:19:24 -04:00
parent eccc79e4ce
commit 1819b7c23b

View File

@ -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();
}