Some cleanup of contains keys and try get values (#246)
This commit is contained in:
parent
9cbb0cfd23
commit
a236617ad9
69 changed files with 3508 additions and 350 deletions
|
|
@ -107,10 +107,9 @@ namespace Server.Items
|
|||
|
||||
public static void EndDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay.TryGetValue(m, out var timer))
|
||||
if (m_Delay.Remove(m, out var timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,10 +123,9 @@ namespace Server.Items
|
|||
|
||||
public static void EndDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay.TryGetValue(m, out var timer))
|
||||
if (m_Delay.Remove(m, out var timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,12 +66,14 @@ namespace Server.Items
|
|||
|
||||
public static void RemoveTimer(Mobile m, bool interrupted = false)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out var timer))
|
||||
if (m_Table.Remove(m, out var timer))
|
||||
{
|
||||
if (interrupted)
|
||||
{
|
||||
m.SendLocalizedMessage(1073187); // The invisibility effect is interrupted.
|
||||
}
|
||||
|
||||
timer.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -283,10 +283,9 @@ namespace Server.Items
|
|||
|
||||
public static void RemoveTimer(Mobile m)
|
||||
{
|
||||
if (Timers.TryGetValue(m, out var t))
|
||||
if (Timers.Remove(m, out var t))
|
||||
{
|
||||
t.Stop();
|
||||
Timers.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue