HPASharp.ConcreteMap.CanJump C# (CSharp) Method

CanJump() public method

Tells whether we can move from p1 to p2 in line. Bear in mind this function does not consider intermediate points (it is assumed you can jump between intermediate points)
public CanJump ( Position p1, Position p2 ) : bool
p1 Position
p2 Position
return bool
        public bool CanJump(Position p1, Position p2)
        {
            if (TileType != TileType.OCTILE && this.TileType != TileType.OCTILE_UNICOST)
                return true;
            if (Helpers.AreAligned(p1, p2))
                return true;

			// The following piece of code existed in the original implementation.
			// It basically checks that you do not forcefully cross a blocked diagonal.
			// Honestly, this is weird, bad designed and supposes that each position is adjacent to each other.
            var nodeInfo12 = Graph.GetNode(GetNodeIdFromPos(p2.X, p1.Y)).Info;
            var nodeInfo21 = Graph.GetNode(GetNodeIdFromPos(p1.X, p2.Y)).Info;
            return !(nodeInfo12.IsObstacle && nodeInfo21.IsObstacle);
        }