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.31 by root, Wed Dec 13 03:28:42 2006 UTC vs.
Revision 1.35 by root, Wed Jan 3 20:32:13 2007 UTC

118 * If type is -1, ew don't match on type. 118 * If type is -1, ew don't match on type.
119 */ 119 */
120object * 120object *
121get_archetype_by_skill_name (const char *skill, int type) 121get_archetype_by_skill_name (const char *skill, int type)
122{ 122{
123 archetype * 123 archetype *at;
124 at;
125 124
126 if (skill == NULL) 125 if (skill)
127 return NULL;
128
129 for (at = first_archetype; at != NULL; at = at->next) 126 for (at = first_archetype; at; at = at->next)
130 {
131 if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill))) 127 if (((type == -1) || (type == at->clone.type)) && (!strcmp (at->clone.skill, skill)))
132 return arch_to_object (at); 128 return arch_to_object (at);
133 } 129
134 return NULL; 130 return 0;
135} 131}
136 132
137/* similiar to above - this returns the first archetype 133/* similiar to above - this returns the first archetype
138 * that matches both the type and subtype. type and subtype 134 * that matches both the type and subtype. type and subtype
139 * can be -1 to say ignore, but in this case, the match it does 135 * can be -1 to say ignore, but in this case, the match it does
179 for (i = strlen (tmpname); i > 0; i--) 175 for (i = strlen (tmpname); i > 0; i--)
180 { 176 {
181 tmpname[i] = 0; 177 tmpname[i] = 0;
182 at = find_archetype_by_object_name (tmpname); 178 at = find_archetype_by_object_name (tmpname);
183 179
184 if (at != NULL) 180 if (at)
185 return arch_to_object (at); 181 return arch_to_object (at);
186 } 182 }
187 183
188 return create_singularity (name); 184 return create_singularity (name);
189} 185}
387 LOG (llevDebug, "Freed %d archetypes, %d faces\n", i, f); 383 LOG (llevDebug, "Freed %d archetypes, %d faces\n", i, f);
388} 384}
389 385
390archetype::archetype () 386archetype::archetype ()
391{ 387{
392 clone.clear (); /* to initial state other also */
393 CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */ 388 CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */
394 SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */ 389 SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */
395} 390}
396 391
397archetype::~archetype () 392archetype::~archetype ()
576 object_thawer 571 object_thawer
577 thawer (filename); 572 thawer (filename);
578 573
579 LOG (llevDebug, " loading treasure...\n"); 574 LOG (llevDebug, " loading treasure...\n");
580 load_treasures (); 575 load_treasures ();
576 LOG (llevDebug, " done\n");
581 LOG (llevDebug, " done\n arch-pass 2...\n"); 577 LOG (llevDebug, " arch-pass 2...\n");
582 second_arch_pass (thawer); 578 second_arch_pass (thawer);
583 LOG (llevDebug, " done\n"); 579 LOG (llevDebug, " done\n");
584#ifdef DEBUG 580#ifdef DEBUG
585 check_generators (); 581 check_generators ();
586#endif 582#endif
590 586
591/* 587/*
592 * Creates and returns a new object which is a copy of the given archetype. 588 * Creates and returns a new object which is a copy of the given archetype.
593 * This function returns NULL on failure. 589 * This function returns NULL on failure.
594 */ 590 */
595
596object * 591object *
597arch_to_object (archetype *at) 592arch_to_object (archetype *at)
598{ 593{
599 object *op; 594 object *op;
600 595
616 * Creates an object. This function is called by get_archetype() 611 * Creates an object. This function is called by get_archetype()
617 * if it fails to find the appropriate archetype. 612 * if it fails to find the appropriate archetype.
618 * Thus get_archetype() will be guaranteed to always return 613 * Thus get_archetype() will be guaranteed to always return
619 * an object, and never NULL. 614 * an object, and never NULL.
620 */ 615 */
621
622object * 616object *
623create_singularity (const char *name) 617create_singularity (const char *name)
624{ 618{
625 object *op; 619 object *op;
626 char buf[MAX_BUF]; 620 char buf[MAX_BUF];
634 628
635/* 629/*
636 * Finds which archetype matches the given name, and returns a new 630 * Finds which archetype matches the given name, and returns a new
637 * object containing a copy of the archetype. 631 * object containing a copy of the archetype.
638 */ 632 */
639
640object * 633object *
641get_archetype (const char *name) 634get_archetype (const char *name)
642{ 635{
643 archetype *at = archetype::find (name); 636 archetype *at = archetype::find (name);
644 637

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines