… | |
… | |
387 | LOG (llevDebug, "Freed %d archetypes, %d faces\n", i, f); |
387 | LOG (llevDebug, "Freed %d archetypes, %d faces\n", i, f); |
388 | } |
388 | } |
389 | |
389 | |
390 | archetype::archetype () |
390 | archetype::archetype () |
391 | { |
391 | { |
392 | clear_object (&clone); /* to initial state other also */ |
392 | clone.clear (); /* 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 | |
397 | archetype::~archetype () |
397 | archetype::~archetype () |
398 | { |
398 | { |
… | |
… | |
604 | LOG (llevError, "Couldn't find archetype.\n"); |
604 | LOG (llevError, "Couldn't find archetype.\n"); |
605 | |
605 | |
606 | return NULL; |
606 | return NULL; |
607 | } |
607 | } |
608 | |
608 | |
609 | op = get_object (); |
609 | op = at->clone.clone (); |
610 | copy_object (&at->clone, op); |
|
|
611 | op->arch = at; |
610 | op->arch = at; |
612 | op->instantiate (); |
611 | op->instantiate (); |
613 | return op; |
612 | return op; |
614 | } |
613 | } |
615 | |
614 | |
… | |
… | |
625 | { |
624 | { |
626 | object *op; |
625 | object *op; |
627 | char buf[MAX_BUF]; |
626 | char buf[MAX_BUF]; |
628 | |
627 | |
629 | sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); |
628 | sprintf (buf, "%s (%s)", ARCH_SINGULARITY, name); |
630 | op = get_object (); |
629 | op = object::create (); |
631 | op->name = op->name_pl = buf; |
630 | op->name = op->name_pl = buf; |
632 | SET_FLAG (op, FLAG_NO_PICK); |
631 | SET_FLAG (op, FLAG_NO_PICK); |
633 | return op; |
632 | return op; |
634 | } |
633 | } |
635 | |
634 | |
… | |
… | |
806 | |
805 | |
807 | object * |
806 | object * |
808 | clone_arch (int type) |
807 | clone_arch (int type) |
809 | { |
808 | { |
810 | archetype *at; |
809 | archetype *at; |
811 | object *op = get_object (); |
|
|
812 | |
810 | |
813 | if ((at = type_to_archetype (type)) == NULL) |
811 | if ((at = type_to_archetype (type)) == NULL) |
814 | { |
812 | { |
815 | LOG (llevError, "Can't clone archetype %d\n", type); |
813 | LOG (llevError, "Can't clone archetype %d\n", type); |
816 | op->destroy (0); |
|
|
817 | return NULL; |
814 | return 0; |
818 | } |
815 | } |
819 | |
816 | |
820 | copy_object (&at->clone, op); |
817 | object *op = at->clone.clone (); |
821 | op->instantiate (); |
818 | op->instantiate (); |
822 | return op; |
819 | return op; |
823 | } |
820 | } |
824 | |
821 | |
825 | /* |
822 | /* |