Angband
Functions
player-path.h File Reference

Pathfinding and running code. More...

#include "z-type.h"

Go to the source code of this file.

Functions

int pathfind_direction_to (struct loc from, struct loc to)
 Compute the direction (in the angband 123456789 sense) from a point to a point. More...
 
bool findpath (int y, int x)
 
void run_step (int dir)
 Take one step along the current "run" path. More...
 

Detailed Description

Pathfinding and running code.

Copyright (c) 1988 Christopher J Stuart (running code) Copyright (c) 2004-2007 Christophe Cavalaria, Leon Marrick (pathfinding)

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

bool findpath ( int  y,
int  x 
)
int pathfind_direction_to ( struct loc  from,
struct loc  to 
)

Compute the direction (in the angband 123456789 sense) from a point to a point.

We decide to use diagonals if dx and dy are within a factor of two of each other; otherwise we choose a cardinal direction.

References ABS, DIR_E, DIR_N, DIR_NE, DIR_NONE, DIR_NW, DIR_S, DIR_SE, DIR_SW, DIR_UNKNOWN, DIR_W, loc::x, and loc::y.

Referenced by test_dir_to(), and textui_get_rep_dir().

void run_step ( int  dir)