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.26 by root, Fri Nov 17 19:40:53 2006 UTC vs.
Revision 1.30 by root, Wed Dec 13 00:42:03 2006 UTC

388} 388}
389 389
390archetype::archetype () 390archetype::archetype ()
391{ 391{
392 clear_object (&clone); /* to initial state other also */ 392 clear_object (&clone); /* to initial state other also */
393 CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_object() */ 393 CLEAR_FLAG (&clone, FLAG_FREED); /* This shouldn't matter, since copy_to */
394 SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */ 394 SET_FLAG (&clone, FLAG_REMOVED); /* doesn't copy these flags... */
395} 395}
396 396
397archetype::~archetype () 397archetype::~archetype ()
398{ 398{
403 * of archetype-structures. 403 * of archetype-structures.
404 */ 404 */
405void 405void
406first_arch_pass (object_thawer & fp) 406first_arch_pass (object_thawer & fp)
407{ 407{
408 archetype *at, *head = NULL, *last_more = NULL; 408 archetype *head = 0, *last_more = 0;
409 409
410 archetype *at = new archetype;
410 at->clone.arch = first_archetype = at = new archetype; 411 at->clone.arch = first_archetype = at;
411 412
412 while (int i = load_object (fp, &at->clone, 0)) 413 while (int i = load_object (fp, &at->clone, 0))
413 { 414 {
414 at->clone.speed_left = (float) (-0.1); 415 at->clone.speed_left = (float) (-0.1);
415 /* copy the body_info to the body_used - this is only really 416 /* copy the body_info to the body_used - this is only really
603 LOG (llevError, "Couldn't find archetype.\n"); 604 LOG (llevError, "Couldn't find archetype.\n");
604 605
605 return NULL; 606 return NULL;
606 } 607 }
607 608
608 op = get_object (); 609 op = at->clone.clone ();
609 copy_object (&at->clone, op);
610 op->arch = at; 610 op->arch = at;
611 op->instantiate (); 611 op->instantiate ();
612 return op; 612 return op;
613} 613}
614 614
624{ 624{
625 object *op; 625 object *op;
626 char buf[MAX_BUF]; 626 char buf[MAX_BUF];
627 627
628 sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); 628 sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name);
629 op = get_object (); 629 op = object::create ();
630 op->name = op->name_pl = buf; 630 op->name = op->name_pl = buf;
631 SET_FLAG (op, FLAG_NO_PICK); 631 SET_FLAG (op, FLAG_NO_PICK);
632 return op; 632 return op;
633} 633}
634 634
805 805
806object * 806object *
807clone_arch (int type) 807clone_arch (int type)
808{ 808{
809 archetype *at; 809 archetype *at;
810 object *op = get_object ();
811 810
812 if ((at = type_to_archetype (type)) == NULL) 811 if ((at = type_to_archetype (type)) == NULL)
813 { 812 {
814 LOG (llevError, "Can't clone archetype %d\n", type); 813 LOG (llevError, "Can't clone archetype %d\n", type);
815 free_object (op);
816 return NULL; 814 return 0;
817 } 815 }
818 816
819 copy_object (&at->clone, op); 817 object *op = at->clone.clone ();
820 op->instantiate (); 818 op->instantiate ();
821 return op; 819 return op;
822} 820}
823 821
824/* 822/*

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines