src/gen-util.c
void correct_dir(int *rdir, int *cdir, int y1, int x1, int y2, int x2)
{
    /* Extract vertical and horizontal directions */
    *rdir = CMP(y2, y1);
    *cdir = CMP(x2, x1);

    /* If we only have one direction to go, then we're done */
    if (!*rdir || !*cdir) return;

    /* If we need to go diagonally, then choose a random direction */
    if (randint0(100) < 50)
		*rdir = 0;
    else
		*cdir = 0;
}
/**
 * Given two points, pick a valid cardinal direction from one to the other.
 * \param rdir found row change (up or down)
 * \param cdir found column change (left or right)
 * \param y1
 * \param x1 starting co-ordinates
 * \param y2
 * \param x2 target co-ordinates
 */
Given two points, pick a valid cardinal direction from one to the other.
Given two points pick a valid cardinal direction from one to the other .
void correct_dir(int *rdir, int *cdir, int y1, int x1, int y2, int x2)
{
    *rdir = CMP(y2, y1);
    *cdir = CMP(x2, x1);
    if (!*rdir || !*cdir) return;
    if (randint0(100) < 50)
		*rdir = 0;
    else
		*cdir = 0;
}
void correct_dir ( int * rdir , int * cdir , int y1 , int x1 , int y2 , int x2 ) { * rdir = CMP ( y2 , y1 ) ; * cdir = CMP ( x2 , x1 ) ; if ( ! * rdir || ! * cdir ) return ; if ( randint0 ( 100 ) < 50 ) * rdir = 0 ; else * cdir = 0 ; }
Given two points, pick a valid cardinal direction from one to the other.
Given two points pick a valid cardinal direction from one to the other .
/* Extract vertical and horizontal directions */ /* If we only have one direction to go, then we're done */ /* If we need to go diagonally, then choose a random direction */