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

@ -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;
}
}
}
}