home · contact · privacy
Minor code-stylistic adjustment.
[plomrogue] / src / misc.c
index 8d38d59c383297ef3be00af1f3f67ce562d5e01c..cb650a0436b648cfd61c6f3bcb810bcd4a6044e8 100644 (file)
 #include "main.h"
 #include "yx_uint16.h"
 
+extern void exit_game(struct World * world, struct Map * map) {
+// Clean up and exit.
+  endwin();
+  free(map->cells);
+  uint16_t key;
+  for (key = 0; key <= world->keyswindata->max; key++)
+    free(world->keybindings[key].name);
+  free(world->keybindings);
+  free(world->keyswindata);
+  free(world->log);
+  exit (EXIT_SUCCESS); }
+
 extern void textfile_sizes (FILE * file, uint16_t * linemax_p, uint16_t * n_lines_p) {
 // Learn largest line length (linemax_p) and (n_lines_p if not set to NULL) number of lines.
   uint16_t n_lines = 0;
@@ -93,7 +105,7 @@ extern void save_game(struct World * world) {
   write_uint16_bigendian(world->player->pos.x + 1, file);
   fputc(world->player->hitpoints, file);
   write_map_objects (world->monster, file, write_map_objects_monsterdata);
-  write_map_objects (world->item, file, readwrite_map_objects_dummy);
+  write_map_objects (world->item, file, NULL);
   fclose(file); }
 
 extern void toggle_window (struct WinMeta * win_meta, struct Win * win) {