X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fserver%2Fmap.c;h=d98a61f28813730e33388fe48f42b7ec3ff7391b;hb=58486c337a7b1f04311801d902fed41ed3f67315;hp=7eececab5a74257d44b98ab3dad31351f3d3b85f;hpb=1cb57a35a3b3cc4ec8870531ca254a655c0bdda2;p=plomrogue diff --git a/src/server/map.c b/src/server/map.c index 7eececa..d98a61f 100644 --- a/src/server/map.c +++ b/src/server/map.c @@ -7,6 +7,7 @@ #include "../common/try_malloc.h" /* try_malloc() */ #include "../common/yx_uint8.h" /* struct yx_uint8 */ #include "rrand.h" /* rrand() */ +#include "yx_uint8.h" /* mv_yx_in_dir_wrap() */ #include "world.h" /* global world */ @@ -151,19 +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; -} - - - -extern uint16_t yx_to_map_pos(struct yx_uint8 * yx) -{ - return (yx->y * world.map.length) + yx->x; + return 0; }