Don't set member offline before linkdead

This prevents toggling to offline state before setting to and from
linkdead status. Without this change, a new expedition leader will be
chosen as soon as the current leader goes linkdead. On live an
expedition leader retains leadership while linkdead
This commit is contained in:
hg 2020-07-11 20:59:36 -04:00
parent d8b825f478
commit 9c4df6f026
2 changed files with 8 additions and 5 deletions

View File

@ -738,7 +738,7 @@ public:
bool TGB() const { return tgb; }
void OnDisconnect(bool hard_disconnect);
void OnDisconnect(bool hard_disconnect, bool linkdead = false);
uint16 GetSkillPoints() { return m_pp.points;}
void SetSkillPoints(int inp) { m_pp.points = inp;}

View File

@ -560,17 +560,20 @@ bool Client::Process() {
}
if (client_state != CLIENT_LINKDEAD && !eqs->CheckState(ESTABLISHED)) {
OnDisconnect(true);
LogInfo("Client linkdead: {}", name);
if (Admin() > 100) {
OnDisconnect(true);
if (GetMerc()) {
GetMerc()->Save();
GetMerc()->Depop();
}
return false;
}
else if (!linkdead_timer.Enabled()) {
OnDisconnect(true, true);
if (!linkdead_timer.Enabled()) {
linkdead_timer.Start(RuleI(Zone, ClientLinkdeadMS));
client_state = CLIENT_LINKDEAD;
AI_Start(CLIENT_LD_TIMEOUT);
@ -689,7 +692,7 @@ bool Client::Process() {
}
/* Just a set of actions preformed all over in Client::Process */
void Client::OnDisconnect(bool hard_disconnect) {
void Client::OnDisconnect(bool hard_disconnect, bool linkdead) {
if(hard_disconnect)
{
LeaveGroup();
@ -713,7 +716,7 @@ void Client::OnDisconnect(bool hard_disconnect) {
}
Expedition* expedition = GetExpedition();
if (expedition && !bZoning)
if (expedition && !bZoning && !linkdead && !linkdead_timer.Enabled())
{
expedition->SetMemberStatus(this, ExpeditionMemberStatus::Offline);
}