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

Comparing deliantra/server/common/loader.l (file contents):
Revision 1.7 by elmex, Sun Aug 13 17:16:00 2006 UTC vs.
Revision 1.9 by root, Sat Aug 26 23:36:29 2006 UTC

1%{ 1%{
2/* 2/*
3 * static char *rcsid_object_c = 3 * static char *rcsid_object_c =
4 * "$Id: loader.l,v 1.7 2006/08/13 17:16:00 elmex 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
40#define YY_DECL int lex_load(object *op, int map_flags) 40#define YY_DECL int lex_load(object *op, int map_flags)
41 41
42static char *yval(); 42static char *yval();
43 43
44static int lex_error; 44static int lex_error;
45static char msgbuf[HUGE_BUF]; 45static char msgbuf[65536];
46static char lorebuf[HUGE_BUF]; 46static char lorebuf[65536];
47 47
48/* Maps the MOVE_* values to names */ 48/* Maps the MOVE_* values to names */
49static const char *const move_name[] = {"walk", "fly_low", "fly_high", "swim", "boat", 49static const char *const move_name[] = {"walk", "fly_low", "fly_high", "swim", "boat",
50 NULL}; 50 NULL};
51 51
693^name_pl{S} { char *yv=yval(); 693^name_pl{S} { char *yv=yval();
694 694
695 if (*yv=='\0') LOG(llevError,"Name without val\n"); 695 if (*yv=='\0') LOG(llevError,"Name without val\n");
696 else FREE_AND_COPY(op->name_pl, yv); 696 else FREE_AND_COPY(op->name_pl, yv);
697 } 697 }
698^attach{S} { char *yv=yval();
699 if (*yv)
700 op->attach = add_string (yv);
701 }
698^skill{S} FREE_AND_COPY(op->skill,yval()); 702^skill{S} FREE_AND_COPY(op->skill,yval());
699^custom_name{S} { char *yv=yval(); 703^custom_name{S} { char *yv=yval();
700 704
701 if (*yv=='\0') LOG(llevError,"Custom name without val\n"); 705 if (*yv=='\0') LOG(llevError,"Custom name without val\n");
702 else FREE_AND_COPY(op->custom_name, yv); 706 else FREE_AND_COPY(op->custom_name, yv);
712 */ 716 */
713 if (op->arch) { 717 if (op->arch) {
714 object *tmp; 718 object *tmp;
715 char *yv=yval(); 719 char *yv=yval();
716 720
717 tmp=get_object();
718 tmp->arch = find_archetype(yv); 721 archetype *arch = find_archetype(yv);
719 if (tmp->arch!=NULL) 722 if (arch!=NULL)
720 copy_object(&tmp->arch->clone,tmp); 723 tmp = arch_to_object (arch);
721 else { 724 else {
725 tmp = get_object ();
722 if (tmp->name) free_string(tmp->name); 726 if (tmp->name) free_string(tmp->name);
723 /* record the name of the broken object */ 727 /* record the name of the broken object */
724 tmp->name = add_string(yv); 728 tmp->name = add_string(yv);
725 } 729 }
726 strcpy(msgbuf, ""); 730 strcpy(msgbuf, "");
737 /* This is the actual archetype definition then */ 741 /* This is the actual archetype definition then */
738 else { 742 else {
739 char *yv=yval(); 743 char *yv=yval();
740 744
741 op->arch=find_archetype(yv); 745 op->arch=find_archetype(yv);
742 if (op->arch!=NULL) copy_object(&op->arch->clone,op); 746 if (op->arch!=NULL) {
743 else if (!arch_init) { 747 copy_object(&op->arch->clone,op);
748 op->instantiate ();
749 } else if (!arch_init) {
744 if (op->name) free_string(op->name); 750 if (op->name) free_string(op->name);
745 /* record the name of the broken object */ 751 /* record the name of the broken object */
746 op->name = add_string(yv); 752 op->name = add_string(yv);
747 } 753 }
748 } 754 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines