--- deliantra/server/common/treasure.C 2006/08/29 08:01:36 1.4 +++ deliantra/server/common/treasure.C 2006/08/30 06:06:27 1.5 @@ -1,7 +1,7 @@ /* * static char *rcs_treasure_c = - * "$Id: treasure.C,v 1.4 2006/08/29 08:01:36 root Exp $"; + * "$Id: treasure.C,v 1.5 2006/08/30 06:06:27 root Exp $"; */ /* @@ -1272,7 +1272,6 @@ void init_artifacts(void) { static int has_been_inited=0; - FILE *fp_; char filename[MAX_BUF], buf[HUGE_BUF], *cp, *next; artifact *art=NULL; linked_char *tmp; @@ -1283,15 +1282,12 @@ else has_been_inited = 1; sprintf(filename, "%s/artifacts", settings.datadir); - LOG(llevDebug, "Reading artifacts from %s...",filename); - if ((fp_ = open_and_uncompress(filename, 0, &comp)) == NULL) { - LOG(llevError, "Can't open %s.\n", filename); - return; - } + object_thawer thawer (filename); - object_thawer fp (fp_); + if (!thawer) + return; - while (fgets(buf, HUGE_BUF, fp)!=NULL) { + while (fgets(buf, HUGE_BUF, thawer)!=NULL) { if (*buf=='#') continue; if((cp=strchr(buf,'\n'))!=NULL) *cp='\0'; @@ -1325,7 +1321,7 @@ else if (!strncmp(cp, "Object",6)) { art->item = (object *) calloc(1, sizeof(object)); reset_object(art->item); - if (!load_object(fp, art->item,LO_LINEMODE,0)) + if (!load_object(thawer, art->item,LO_LINEMODE,0)) LOG(llevError,"Init_Artifacts: Could not load object.\n"); art->item->name = add_string((strchr(cp, ' ')+1)); al=find_artifactlist(art->item->type); @@ -1343,8 +1339,6 @@ LOG(llevError,"Unknown input in artifact file: %s\n", buf); } - close_and_delete(fp, comp); - for (al=first_artifactlist; al!=NULL; al=al->next) { for (art=al->items; art!=NULL; art=art->next) { if (!art->chance)