home · contact · privacy
Pass pointers to yx_uint16 structs to yx_uint16_cmp() instead of structs themselves.
[plomrogue] / src / yx_uint16.c
1 /* yx_uint16.c */
2
3
4
5 #include "yx_uint16.h" /* for uint8_t, uint16_t */
6
7
8
9 extern uint8_t yx_uint16_cmp(struct yx_uint16 * a, struct yx_uint16 * b)
10 {
11     if (a->y == b->y && a->x == b->x)
12     {
13         return 1;
14     }
15     else
16     {
17         return 0;
18     }
19 }
20
21
22
23 extern struct yx_uint16 mv_yx_in_dir(enum dir d, struct yx_uint16 yx)
24 {
25     if      (d == NORTH)
26     {
27         yx.y--;
28     }
29     else if (d == EAST)
30     {
31         yx.x++;
32     }
33     else if (d == SOUTH)
34     {
35         yx.y++;
36     }
37     else if (d == WEST)
38     {
39         yx.x--;
40     }
41     return yx;
42 }