\n", - world[world[i].dir_option[door]->to_room].number, - dir_names[door], - world[world[i].dir_option[door]->to_room].name); + world[i].dir_option[door]->to_room != NOWHERE) { + found = 1; + //this call gets a pointer to the room referenced by the to_room for the door. + //This fixes a lot of issues introduced with the whole 'renumbering rooms' call + //and the binary search that didn't work well. + struct room_data* to_room = findRoom(world[i].dir_option[door]->to_room); + fprintf(fl, " %s to %s
\n",
+ to_room->number,
+ dir_names[door],
+ to_room->name);
}
if (!found)
fprintf(fl, "None!");
fclose(fl);
}
-}
+}
/* function to count how many hash-mark delimited records exist in a file */
int count_hash_records(FILE * fl)
@@ -231,19 +262,35 @@ int count_hash_records(FILE * fl)
-void index_boot(char *name)
+void index_boot(int cnt, char **names)
{
FILE *db_file;
- int rec_count = 0;
- if (!(db_file = fopen(name, "r"))) {
- perror("error opening world file");
- exit(1);
+ //throw first entry away as that is the executable.
+ for (int i=1;i