X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fserver%2Fio.c;h=a516d81b018b121a90c3fb614415b029634c81d1;hb=f9c94db47aa883149aa762fa128ac1ff1b3f92e1;hp=800f539aea747e53413f13d09fdc1cee7c823015;hpb=65efdbea2c5978de283aab627ca62f5a2c983353;p=plomrogue diff --git a/src/server/io.c b/src/server/io.c index 800f539..a516d81 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -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++)