home · contact · privacy
Some code-internal restructuring following the assumption that game map height /
[plomrogue] / src / server / io.c
index 800f539aea747e53413f13d09fdc1cee7c823015..a516d81b018b121a90c3fb614415b029634c81d1 100644 (file)
@@ -66,8 +66,8 @@ static char * get_message_from_queue()
     world.queue_size = world.queue_size - cutout_len;
     if (0 == world.queue_size)
     {
-        free(world.queue);
-        world.queue = NULL;
+        free(world.queue);  /* NULL so read_fifo_into_queue() may free() this */
+        world.queue = NULL; /* every time, even when it's un-allocated first. */
     }
     else
     {
@@ -183,7 +183,7 @@ static void write_inventory(struct MapObj * player, FILE * file)
 static void write_map(FILE * file)
 {
     char * f_name = "write_map()";
-    uint32_t map_size = world.map.size.y * world.map.size.x;
+    uint16_t map_size = world.map.size.y * world.map.size.x;
     char visible_map[map_size];
     memcpy(visible_map, world.map.cells, map_size);
     struct MapObj * o;
@@ -203,7 +203,7 @@ static void write_map(FILE * file)
             }
         }
     }
-    uint16_t x, y;
+    uint8_t x, y;
     for (y = 0; y < world.map.size.y; y++)
     {
         for (x = 0; x < world.map.size.x; x++)