1 | %{ |
1 | %{ |
2 | /* |
2 | /* |
3 | * static char *rcsid_object_c = |
3 | * static char *rcsid_object_c = |
4 | * "$Id: loader.l,v 1.8 2006/08/26 08:44:04 root Exp $"; |
4 | * "$Id: loader.l,v 1.9 2006/08/26 23:36:29 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
716 | */ |
716 | */ |
717 | if (op->arch) { |
717 | if (op->arch) { |
718 | object *tmp; |
718 | object *tmp; |
719 | char *yv=yval(); |
719 | char *yv=yval(); |
720 | |
720 | |
721 | tmp=get_object(); |
|
|
722 | tmp->arch = find_archetype(yv); |
721 | archetype *arch = find_archetype(yv); |
723 | if (tmp->arch!=NULL) |
722 | if (arch!=NULL) |
724 | copy_object(&tmp->arch->clone,tmp); |
723 | tmp = arch_to_object (arch); |
725 | else { |
724 | else { |
|
|
725 | tmp = get_object (); |
726 | if (tmp->name) free_string(tmp->name); |
726 | if (tmp->name) free_string(tmp->name); |
727 | /* record the name of the broken object */ |
727 | /* record the name of the broken object */ |
728 | tmp->name = add_string(yv); |
728 | tmp->name = add_string(yv); |
729 | } |
729 | } |
730 | strcpy(msgbuf, ""); |
730 | strcpy(msgbuf, ""); |
… | |
… | |
741 | /* This is the actual archetype definition then */ |
741 | /* This is the actual archetype definition then */ |
742 | else { |
742 | else { |
743 | char *yv=yval(); |
743 | char *yv=yval(); |
744 | |
744 | |
745 | op->arch=find_archetype(yv); |
745 | op->arch=find_archetype(yv); |
746 | if (op->arch!=NULL) copy_object(&op->arch->clone,op); |
746 | if (op->arch!=NULL) { |
747 | else if (!arch_init) { |
747 | copy_object(&op->arch->clone,op); |
|
|
748 | op->instantiate (); |
|
|
749 | } else if (!arch_init) { |
748 | if (op->name) free_string(op->name); |
750 | if (op->name) free_string(op->name); |
749 | /* record the name of the broken object */ |
751 | /* record the name of the broken object */ |
750 | op->name = add_string(yv); |
752 | op->name = add_string(yv); |
751 | } |
753 | } |
752 | } |
754 | } |