home · contact · privacy
Add "look" mode to query things on any cell via new THINGS_HERE command.
[plomrogue] / src / client / cleanup.c
index 7df98e7c4bd716ccc441ff2d263f317bf4df4a39..4db02a2654a7c3adfdd2640328e023d81dcb045d 100644 (file)
@@ -1,11 +1,17 @@
-/* src/client/cleanup.c */
+/* src/client/cleanup.c
+ *
+ * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
+ * or any later version. For details on its copyright, license, and warranties,
+ * see the file NOTICE in the root directory of the PlomRogue source package.
+ */
 
 #include "cleanup.h"
+#include <ncurses.h> /* for endwin() */
 #include <stdint.h> /* uint32_t */
 #include <stdlib.h> /* free() */
+#include "../common/readwrite.h" /* try_fclose() */
 #include "command_db.h" /* free_command_db() */
-#include "misc.h" /* unload_interface_conf() */
-#include "windows.h" /* free_winmeta_and_endwin() */
+#include "interface_conf.h" /* unload_interface_conf() */
 #include "world.h" /* world global */
 
 
@@ -18,20 +24,31 @@ static uint32_t cleanup_flags = 0x0000;
 extern void cleanup()
 {
     free(world.map.cells);
+    free(world.mem_map);
     free(world.log);
+    free(world.things_here);
+    free(world.queue);
     free(world.player_inventory);
-    if (cleanup_flags & CLEANUP_INTERFACE)/* Must come pre ncurses cleanup,   */
-    {                                     /* for by closing all windows it    */
-        unload_interface_conf();          /* relies on world.wmeta data freed */
-    }                                     /* by free_winmeta_and_endwin().    */
+    if (cleanup_flags & CLEANUP_INTERFACE)
+    {
+        unload_interface_conf();
+    }
     if (cleanup_flags & CLEANUP_NCURSES)
     {
-        free_winmeta_and_endwin();
+        endwin();
     }
     if (cleanup_flags & CLEANUP_COMMANDS)
     {
         free_command_db();
     }
+    if (cleanup_flags & CLEANUP_SERVER_IN)
+    {
+        try_fclose(world.file_server_in, __func__);
+    }
+    if (cleanup_flags & CLEANUP_SERVER_OUT)
+    {
+        try_fclose(world.file_server_out, __func__);
+    }
 }