1
0
Fork 0
mirror of https://codeberg.org/noisytoot/notnotdnethack.git synced 2024-09-19 14:05:02 +01:00
notnotdnethack/include/astar.h
ChrisANG 29d5cd521f Implement A* for scent vision
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.
2020-12-27 18:32:34 -05:00

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