From: Christian Heller Date: Sun, 23 Jun 2013 22:37:15 +0000 (+0200) Subject: Moved basic yx_uint16 handling into its own library. X-Git-Tag: tce~1203 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=64e1bc2a874308530b7b45c33ed5d37f34f5f8be;p=plomrogue Moved basic yx_uint16 handling into its own library. --- diff --git a/src/roguelike.c b/src/roguelike.c index c8fbf5a..058ed07 100644 --- a/src/roguelike.c +++ b/src/roguelike.c @@ -80,11 +80,6 @@ struct yx_uint16 mv_yx_in_dir (char d, struct yx_uint16 yx) { else if (d == WEST) yx.x--; return yx; } -char yx_uint16_cmp (struct yx_uint16 a, struct yx_uint16 b) { -// Compare two coordinates of type yx_uint16. - if (a.y == b.y && a.x == b.x) return 1; - else return 0; } - void next_turn (struct World * world) { // Increment turn and move enemy. world->turn++; diff --git a/src/roguelike.h b/src/roguelike.h index bb6088c..a6c154a 100644 --- a/src/roguelike.h +++ b/src/roguelike.h @@ -29,7 +29,6 @@ struct Map init_map (); void save_game(struct World *); void record_action (char); struct yx_uint16 mv_yx_in_dir (char, struct yx_uint16); -char yx_uint16_cmp (struct yx_uint16, struct yx_uint16); void next_turn (struct World *); void update_log (struct World *, char *); void move_player (struct World *, char); diff --git a/src/windows.h b/src/windows.h index c194907..a597ebb 100644 --- a/src/windows.h +++ b/src/windows.h @@ -1,6 +1,4 @@ -struct yx_uint16 { - uint16_t y; - uint16_t x; }; +#include "yx_uint16.h" struct Frame { WINDOW * curses_win; diff --git a/src/yx_uint16.c b/src/yx_uint16.c new file mode 100644 index 0000000..afcab4d --- /dev/null +++ b/src/yx_uint16.c @@ -0,0 +1,8 @@ +#include "stdint.h" +#include "yx_uint16.h" + +extern char yx_uint16_cmp (struct yx_uint16 a, struct yx_uint16 b) { +// Compare two coordinates of type yx_uint16. + if (a.y == b.y && a.x == b.x) return 1; + else return 0; } + diff --git a/src/yx_uint16.h b/src/yx_uint16.h new file mode 100644 index 0000000..c1479c0 --- /dev/null +++ b/src/yx_uint16.h @@ -0,0 +1,6 @@ +struct yx_uint16 { + uint16_t y; + uint16_t x; }; + +extern char yx_uint16_cmp (struct yx_uint16, struct yx_uint16); +