mirror of
https://codeberg.org/noisytoot/notnotdnethack.git
synced 2025-04-28 11:25:11 +01:00

Players and monsters both use the same function, now. Still has some TODOs: 1) Generalize to work with MM_ flags instead of ZAP_POS() 2) Allow the caller to ask for the path, so that it can be used as a real pathfinding algorithm. Could also use some cleanup, and probably some additional macros to reudce near-identical code.
39 lines
No EOL
573 B
C
39 lines
No EOL
573 B
C
/* astar.h */
|
|
/* NetHack Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
|
/* NetHack may be freely redistributed. See license for details. */
|
|
|
|
#ifndef ASTAR_H
|
|
#define ASTAR_H
|
|
|
|
struct mapNode {
|
|
int from_x;
|
|
int from_y;
|
|
int g;
|
|
};
|
|
|
|
struct frontNode {
|
|
int x;
|
|
int y;
|
|
int from_x;
|
|
int from_y;
|
|
boolean propagate;
|
|
int g;
|
|
int f;
|
|
struct frontNode *next;
|
|
};
|
|
|
|
struct pathNode {
|
|
int x;
|
|
int y;
|
|
int to_x;
|
|
int to_y;
|
|
struct frontNode *next;
|
|
};
|
|
|
|
//Don't do a function call for the heuristic
|
|
#define h(x, gl_x) ((x > gl_x) ? (x - gl_x) : (gl_x - x))
|
|
|
|
|
|
|
|
|
|
#endif |