home · contact · privacy
Fixed bug that led to endless loop in nearest_enemy_dir().
[plomrogue] / src / yx_uint16.h
1 /* yx_uint16.h
2  *
3  * Structs and routines for coordinates and movement in 2-dimensional space
4  * (such as the ncurses screen and game maps).
5  */
6
7 #ifndef YX_UINT16_H
8 #define YX_UINT16_H
9
10 #include <stdint.h> /* for uint8_t, uint16_t */
11
12
13
14 /* Coordinates for maps of max. 65536x65536 cells. */
15 struct yx_uint16
16 {
17     uint16_t y;
18     uint16_t x;
19 };
20
21
22
23 /* Return 1 if two yx_uint16 coordinates at "a" and "b" are equal, else 0. */
24 extern uint8_t yx_uint16_cmp(struct yx_uint16 * a, struct yx_uint16 * b);
25
26 /* Return yx_uint16 coordinate one step from "yx" in direction "dir" (east: 'E',
27  * west: 'W', north: 'N', south: 'S'). If "dir" is invalid or would wrap the
28  * move around the edge of a 2^16x2^16 cells field, "yx" remains unchanged.
29  */
30 extern struct yx_uint16 mv_yx_in_dir(char dir, struct yx_uint16 yx);
31
32
33
34 #endif