home · contact · privacy
e14d16de8b51fd5d57c8cfe1ec52a4f72f7bf173
[plomrogue] / src / yx_uint16.c
1 /* yx_uint16.c */
2
3 #include "yx_uint16.h"
4 #include <stdint.h> /* for uint8_t, uint16_t */
5
6
7
8 extern uint8_t yx_uint16_cmp(struct yx_uint16 * a, struct yx_uint16 * b)
9 {
10     if (a->y == b->y && a->x == b->x)
11     {
12         return 1;
13     }
14     return 0;
15 }
16
17
18
19 extern struct yx_uint16 mv_yx_in_dir(char d, struct yx_uint16 yx)
20 {
21     if      (d == 'N')
22     {
23         yx.y--;
24     }
25     else if (d == 'E')
26     {
27         yx.x++;
28     }
29     else if (d == 'S')
30     {
31         yx.y++;
32     }
33     else if (d == 'W')
34     {
35         yx.x--;
36     }
37     return yx;
38 }