home · contact · privacy
Simplified textfile_sizes() and replaced all get_linemax() calls with it.
[plomrogue] / src / map.c
index 45cd2e15ceadeb3fc0f3e9c27ceeea5ec5ade9ae..b8c8733a2aba0e79a0c0462bfc59125892de556a 100644 (file)
--- a/src/map.c
+++ b/src/map.c
@@ -1,9 +1,8 @@
 #include "map.h"
 #include <stdint.h>      /* for uint16_t, uint32_t */
-#include "misc.h"        /* for try_malloc(), center_offset() */
+#include "misc.h"        /* for try_malloc(), center_offset(), rrand() */
 #include "map_objects.h" /* for get_player() */
 #include "yx_uint16.h"   /* for yx_uint16 and dir enums */
-#include "rrand.h"       /* for rrand() */
 #include "windows.h"     /* for struct Win */
 #include "main.h"        /* for world global */
 #include "wincontrol.h"  /* for get_win_by_id() */
@@ -97,3 +96,15 @@ extern void map_center()
     struct Win * win_map   = get_win_by_id('m');
     win_map->center = player->pos;
 }
+
+
+
+extern uint8_t is_passable(struct Map * map, struct yx_uint16 pos)
+{
+    uint8_t passable = 0;
+    if (0 <= pos.x && pos.x < map->size.x && 0 <= pos.y && pos.y < map->size.y)
+    {
+        passable = (('.' == map->cells[pos.y * map->size.x + pos.x]));
+    }
+    return passable;
+}