Fixes bad expressions, bad bool checks in loops, a few null pointer exceptions, and optimizes constructors.

This commit is contained in:
Kamron Batman 2018-09-15 23:16:45 -07:00
parent 8da55d6043
commit f93c3b992e
62 changed files with 318 additions and 634 deletions

View file

@ -15,9 +15,7 @@ namespace Server.Targets
protected override void OnTarget(Mobile from, object o)
{
IPoint3D p = o as IPoint3D;
if (p != null)
if (o is IPoint3D p)
{
if (!BaseCommand.IsAccessible(from, m_Object))
{
@ -31,17 +29,13 @@ namespace Server.Targets
CommandLogging.WriteLine(from, "{0} {1} moving {2} to {3}", from.AccessLevel, CommandLogging.Format(from),
CommandLogging.Format(m_Object), new Point3D(p));
if (m_Object is Item)
if (m_Object is Item item)
{
Item item = (Item)m_Object;
if (!item.Deleted)
item.MoveToWorld(new Point3D(p), from.Map);
}
else if (m_Object is Mobile)
else if (m_Object is Mobile m)
{
Mobile m = (Mobile)m_Object;
if (!m.Deleted)
m.MoveToWorld(new Point3D(p), from.Map);
}