int Crash_save(struct obj_data *obj, FILE *fp, int location) { struct obj_data *tmp; int result; if (obj) { Crash_save(obj->next_content, fp, location); Crash_save(obj->contains, fp, MIN(0, location) - 1); result = Obj_to_store(obj, fp, location); for (tmp = obj->in_obj; tmp; tmp = tmp->in_obj) GET_OBJ_WEIGHT(tmp) -= GET_OBJ_WEIGHT(obj); if (!result) return (0); } return (TRUE); }
/* Save all objects for a house (recursive; initial call must be followed by a call to House_restore_weight) Assumes file is open already. */ int House_save(struct obj_data * obj, FILE * fp) { struct obj_data *tmp; int result; if (obj) { if (!IS_OBJ_STAT(obj, ITEM_NORENT)) { House_save(obj->contains, fp); House_save(obj->next_content, fp); result = Obj_to_store(obj, fp); if (!result) return 0; for (tmp = obj->in_obj; tmp; tmp = tmp->in_obj) GET_OBJ_WEIGHT(tmp) -= GET_OBJ_WEIGHT(obj); } } return 1; }