Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -20,47 +20,67 @@
namespace Server.Movement
{
public static class Movement
{
public static IMovementImpl Impl { get; set; }
public static class Movement
{
public static IMovementImpl Impl{ get; set; }
public static bool CheckMovement( Mobile m, Direction d, out int newZ )
{
if ( Impl != null )
return Impl.CheckMovement( m, d, out newZ );
public static bool CheckMovement(Mobile m, Direction d, out int newZ)
{
if (Impl != null)
return Impl.CheckMovement(m, d, out newZ);
newZ = m.Z;
return false;
}
newZ = m.Z;
return false;
}
public static bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ )
{
if ( Impl != null )
return Impl.CheckMovement( m, map, loc, d, out newZ );
public static bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ)
{
if (Impl != null)
return Impl.CheckMovement(m, map, loc, d, out newZ);
newZ = m.Z;
return false;
}
newZ = m.Z;
return false;
}
public static void Offset( Direction d, ref int x, ref int y )
{
switch ( d & Direction.Mask )
{
case Direction.North: --y; break;
case Direction.South: ++y; break;
case Direction.West: --x; break;
case Direction.East: ++x; break;
case Direction.Right: ++x; --y; break;
case Direction.Left: --x; ++y; break;
case Direction.Down: ++x; ++y; break;
case Direction.Up: --x; --y; break;
}
}
}
public static void Offset(Direction d, ref int x, ref int y)
{
switch (d & Direction.Mask)
{
case Direction.North:
--y;
break;
case Direction.South:
++y;
break;
case Direction.West:
--x;
break;
case Direction.East:
++x;
break;
case Direction.Right:
++x;
--y;
break;
case Direction.Left:
--x;
++y;
break;
case Direction.Down:
++x;
++y;
break;
case Direction.Up:
--x;
--y;
break;
}
}
}
public interface IMovementImpl
{
bool CheckMovement( Mobile m, Direction d, out int newZ );
bool CheckMovement( Mobile m, Map map, Point3D loc, Direction d, out int newZ );
}
public interface IMovementImpl
{
bool CheckMovement(Mobile m, Direction d, out int newZ);
bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ);
}
}