fix: Adds more debugging to the timer system. Simplifies the timer pool. (#1195)

This commit is contained in:
Kamron Batman 2022-10-17 23:25:49 -07:00 • committed by GitHub
parent d5416b6dec
commit 919b7e9416
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 99 additions and 38 deletions

View file

@ -9,8 +9,7 @@ namespace Server
{
private TimerExecutionToken _timerToken;
public BuffInfo(BuffIcon iconID, int titleCliloc)
: this(iconID, titleCliloc, titleCliloc + 1)
public BuffInfo(BuffIcon iconID, int titleCliloc) : this(iconID, titleCliloc, titleCliloc + 1)
{
}
@ -105,8 +104,6 @@ namespace Server
public long TimeStart { get; }
public TimerExecutionToken TimerToken => _timerToken;
public bool RetainThroughDeath { get; }
public TextDefinition Args { get; }
@ -139,6 +136,7 @@ namespace Server
public static void RemoveBuff(Mobile m, BuffInfo b)
{
b._timerToken.Cancel();
(m as PlayerMobile)?.RemoveBuff(b);
}

View file

@ -4589,13 +4589,11 @@ namespace Server.Mobiles
public void RemoveBuff(BuffIcon b)
{
if (m_BuffTable == null || !m_BuffTable.Remove(b, out var info))
if (m_BuffTable?.Remove(b) != true)
{
return;
}
info.TimerToken.Cancel();
if (NetState?.BuffIcon == true)
{
BuffInfo.SendRemoveBuffPacket(NetState, Serial, b);