This is an unoffical update to roomsave.txt originally published by Reza Nejad , and updated by Russell Ryan Rather than only save rooms which have a special flag, this will save ANY room which has objects in it. --Ziz (zizazat@hotmail.com) /* --begin instruction-- */ make a "save" directory in lib ----->in db.h after #define LIB_HOUSE "house/" add #define LIB_SAVE "save/" ------>Stick this at the end of house.c int save_get_filename(int i, char *filename) { if (i < 0) return 0; sprintf(filename, LIB_SAVE"%d.save", world[i].number); return 1; } int save_load(int i) { FILE *fll; char fname[MAX_STRING_LENGTH]; struct obj_file_elem object; room_rnum rnum; if ((rnum = real_room(i)) == NOWHERE) return (0); if (!save_get_filename(i, fname)) return 0; if (!(fll = fopen(fname, "r+b"))) { return 0; } while (!feof(fll)) { fread(&object, sizeof(struct obj_file_elem), 1, fll); if (ferror(fll)) { perror("Reading save file: save_load."); fclose(fll); return 0; } if (!feof(fll)) obj_to_room(Obj_from_store(object, &i), rnum); } fclose(fll); return 1; } void save_boot(void) { int i; for (i = 0; i <= top_of_world; i++) save_load(i); } int save_save(struct obj_data * obj, FILE * fll) { struct obj_data *tmp; int result; if (obj) { save_save(obj->contains, fll); save_save(obj->next_content, fll); result = Obj_to_store(obj, fll, 0); if (!result) return 0; for (tmp = obj->in_obj; tmp; tmp = tmp->in_obj) GET_OBJ_WEIGHT(tmp) -= GET_OBJ_WEIGHT(obj); } return 1; } void save_restore_weight(struct obj_data * obj) { if (obj) { save_restore_weight(obj->contains); save_restore_weight(obj->next_content); if (obj->in_obj) GET_OBJ_WEIGHT(obj->in_obj) += GET_OBJ_WEIGHT(obj); } } void save_saved(int i) { char buf[MAX_STRING_LENGTH]; FILE *fll; if (i == -1) return; sprintf(buf, LIB_SAVE"%d.save", world[i].number); fll = fopen(buf, "wb"); save_save(world[i].contents, fll); fclose(fll); save_restore_weight(world[i].contents); } ------>Add this to the end of house.h void save_boot(void); void save_saved(int vnum); -----> In db.c in void_boot_db add log("Loading Saved Rooms."); save_boot(); anywhere you like inside of the boot routines (I suggest affter the house loading) ------> In do_shutdown() (or anywhere you find nice) after char arg[MAX_INPUT_LENGTH]; add FILE *tmp; char fname[MAX_INPUT_LENGTH]; int i; after one_argument(argument, arg); add for (i = 0; i <= top_of_world; i++) { if (!save_get_filename(i, fname)) continue; if (!world[i].contents && ((tmp = fopen(fname, "rb")) != NULL)) { remove(fname); continue; } if (world[i].contents) save_saved(i); } /* --end instruction-- */