X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fmisc.c;h=cb650a0436b648cfd61c6f3bcb810bcd4a6044e8;hb=d010d4918c501e2684e769b0dbb0cf1fa62845a1;hp=8d38d59c383297ef3be00af1f3f67ce562d5e01c;hpb=0f12557b88c73f8629ffafc38dc59ab5bd15e687;p=plomrogue diff --git a/src/misc.c b/src/misc.c index 8d38d59..cb650a0 100644 --- a/src/misc.c +++ b/src/misc.c @@ -10,6 +10,18 @@ #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) {