--- deliantra/server/common/loader.l 2006/08/26 23:36:29 1.9 +++ deliantra/server/common/loader.l 2006/08/27 16:15:11 1.10 @@ -37,7 +37,7 @@ #include #include -#define YY_DECL int lex_load(object *op, int map_flags) +#define YY_DECL int lex_load(object *op, object_thawer &thawer, int map_flags) static char *yval(); @@ -729,7 +729,7 @@ } strcpy(msgbuf, ""); strcpy(lorebuf, ""); - lex_load(tmp, map_flags); + lex_load(tmp, thawer, map_flags); if (tmp->arch) { insert_ob_in_ob(tmp,op); } @@ -772,6 +772,7 @@ } ^end{WS}$ { check_loaded_object(op); + thawer.get (op); if (ismore) return LL_MORE; else return LL_NORMAL; } @@ -1406,7 +1407,7 @@ * */ -int load_object(FILE *fp, object *op, int bufstate, int map_flags) { +int load_object(FILE *fp, object_thawer &thawer, object *op, int bufstate, int map_flags) { int retval; char inbuf[MAX_BUF]; @@ -1422,7 +1423,7 @@ YY_BUFFER_STATE yybufstate; while (fgets(inbuf, MAX_BUF-3, fp)) { yybufstate=yy_scan_string(inbuf); - retval=lex_load(op, map_flags); + retval=lex_load(op, thawer, map_flags); yy_delete_buffer(yybufstate); if (retval==LL_NORMAL) return retval; } @@ -1430,7 +1431,7 @@ return LL_EOF; } - retval=lex_load(op, map_flags); + retval=lex_load(op, thawer, map_flags); if (op->current_weapon_script != NULL) { op->current_weapon = find_best_weapon_used_match(op, op->current_weapon_script); @@ -1451,12 +1452,13 @@ int set_variable(object *op,char *buf) { YY_BUFFER_STATE yybufstate,yycurbuf=YY_CURRENT_BUFFER; int retval; + object_thawer thawer; strcpy(msgbuf, ""); strcpy(lorebuf, ""); yy_push_state(INITIAL); yybufstate=yy_scan_string(buf); - retval=lex_load(op,0); + retval=lex_load(op,thawer,0); yy_switch_to_buffer(yycurbuf); yy_delete_buffer(yybufstate); yy_pop_state(); @@ -2033,7 +2035,7 @@ * all of the callers are setting this. */ -void save_object(FILE *fp,object *op, int flag) { +void save_object(FILE *fp,object_freezer &freezer,object *op, int flag) { archetype *at; char *cp; object *tmp,*old; @@ -2061,7 +2063,7 @@ if (flag & 2 ) for(tmp=op->inv;tmp!=NULL;tmp=tmp->below) - save_object(fp,tmp,flag); + save_object(fp,freezer,tmp,flag); /* Slightly different logic because tmp/op will be removed by * the save_object we call. So we just keep looking at op->inv @@ -2073,7 +2075,7 @@ LOG(llevError," Recursive loop in inventory\n"); break; } - save_object(fp,tmp,flag); + save_object(fp,freezer,tmp,flag); old=tmp; } @@ -2083,6 +2085,7 @@ } fprintf(fp,"end\n"); + freezer.put (op); } void insert_event(object* op, int etype, char *ehook, char *eplug, char *eoptions)