Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -24,13 +24,9 @@ namespace Server
|
|||
{
|
||||
public struct Serial : IComparable, IComparable<Serial>
|
||||
{
|
||||
private int m_Serial;
|
||||
public static Serial LastMobile { get; private set; } = Zero;
|
||||
|
||||
private static Serial m_LastMobile = Zero;
|
||||
private static Serial m_LastItem = 0x40000000;
|
||||
|
||||
public static Serial LastMobile => m_LastMobile;
|
||||
public static Serial LastItem => m_LastItem;
|
||||
public static Serial LastItem { get; private set; } = 0x40000000;
|
||||
|
||||
public static readonly Serial MinusOne = new Serial( -1 );
|
||||
public static readonly Serial Zero = new Serial( 0 );
|
||||
|
|
@ -39,9 +35,9 @@ namespace Server
|
|||
{
|
||||
get
|
||||
{
|
||||
while ( World.FindMobile( m_LastMobile = (m_LastMobile + 1) ) != null );
|
||||
while ( World.FindMobile( LastMobile = (LastMobile + 1) ) != null );
|
||||
|
||||
return m_LastMobile;
|
||||
return LastMobile;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,33 +45,33 @@ namespace Server
|
|||
{
|
||||
get
|
||||
{
|
||||
while ( World.FindItem( m_LastItem = (m_LastItem + 1) ) != null );
|
||||
while ( World.FindItem( LastItem = (LastItem + 1) ) != null );
|
||||
|
||||
return m_LastItem;
|
||||
return LastItem;
|
||||
}
|
||||
}
|
||||
|
||||
private Serial( int serial )
|
||||
{
|
||||
m_Serial = serial;
|
||||
Value = serial;
|
||||
}
|
||||
|
||||
public int Value => m_Serial;
|
||||
public int Value { get; }
|
||||
|
||||
public bool IsMobile => ( m_Serial > 0 && m_Serial < 0x40000000 );
|
||||
public bool IsMobile => ( Value > 0 && Value < 0x40000000 );
|
||||
|
||||
public bool IsItem => ( m_Serial >= 0x40000000 && m_Serial <= 0x7FFFFFFF );
|
||||
public bool IsItem => ( Value >= 0x40000000 && Value <= 0x7FFFFFFF );
|
||||
|
||||
public bool IsValid => ( m_Serial > 0 );
|
||||
public bool IsValid => ( Value > 0 );
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return m_Serial;
|
||||
return Value;
|
||||
}
|
||||
|
||||
public int CompareTo( Serial other )
|
||||
{
|
||||
return m_Serial.CompareTo( other.m_Serial );
|
||||
return Value.CompareTo( other.Value );
|
||||
}
|
||||
|
||||
public int CompareTo( object other )
|
||||
|
|
@ -94,37 +90,37 @@ namespace Server
|
|||
if ( !(o is Serial serial) )
|
||||
return false;
|
||||
|
||||
return serial.m_Serial == m_Serial;
|
||||
return serial.Value == Value;
|
||||
}
|
||||
|
||||
public static bool operator == ( Serial l, Serial r )
|
||||
{
|
||||
return l.m_Serial == r.m_Serial;
|
||||
return l.Value == r.Value;
|
||||
}
|
||||
|
||||
public static bool operator != ( Serial l, Serial r )
|
||||
{
|
||||
return l.m_Serial != r.m_Serial;
|
||||
return l.Value != r.Value;
|
||||
}
|
||||
|
||||
public static bool operator > ( Serial l, Serial r )
|
||||
{
|
||||
return l.m_Serial > r.m_Serial;
|
||||
return l.Value > r.Value;
|
||||
}
|
||||
|
||||
public static bool operator < ( Serial l, Serial r )
|
||||
{
|
||||
return l.m_Serial < r.m_Serial;
|
||||
return l.Value < r.Value;
|
||||
}
|
||||
|
||||
public static bool operator >= ( Serial l, Serial r )
|
||||
{
|
||||
return l.m_Serial >= r.m_Serial;
|
||||
return l.Value >= r.Value;
|
||||
}
|
||||
|
||||
public static bool operator <= ( Serial l, Serial r )
|
||||
{
|
||||
return l.m_Serial <= r.m_Serial;
|
||||
return l.Value <= r.Value;
|
||||
}
|
||||
|
||||
/*public static Serial operator ++ ( Serial l )
|
||||
|
|
@ -134,12 +130,12 @@ namespace Server
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"0x{m_Serial:X8}";
|
||||
return $"0x{Value:X8}";
|
||||
}
|
||||
|
||||
public static implicit operator int( Serial a )
|
||||
{
|
||||
return a.m_Serial;
|
||||
return a.Value;
|
||||
}
|
||||
|
||||
public static implicit operator Serial( int a )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue