X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fserver%2Fmap.c;h=ae907d2327363fef50919575440a27a6a094a702;hb=f6615d3be438bbca4997c38c546c0d8724da80d4;hp=8ed37d9b50cbd017baf0cb2c0464e5e547aebeab;hpb=61d2bf27904c05c2bb6dd68bd83cab9bba9c9385;p=plomrogue diff --git a/src/server/map.c b/src/server/map.c index 8ed37d9..ae907d2 100644 --- a/src/server/map.c +++ b/src/server/map.c @@ -5,8 +5,9 @@ #include /* free() */ #include "../common/rexit.h" /* exit_err() */ #include "../common/try_malloc.h" /* try_malloc() */ -#include "../common/yx_uint8.h" /* struct yx_uint8 */ +#include "../common/yx_uint8.h" /* yx_uint8 */ #include "rrand.h" /* rrand() */ +#include "yx_uint8.h" /* mv_yx_in_dir_wrap() */ #include "world.h" /* global world */ @@ -151,12 +152,12 @@ extern void remake_map() -extern uint8_t is_passable(struct yx_uint8 pos) +extern uint8_t mv_yx_in_dir_legal(char dir, struct yx_uint8 * yx) { - uint8_t passable = 0; - if (pos.x < world.map.length && pos.y < world.map.length) + uint8_t wraptest = mv_yx_in_dir_wrap(dir, yx, 0); + if (!wraptest && yx->x < world.map.length && yx->y < world.map.length) { - passable = ('.' == world.map.cells[(pos.y * world.map.length) + pos.x]); + return 1; } - return passable; + return 0; }