/* how far is it on the hex grid */
int HL_distance(int from_cantor, int to_cantor);
+/* returns 0 for <0 or >5 */
+int HL_adjacent_hex(int start, int dir);
+
+/* module direction */
int HL_adjhex(int start, int dir);
int HL_hexes_at_range(int hex, int range, int *list, int size);
int HL_hexes_within_range(int hex, int range, int *list, int size);
int x,y; /* hmm. would be nice to be able to just point to a generic */
};
+/*
+ * Pathfinding
+ */
+
+struct HL_astar_hex {
+ int hex;
+ double f, g, h;
+ struct HL_astar_hex *parent;
+ int open;
+ struct HL_astar_hex *next;
+ struct HL_astar_hex *prev;
+};
+
+struct HL_astar {
+ int start, goal;
+ int pathlen;
+ double (*metric)(int,int);
+ double (*heuristic)(int,int);
+ int (*neighbor)(int,int);
+ int nodes, allocated;
+ struct HL_astar_hex *sets;
+ struct HL_astar_hex *open;
+ struct HL_astar_hex *closed;
+ struct HL_astar_hex *from, *to;
+ int known, index;
+ int error, malloced;
+};
+
+int HL_findpath(struct HL_astar *s, int loops);
+void HL_astar_free(struct HL_astar *s);
+struct HL_astar *HL_astar_clear(struct HL_astar *s);
+struct HL_astar *HL_astar_init(struct HL_astar *s);
+
#endif