Ignore expired lockouts on expedition invite

This fixes an edge case with client invites sometimes failing because
an expired lockout hasn't been removed from client yet

Clients no longer receive expired lockouts from expeditions when joining
This commit is contained in:
hg
2020-06-01 18:21:12 -04:00
parent 4284624096
commit f9eafa52f9
5 changed files with 33 additions and 26 deletions
+16 -14
View File
@@ -9613,19 +9613,6 @@ Expedition* Client::GetExpedition() const
return nullptr;
}
std::vector<ExpeditionLockoutTimer> Client::GetExpeditionLockouts(const std::string& expedition_name)
{
std::vector<ExpeditionLockoutTimer> lockouts;
for (const auto& lockout : m_expedition_lockouts)
{
if (lockout.GetExpeditionName() == expedition_name)
{
lockouts.emplace_back(lockout);
}
}
return lockouts;
}
void Client::AddExpeditionLockout(const ExpeditionLockoutTimer& lockout, bool update_db, bool update_client)
{
// todo: support for account based lockouts like live AoC expeditions
@@ -9707,7 +9694,7 @@ const ExpeditionLockoutTimer* Client::GetExpeditionLockout(
{
for (const auto& expedition_lockout : m_expedition_lockouts)
{
if ((include_expired || expedition_lockout.GetSecondsRemaining() > 0) &&
if ((include_expired || !expedition_lockout.IsExpired()) &&
expedition_lockout.IsSameLockout(expedition_name, event_name))
{
return &expedition_lockout;
@@ -9716,6 +9703,21 @@ const ExpeditionLockoutTimer* Client::GetExpeditionLockout(
return nullptr;
}
std::vector<ExpeditionLockoutTimer> Client::GetExpeditionLockouts(
const std::string& expedition_name, bool include_expired)
{
std::vector<ExpeditionLockoutTimer> lockouts;
for (const auto& lockout : m_expedition_lockouts)
{
if ((include_expired || !lockout.IsExpired()) &&
lockout.GetExpeditionName() == expedition_name)
{
lockouts.emplace_back(lockout);
}
}
return lockouts;
}
bool Client::HasExpeditionLockout(
const std::string& expedition_name, const std::string& event_name, bool include_expired)
{