Code cleanup (#195)

This commit is contained in:
Kamron Batman 2020-08-16 21:46:54 -07:00 • committed by GitHub
parent b476bcfd24
commit 0926b5abaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
86 changed files with 740 additions and 1635 deletions

View file

@ -204,7 +204,7 @@ namespace Server.Gumps
private class TypeNameComparer : IComparer<Type>
{
public int Compare(Type x, Type y) => x.Name.CompareTo(y.Name);
public int Compare(Type x, Type y) => x?.Name.CompareTo(y?.Name) ?? 1;
}
public class InternalTarget : Target
@ -227,10 +227,12 @@ namespace Server.Gumps
{
if (o is IPoint3D p)
{
if (p is Item item)
p = item.GetWorldTop();
else if (p is Mobile m)
p = m.Location;
p = p switch
{
Item item => item.GetWorldTop(),
Mobile m => m.Location,
_ => p
};
Commands.Add.Invoke(from, new Point3D(p), new Point3D(p), new[] { m_Type.Name });