Only send member updates after caching dz data

This fixes characters not receiving a compass if they're already
in the compass zone when an expedition is created from another zone
This commit is contained in:
hg 2020-10-04 18:45:16 -04:00
parent 18dd9e6637
commit cd98b8bc6f

View File

@ -163,7 +163,6 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
using col = LoadExpeditionColumns::eLoadExpeditionColumns;
Expedition* current_expedition = nullptr;
uint32_t last_expedition_id = 0;
for (auto row = results.begin(); row != results.end(); ++row)
@ -172,12 +171,6 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
if (expedition_id != last_expedition_id)
{
// finished parsing previous expedition members, send member updates
if (current_expedition)
{
current_expedition->SendUpdatesToZoneMembers();
}
expedition_ids.emplace_back(expedition_id);
uint32_t leader_id = strtoul(row[col::leader_id], nullptr, 10);
@ -209,7 +202,7 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
last_expedition_id = expedition_id;
// looping expedition members
current_expedition = Expedition::FindCachedExpeditionByID(last_expedition_id);
auto current_expedition = Expedition::FindCachedExpeditionByID(last_expedition_id);
if (current_expedition)
{
auto member_id = strtoul(row[col::member_id], nullptr, 10);
@ -219,12 +212,6 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
}
}
// update for the last cached expedition
if (current_expedition)
{
current_expedition->SendUpdatesToZoneMembers();
}
// ask world for online members from all cached expeditions at once
Expedition::SendWorldGetOnlineMembers(expedition_character_ids);
@ -248,6 +235,9 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
{
expedition->m_lockouts = lockout_iter->second;
}
// send member updates now that all data is loaded for the cached expedition(s)
expedition->SendUpdatesToZoneMembers();
}
}
}