home · contact · privacy
Fixed bug that reset turn number to 1 on each savefile load.
[plomrogue] / src / command_db.c
index 2a37b405e505326f7e6faf8293211ee44ff825d2..25fcd24e90076da9ca8c5c75689c7b487525a6f3 100644 (file)
@@ -81,7 +81,8 @@ extern void init_command_db(struct World * world)
     FILE * file = fopen("config/commands", "r");
     exit_err(NULL == file, world, err);
     uint16_t lines, linemax;
-    textfile_sizes(file, &linemax, &lines);
+    err = "Trouble in init_cmds() with textfile_sizes().";
+    exit_err(textfile_sizes(file, &linemax, &lines), world, err);
     err = "Trouble in init_cmds() with malloc().";
     char * line = malloc(linemax);
     exit_err(NULL == line, world, err);
@@ -95,6 +96,7 @@ extern void init_command_db(struct World * world)
         copy_tokenized_string(world, &cmds[i].dsc_long, "\n", err);
         i++;
     }
+    free(line);
     world->cmd_db = malloc(sizeof(struct CommandDB));
     world->cmd_db->cmds = cmds;
     world->cmd_db->n = lines;