1 | /* |
1 | /* |
2 | * static char *rcsid_arch_c = |
2 | * static char *rcsid_arch_c = |
3 | * "$Id: arch.C,v 1.3 2006/08/26 23:36:28 root Exp $"; |
3 | * "$Id: arch.C,v 1.6 2006/08/29 05:03:54 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
158 | return arch_to_object(at); |
158 | return arch_to_object(at); |
159 | } |
159 | } |
160 | } |
160 | } |
161 | return create_singularity(name); |
161 | return create_singularity(name); |
162 | } |
162 | } |
163 | |
|
|
164 | /* GROS - find_best_weapon_used_match and item_matched_string moved there */ |
|
|
165 | object *find_best_weapon_used_match(object *pl, const char *params) |
|
|
166 | { |
|
|
167 | object *tmp, *best=NULL; |
|
|
168 | int match_val=0,tmpmatch; |
|
|
169 | |
|
|
170 | for (tmp=pl->inv; tmp; tmp=tmp->below) { |
|
|
171 | if (tmp->invisible) continue; |
|
|
172 | if ((tmpmatch=item_matched_string(pl, tmp, params))>match_val) |
|
|
173 | { |
|
|
174 | if ((QUERY_FLAG(tmp, FLAG_APPLIED))&&(tmp->type==WEAPON)) |
|
|
175 | { |
|
|
176 | match_val=tmpmatch; |
|
|
177 | best=tmp; |
|
|
178 | }; |
|
|
179 | } |
|
|
180 | } |
|
|
181 | return best; |
|
|
182 | } |
|
|
183 | |
163 | |
184 | /* This is a subset of the parse_id command. Basically, name can be |
164 | /* This is a subset of the parse_id command. Basically, name can be |
185 | * a string seperated lists of things to match, with certain keywords. |
165 | * a string seperated lists of things to match, with certain keywords. |
186 | * pl is the player (only needed to set count properly) |
166 | * pl is the player (only needed to set count properly) |
187 | * op is the item we are trying to match. Calling function takes care |
167 | * op is the item we are trying to match. Calling function takes care |
… | |
… | |
399 | |
379 | |
400 | /* |
380 | /* |
401 | * Reads/parses the archetype-file, and copies into a linked list |
381 | * Reads/parses the archetype-file, and copies into a linked list |
402 | * of archetype-structures. |
382 | * of archetype-structures. |
403 | */ |
383 | */ |
404 | void first_arch_pass(FILE *fp) { |
384 | void first_arch_pass(object_thawer &fp) { |
405 | object *op; |
385 | object *op; |
406 | archetype *at,*head=NULL,*last_more=NULL; |
386 | archetype *at,*head=NULL,*last_more=NULL; |
407 | int i,first=2; |
387 | int i,first=2; |
408 | |
388 | |
409 | op=get_object(); |
389 | op=get_object(); |
… | |
… | |
546 | clear_archetable(); |
526 | clear_archetable(); |
547 | LOG(llevDebug," arch-pass 1...\n"); |
527 | LOG(llevDebug," arch-pass 1...\n"); |
548 | #if TIME_ARCH_LOAD |
528 | #if TIME_ARCH_LOAD |
549 | GETTIMEOFDAY(&tv1); |
529 | GETTIMEOFDAY(&tv1); |
550 | #endif |
530 | #endif |
|
|
531 | { |
|
|
532 | object_thawer thawer (fp); |
551 | first_arch_pass(fp); |
533 | first_arch_pass (thawer); |
|
|
534 | } |
552 | #if TIME_ARCH_LOAD |
535 | #if TIME_ARCH_LOAD |
553 | { int sec, usec; |
536 | { int sec, usec; |
554 | GETTIMEOFDAY(&tv2); |
537 | GETTIMEOFDAY(&tv2); |
555 | sec = tv2.tv_sec - tv1.tv_sec; |
538 | sec = tv2.tv_sec - tv1.tv_sec; |
556 | usec = tv2.tv_usec - tv1.tv_usec; |
539 | usec = tv2.tv_usec - tv1.tv_usec; |