| version 1.8 | | version 1.9 |
|---|
| | |
| /* A lexical scanner generated by flex */ | | /* A lexical scanner generated by flex */ |
| | | |
| /* Scanner skeleton version: | | /* Scanner skeleton version: |
| * $Header: /cvsroot/crossfire/crossfire/common/loader.c,v 1.8 2001/01/24 05:01:36 cvs Exp $ | | * $Header: /cvsroot/crossfire/crossfire/common/loader.c,v 1.9 2001/02/11 09:12:12 cvs Exp $ |
| */ | | */ |
| | | |
| #define FLEX_SCANNER | | #define FLEX_SCANNER |
| | |
| #line 2 "loader.l" | | #line 2 "loader.l" |
| /* | | /* |
| * static char *rcsid_object_c = | | * static char *rcsid_object_c = |
| * "$Id: loader.c,v 1.8 2001/01/24 05:01:36 cvs Exp $"; | | * "$Id: loader.c,v 1.9 2001/02/11 09:12:12 cvs Exp $"; |
| */ | | */ |
| | | |
| /* | | /* |
| | |
| }; | | }; |
| | | |
| | | |
| #define YY_DECL int lex_load(object *op) | | #define YY_DECL int lex_load(object *op, int map_flags) |
| | | |
| static char *yval(); | | static char *yval(); |
| | | |
| | |
| tmp->arch = find_archetype(yval()); | | tmp->arch = find_archetype(yval()); |
| if (tmp->arch!=NULL) | | if (tmp->arch!=NULL) |
| copy_object(&tmp->arch->clone,tmp); | | copy_object(&tmp->arch->clone,tmp); |
| lex_load(tmp); | | lex_load(tmp, map_flags); |
| insert_ob_in_ob(tmp,op); | | insert_ob_in_ob(tmp,op); |
| } | | } |
| /* This is the actual archetype definition then */ | | /* This is the actual archetype definition then */ |
| | |
| #line 234 "loader.l" | | #line 234 "loader.l" |
| { op->speed = FVAL; | | { op->speed = FVAL; |
| if (op->speed<0) op->speed_left = op->speed_left-RANDOM()%100/100.0; | | if (op->speed<0) op->speed_left = op->speed_left-RANDOM()%100/100.0; |
| update_ob_speed(op); | | if (!(map_flags & MAP_STYLE)) update_ob_speed(op); |
| } | | } |
| YY_BREAK | | YY_BREAK |
| case 19: | | case 19: |
| | |
| * | | * |
| */ | | */ |
| | | |
| int load_object(FILE *fp, object *op, int bufstate) { | | int load_object(FILE *fp, object *op, int bufstate, int map_flags) { |
| int retval; | | int retval; |
| char inbuf[MAX_BUF]; | | char inbuf[MAX_BUF]; |
| | | |
| if (bufstate==LO_NEWFILE || bufstate==LO_NOREAD) { | | if (bufstate==LO_NEWFILE || bufstate==LO_NOREAD) { |
| LOG(llevDebug,"Switching lex buffers\n"); | | /* LOG(llevDebug,"Switching lex buffers\n");*/ |
| yy_delete_buffer(YY_CURRENT_BUFFER); | | yy_delete_buffer(YY_CURRENT_BUFFER); |
| yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE)); | | yy_switch_to_buffer(yy_create_buffer(fp, YY_BUF_SIZE)); |
| if (bufstate==LO_NOREAD) return LL_NORMAL; | | if (bufstate==LO_NOREAD) return LL_NORMAL; |
| | |
| YY_BUFFER_STATE yybufstate; | | YY_BUFFER_STATE yybufstate; |
| while (fgets(inbuf, MAX_BUF-3, fp)) { | | while (fgets(inbuf, MAX_BUF-3, fp)) { |
| yybufstate=yy_scan_string(inbuf); | | yybufstate=yy_scan_string(inbuf); |
| retval=lex_load(op); | | retval=lex_load(op, map_flags); |
| yy_delete_buffer(yybufstate); | | yy_delete_buffer(yybufstate); |
| if (retval==LL_NORMAL) return retval; | | if (retval==LL_NORMAL) return retval; |
| } | | } |
| | |
| return LL_EOF; | | return LL_EOF; |
| } | | } |
| | | |
| retval=lex_load(op); | | retval=lex_load(op, map_flags); |
| /* LOG(llevDebug," load completed, object=%s\n",op->name);*/ | | /* LOG(llevDebug," load completed, object=%s\n",op->name);*/ |
| return retval; | | return retval; |
| } | | } |
| | |
| | | |
| yy_push_state(INITIAL); | | yy_push_state(INITIAL); |
| yybufstate=yy_scan_string(buf); | | yybufstate=yy_scan_string(buf); |
| retval=lex_load(op); | | retval=lex_load(op,0); |
| yy_switch_to_buffer(yycurbuf); | | yy_switch_to_buffer(yycurbuf); |
| yy_delete_buffer(yybufstate); | | yy_delete_buffer(yybufstate); |
| yy_pop_state(); | | yy_pop_state(); |