fix(core): Adds Hashed & Hierarchical Timer Wheel (#655)

- Removes TimerPriority
- Removes TimerThread
- Adds a [Hashed & Hierarchical Timer Wheel](http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf)
This commit is contained in:
Kamron Batman 2021-07-11 22:42:06 -07:00 • committed by GitHub
parent b99d520019
commit fb915992dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
138 changed files with 468 additions and 802 deletions

View file

@ -1157,16 +1157,6 @@ namespace Server
{
m_Player = value;
InvalidateProperties();
if (!m_Player && m_Dex <= 100 && m_CombatTimer != null)
{
m_CombatTimer.Priority = TimerPriority.FiftyMS;
}
else if (m_CombatTimer != null)
{
m_CombatTimer.Priority = TimerPriority.EveryTick;
}
CheckStatTimers();
}
}
@ -6546,15 +6536,6 @@ namespace Server
CheckStatTimers();
}
if (!m_Player && m_Dex <= 100 && m_CombatTimer != null)
{
m_CombatTimer.Priority = TimerPriority.FiftyMS;
}
else if (m_CombatTimer != null)
{
m_CombatTimer.Priority = TimerPriority.EveryTick;
}
UpdateRegion();
UpdateResistances();
@ -9375,7 +9356,6 @@ namespace Server
public ManaTimer(Mobile m)
: base(GetManaRegenRate(m), GetManaRegenRate(m))
{
Priority = TimerPriority.FiftyMS;
m_Owner = m;
}
@ -9397,7 +9377,6 @@ namespace Server
public HitsTimer(Mobile m)
: base(GetHitsRegenRate(m), GetHitsRegenRate(m))
{
Priority = TimerPriority.FiftyMS;
m_Owner = m;
}
@ -9419,7 +9398,6 @@ namespace Server
public StamTimer(Mobile m)
: base(GetStamRegenRate(m), GetStamRegenRate(m))
{
Priority = TimerPriority.FiftyMS;
m_Owner = m;
}
@ -9451,16 +9429,9 @@ namespace Server
{
private readonly Mobile m_Mobile;
public CombatTimer(Mobile m) : base(TimeSpan.FromSeconds(0.0), TimeSpan.FromSeconds(0.01))
{
public CombatTimer(Mobile m) : base(TimeSpan.FromSeconds(0.0), TimeSpan.FromSeconds(0.01)) =>
m_Mobile = m;
if (!m_Mobile.m_Player && m_Mobile.m_Dex <= 100)
{
Priority = TimerPriority.FiftyMS;
}
}
protected override void OnTick()
{
if (Core.TickCount - m_Mobile.NextCombatTime < 0)