BatchFlow.AsciiArt.ExtractConnectionEndFor C# (CSharp) Method

ExtractConnectionEndFor() private static method

private static ExtractConnectionEndFor ( Position pos, char artChars, Position dir, char pointerSymbol, List pointers ) : void
pos Position
artChars char
dir Position
pointerSymbol char
pointers List
return void
        private static void ExtractConnectionEndFor(Position pos, char[,] artChars, Position.Direction dir, char pointerSymbol, List<PositionedConnection> pointers)
        {
            int difX = (dir == Position.Direction.East ? 1 : (dir == Position.Direction.West ? -1 : 0));
            int difY = (dir == Position.Direction.South ? 1 : (dir == Position.Direction.North ? -1 : 0));
            pos.x += difX; pos.y += difY;
            if (pos.x < 0 || pos.y < 0 || pos.x >= artChars.GetLength(0) || pos.y >= artChars.GetLength(1))
            {
                return;
            }
            if (artChars[pos.x, pos.y] == pointerSymbol)
            {
                PositionedConnection newConn = new PositionedConnection() { tailDirection = dir };
                newConn.track.Add(pos);
                pointers.Add(newConn);
            }
        }