Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -62,11 +62,7 @@ namespace Server
{
}
public Timer(TimeSpan delay, TimeSpan interval) : this(delay, interval, 0)
{
}
public Timer(TimeSpan delay, TimeSpan interval, int count)
public Timer(TimeSpan delay, TimeSpan interval, int count = 0)
{
m_Delay = (long)delay.TotalMilliseconds;
m_Interval = (long)interval.TotalMilliseconds;
@ -378,10 +374,6 @@ namespace Server
public void TimerMain()
{
long now;
int i, j;
bool loaded;
while (!Core.Closing)
{
if (World.Loading || World.Saving)
@ -392,17 +384,17 @@ namespace Server
ProcessChanged();
loaded = false;
bool loaded = false;
for (i = 0; i < m_Timers.Length; i++)
for (int i = 0; i < m_Timers.Length; i++)
{
now = Core.TickCount;
long now = Core.TickCount;
if (now < m_NextPriorities[i])
break;
m_NextPriorities[i] = now + m_PriorityDelays[i];
for (j = 0; j < m_Timers[i].Count; j++)
for (int j = 0; j < m_Timers[i].Count; j++)
{
Timer t = m_Timers[i][j];
@ -501,11 +493,7 @@ namespace Server
{
Timer t = new DelayCallTimer(delay, interval, count, callback);
if (count == 1)
t.Priority = ComputePriority(delay);
else
t.Priority = ComputePriority(interval);
t.Priority = ComputePriority(count == 1 ? delay : interval);
t.Start();
return t;