ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/arch.C
(Generate patch)

Comparing deliantra/server/common/arch.C (file contents):
Revision 1.2 by root, Sat Aug 26 08:44:04 2006 UTC vs.
Revision 1.6 by root, Tue Aug 29 05:03:54 2006 UTC

1/* 1/*
2 * static char *rcsid_arch_c = 2 * static char *rcsid_arch_c =
3 * "$Id: arch.C,v 1.2 2006/08/26 08:44:04 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
28 28
29#include <global.h> 29#include <global.h>
30#include <arch.h> 30#include <arch.h>
31#include <funcpoint.h> 31#include <funcpoint.h>
32#include <loader.h> 32#include <loader.h>
33
34#include <cassert>
33 35
34/* IF set, does a little timing on the archetype load. */ 36/* IF set, does a little timing on the archetype load. */
35#define TIME_ARCH_LOAD 0 37#define TIME_ARCH_LOAD 0
36 38
37static void add_arch(archetype *at); 39static void add_arch(archetype *at);
156 return arch_to_object(at); 158 return arch_to_object(at);
157 } 159 }
158 } 160 }
159 return create_singularity(name); 161 return create_singularity(name);
160} 162}
161
162 /* GROS - find_best_weapon_used_match and item_matched_string moved there */
163object *find_best_weapon_used_match(object *pl, const char *params)
164 {
165 object *tmp, *best=NULL;
166 int match_val=0,tmpmatch;
167
168 for (tmp=pl->inv; tmp; tmp=tmp->below) {
169 if (tmp->invisible) continue;
170 if ((tmpmatch=item_matched_string(pl, tmp, params))>match_val)
171 {
172 if ((QUERY_FLAG(tmp, FLAG_APPLIED))&&(tmp->type==WEAPON))
173 {
174 match_val=tmpmatch;
175 best=tmp;
176 };
177 }
178 }
179 return best;
180 }
181 163
182 /* 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
183 * a string seperated lists of things to match, with certain keywords. 165 * a string seperated lists of things to match, with certain keywords.
184 * pl is the player (only needed to set count properly) 166 * pl is the player (only needed to set count properly)
185 * 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
397 379
398/* 380/*
399 * Reads/parses the archetype-file, and copies into a linked list 381 * Reads/parses the archetype-file, and copies into a linked list
400 * of archetype-structures. 382 * of archetype-structures.
401 */ 383 */
402void first_arch_pass(FILE *fp) { 384void first_arch_pass(object_thawer &fp) {
403 object *op; 385 object *op;
404 archetype *at,*head=NULL,*last_more=NULL; 386 archetype *at,*head=NULL,*last_more=NULL;
405 int i,first=2; 387 int i,first=2;
406 388
407 op=get_object(); 389 op=get_object();
544 clear_archetable(); 526 clear_archetable();
545 LOG(llevDebug," arch-pass 1...\n"); 527 LOG(llevDebug," arch-pass 1...\n");
546#if TIME_ARCH_LOAD 528#if TIME_ARCH_LOAD
547 GETTIMEOFDAY(&tv1); 529 GETTIMEOFDAY(&tv1);
548#endif 530#endif
531 {
532 object_thawer thawer (fp);
549 first_arch_pass(fp); 533 first_arch_pass (thawer);
534 }
550#if TIME_ARCH_LOAD 535#if TIME_ARCH_LOAD
551 { int sec, usec; 536 { int sec, usec;
552 GETTIMEOFDAY(&tv2); 537 GETTIMEOFDAY(&tv2);
553 sec = tv2.tv_sec - tv1.tv_sec; 538 sec = tv2.tv_sec - tv1.tv_sec;
554 usec = tv2.tv_usec - tv1.tv_usec; 539 usec = tv2.tv_usec - tv1.tv_usec;
730 LOG(llevError,"Can't clone archetype %d\n",type); 715 LOG(llevError,"Can't clone archetype %d\n",type);
731 free_object(op); 716 free_object(op);
732 return NULL; 717 return NULL;
733 } 718 }
734 copy_object(&at->clone,op); 719 copy_object(&at->clone,op);
720 op->instantiate ();
735 return op; 721 return op;
736} 722}
737 723
738/* 724/*
739 * member: make instance from class 725 * member: make instance from class

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines