home · contact · privacy
Wrapper script: Give server ten seconds to wind down properly.
[plomrogue] / libplomrogue.c
index d0b15a10bc5d260f4fcf1fc75af6551863e01157..c340e38502d66df9f1fe2d35c3e3bc7d3a9866f9 100644 (file)
@@ -600,7 +600,8 @@ extern void age_some_memdepthmap_on_nonfov_cells(char * memdepthmap,
     }
 }
 
-extern uint8_t set_cells_passable_on_memmap_to_65534_on_scoremap(char * mem_map)
+extern uint8_t set_cells_passable_on_memmap_to_65534_on_scoremap(char * mem_map,
+                                                  const char * symbols_passable)
 {
     if (!score_map)
     {
@@ -610,10 +611,46 @@ extern uint8_t set_cells_passable_on_memmap_to_65534_on_scoremap(char * mem_map)
     uint16_t pos;
     for (pos = 0; pos < map_size; pos++)
     {
-        if ('.' == mem_map[pos])
+        if (NULL != strchr(symbols_passable, mem_map[pos]))
         {
             score_map[pos] = 65534;
         }
     }
     return 0;
 }
+
+
+extern void update_mem_and_memdepthmap_via_fovmap(char * map, char * fovmap,
+                                                  char * memdepthmap,
+                                                  char * memmap)
+{
+    uint32_t map_size = maplength * maplength;
+    uint16_t pos;
+    for (pos = 0; pos < map_size; pos++)
+    {
+        if ('v' == fovmap[pos])
+        {
+            memdepthmap[pos] = '0';
+            memmap[pos] = map[pos];
+        }
+    }
+}
+
+/* USEFUL FOR DEBUGGING
+extern void write_score_map()
+{
+    FILE *f = fopen("score_map", "a");
+
+    fprintf(f, "\n---------------------------------------------------------\n");
+    uint32_t y, x;
+    for (y = 0; y < maplength; y++)
+    {
+        for (x = 0; x < maplength; x++)
+        {
+            fprintf(f, "%2X", score_map[y * maplength + x] % 256);
+        }
+        fprintf(f, "\n");
+    }
+    fclose(f);
+}
+*/