if (is_passable(world->map, t))
monster->map_obj.pos = t; }
-extern void move_player (struct World * world, char d) {
+extern void move_player (struct World * world, enum dir d) {
// Move player in direction d, update log and turn over to the enemy.
struct yx_uint16 t = mv_yx_in_dir (d, world->player->pos);
struct Monster * monster;
extern char is_passable (struct Map *, struct yx_uint16);
extern void move_monster (struct World *, struct Monster *);
-extern void move_player (struct World *, char);
+extern void move_player (struct World *, enum dir);
extern void player_wait(struct World *);
#endif
if (a.y == b.y && a.x == b.x) return 1;
else return 0; }
-extern struct yx_uint16 mv_yx_in_dir (char d, struct yx_uint16 yx) {
+extern struct yx_uint16 mv_yx_in_dir (enum dir d, struct yx_uint16 yx) {
// Return yx coordinates one step to the direction d of yx.
if (d == NORTH) yx.y--;
else if (d == EAST) yx.x++;
#include <stdint.h>
-#define NORTH 1
-#define EAST 2
-#define SOUTH 3
-#define WEST 4
+enum dir {
+ NORTH = 1,
+ EAST = 2,
+ SOUTH = 3,
+ WEST = 4 };
struct yx_uint16 {
uint16_t y;
uint16_t x; };
extern char yx_uint16_cmp (struct yx_uint16, struct yx_uint16);
-extern struct yx_uint16 mv_yx_in_dir (char, struct yx_uint16);
+extern struct yx_uint16 mv_yx_in_dir (enum dir, struct yx_uint16);
#endif