Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -80,15 +80,7 @@ namespace Server
|
|||
BodyID = bodyID;
|
||||
}
|
||||
|
||||
public BodyType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
if (BodyID >= 0 && BodyID < m_Types.Length)
|
||||
return m_Types[BodyID];
|
||||
return BodyType.Empty;
|
||||
}
|
||||
}
|
||||
public BodyType Type => BodyID >= 0 && BodyID < m_Types.Length ? m_Types[BodyID] : BodyType.Empty;
|
||||
|
||||
public bool IsHuman => BodyID >= 0
|
||||
&& BodyID < m_Types.Length
|
||||
|
|
@ -173,14 +165,12 @@ namespace Server
|
|||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return BodyID;
|
||||
return BodyID.GetHashCode();
|
||||
}
|
||||
|
||||
public override bool Equals(object o)
|
||||
{
|
||||
if (!(o is Body)) return false;
|
||||
|
||||
return ((Body)o).BodyID == BodyID;
|
||||
return o is Body b && b.BodyID == BodyID;
|
||||
}
|
||||
|
||||
public static bool operator ==(Body l, Body r)
|
||||
|
|
@ -213,4 +203,4 @@ namespace Server
|
|||
return l.BodyID <= r.BodyID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue