Difference for common/treasure.c from version 1.38 to 1.39


version 1.38 version 1.39
Line 1
 
Line 1
   
 /*  /*
  * static char *rcs_treasure_c =   * static char *rcs_treasure_c =
  *   "$Id: treasure.c,v 1.38 2003/09/04 06:25:32 temitchell Exp $";   *   "$Id: treasure.c,v 1.39 2003/09/13 05:01:30 mwedel Exp $";
  */   */
   
 /*  /*
Line 41
 
Line 41
    
 #include <global.h>  #include <global.h>
 #include <treasure.h>  #include <treasure.h>
 #include <spellist.h>  
 #include <funcpoint.h>  #include <funcpoint.h>
 #include <loader.h>  #include <loader.h>
   
Line 102
 
Line 101
  * into an internal treasure structure (very linked lists)   * into an internal treasure structure (very linked lists)
  */   */
   
 static treasure *load_treasure(FILE *fp) {  static treasure *load_treasure(FILE *fp, int *line) {
   char buf[MAX_BUF], *cp, variable[MAX_BUF];    char buf[MAX_BUF], *cp, variable[MAX_BUF];
   treasure *t=get_empty_treasure();    treasure *t=get_empty_treasure();
   int value;    int value;
   
   nroftreasures++;    nroftreasures++;
   while(fgets(buf,MAX_BUF,fp)!=NULL) {    while(fgets(buf,MAX_BUF,fp)!=NULL) {
    (*line)++;
   
     if(*buf=='#')      if(*buf=='#')
       continue;        continue;
     if((cp=strchr(buf,'\n'))!=NULL)      if((cp=strchr(buf,'\n'))!=NULL)
       *cp='\0';        *cp='\0';
     cp=buf;      cp=buf;
     while(*cp==' ') /* Skip blanks */   while(isspace(*cp)) /* Skip blanks */
       cp++;        cp++;
   
     if(sscanf(cp,"arch %s",variable)) {      if(sscanf(cp,"arch %s",variable)) {
       if((t->item=find_archetype(variable))==NULL)        if((t->item=find_archetype(variable))==NULL)
         LOG(llevError,"Treasure lacks archetype: %s\n",variable);          LOG(llevError,"Treasure lacks archetype: %s\n",variable);
Line 134
 
Line 136
     else if(sscanf(cp,"magic %d",&value))      else if(sscanf(cp,"magic %d",&value))
       t->magic=(uint8) value;        t->magic=(uint8) value;
     else if(!strcmp(cp,"yes"))      else if(!strcmp(cp,"yes"))
       t->next_yes=load_treasure(fp);       t->next_yes=load_treasure(fp, line);
     else if(!strcmp(cp,"no"))      else if(!strcmp(cp,"no"))
       t->next_no=load_treasure(fp);       t->next_no=load_treasure(fp, line);
     else if(!strcmp(cp,"end"))      else if(!strcmp(cp,"end"))
       return t;        return t;
     else if(!strcmp(cp,"more")) {      else if(!strcmp(cp,"more")) {
       t->next=load_treasure(fp);       t->next=load_treasure(fp, line);
       return t;        return t;
     } else      } else
       LOG(llevError,"Unknown treasure-command: '%s', last entry %s\n",cp,t->name?t->name:"null");       LOG(llevError,"Unknown treasure-command: '%s', last entry %s, line %d\n",
    cp,t->name?t->name:"null", *line);
   }    }
   LOG(llevError,"treasure lacks 'end'.\n");    LOG(llevError,"treasure lacks 'end'.\n");
   return t;    return t;
Line 179
 
Line 182
   char filename[MAX_BUF], buf[MAX_BUF], name[MAX_BUF];    char filename[MAX_BUF], buf[MAX_BUF], name[MAX_BUF];
   treasurelist *previous=NULL;    treasurelist *previous=NULL;
   treasure *t;    treasure *t;
   int comp;      int comp, line=0;
   
   sprintf(filename,"%s/%s",settings.datadir,settings.treasures);    sprintf(filename,"%s/%s",settings.datadir,settings.treasures);
   if((fp=open_and_uncompress(filename,0,&comp))==NULL) {    if((fp=open_and_uncompress(filename,0,&comp))==NULL) {
Line 187
 
Line 190
     return;      return;
   }    }
   while(fgets(buf,MAX_BUF,fp)!=NULL) {    while(fgets(buf,MAX_BUF,fp)!=NULL) {
    line++;
       if(*buf=='#')        if(*buf=='#')
       continue;        continue;
   
     if(sscanf(buf,"treasureone %s\n",name) || sscanf(buf,"treasure %s\n",name)) {      if(sscanf(buf,"treasureone %s\n",name) || sscanf(buf,"treasure %s\n",name)) {
       treasurelist *tl=get_empty_treasurelist();        treasurelist *tl=get_empty_treasurelist();
       tl->name=add_string(name);        tl->name=add_string(name);
Line 197
 
Line 202
       else        else
         previous->next=tl;          previous->next=tl;
       previous=tl;        previous=tl;
       tl->items=load_treasure(fp);       tl->items=load_treasure(fp, &line);
   
       /* This is a one of the many items on the list should be generated.        /* This is a one of the many items on the list should be generated.
        * Add up the chance total, and check to make sure the yes & no         * Add up the chance total, and check to make sure the yes & no
        * fields of the treasures are not being used.         * fields of the treasures are not being used.
Line 213
 
Line 219
 #endif  #endif
    tl->total_chance += t->chance;     tl->total_chance += t->chance;
  }   }
 #if 0  
         LOG(llevDebug, "Total chance for list %s is %d\n", tl->name, tl->total_chance);  
 #endif  
       }        }
     } else      } else
       LOG(llevError,"Treasure-list didn't understand: %s\n",buf);       LOG(llevError,"Treasure-list didn't understand: %s, line %d\n",buf, line);
   }    }
   close_and_delete(fp, comp);    close_and_delete(fp, comp);
   
Line 274
 
Line 277
 {  {
     object *tmp;      object *tmp;
   
     if (flags & GT_ENVIRONMENT) {      /* Bit of a hack - spells should never be put onto the map.  The entire
        * treasure stuff is a problem - there is no clear idea of knowing
        * this is the original object, or if this is an object that should be created
        * by another object.
        */
       if (flags & GT_ENVIRONMENT && op->type != SPELL) {
         op->x = creator->x;          op->x = creator->x;
         op->y = creator->y;          op->y = creator->y;
  SET_FLAG(op, FLAG_OBJ_ORIGINAL);   SET_FLAG(op, FLAG_OBJ_ORIGINAL);
Line 351
 
Line 359
     int value = RANDOM() % tl->total_chance;      int value = RANDOM() % tl->total_chance;
     treasure *t;      treasure *t;
   
     if (tries++>100) return;      if (tries++>100) {
    LOG(llevDebug,"create_one_treasure: tries exceeded 100, returning without making treasure\n");
    return;
       }
     for (t=tl->items; t!=NULL; t=t->next) {      for (t=tl->items; t!=NULL; t=t->next) {
  value -= t->chance;   value -= t->chance;
  if (value<0) break;   if (value<0) break;
Line 391
 
Line 402
  int tries)   int tries)
 {  {
   
     if (tries++>100) return;      if (tries++>100) {
    LOG(llevDebug,"createtreasure: tries exceeded 100, returning without making treasure\n");
    return;
       }
     if (t->total_chance)       if (t->total_chance)
  create_one_treasure(t, op, flag,difficulty, tries);   create_one_treasure(t, op, flag,difficulty, tries);
     else      else
Line 463
 
Line 477
   {  0, 0, 0, 0,100}, /*31*/    {  0, 0, 0, 0,100}, /*31*/
 };  };
   
   
 /* calculate the appropriate level for wands staves and scrolls.  If  /* calculate the appropriate level for wands staves and scrolls.  If
    retmult is 1, return the multiplier, not the level, for computing value */   * retmult is 1, return the multiplier, not the level, for computing value
    * This code presumes that op has had its spell object created (in op->inv)
    */
   
 int level_for_item(object *op, int difficulty, int retmult)  int level_for_item(object *op, int difficulty, int retmult)
 {  {
     int level, mult, olevel;      int level, mult, olevel;
   
     mult = 0;      mult = 0;
     level = spells[op->stats.sp].level;      if (!op->inv) {
     if (SP_PARAMETERS[op->stats.sp].ldam != 0)   LOG(llevError,"level_for_item: Object %s has no inventory!\n", op->name);
  mult = SP_PARAMETERS[op->stats.sp].ldam;   return 0;
     if (SP_PARAMETERS[op->stats.sp].ldur > SP_PARAMETERS[op->stats.sp].ldam &&      }
  SP_PARAMETERS[op->stats.sp].ldur != 0)      level = op->inv->level;
  mult = SP_PARAMETERS[op->stats.sp].ldur;  
       /* Basically, we set mult to the lowest spell increase attribute that is
        * not zero - zero's mean no modification is done, so we don't want those.
        * given we want non zero results, we can't just use a few MIN's here.
        */
       mult = op->inv->dam_modifier;
       if (op->inv->range_modifier && (op->inv->range_modifier<mult || mult == 0))
    mult = op->inv->range_modifier;
       if (op->inv->duration_modifier && (op->inv->duration_modifier < mult || mult==0))
    mult = op->inv->duration_modifier;
   
     if (mult == 0)      if (mult == 0)
  mult = 5;   mult = 5;
   
     if (retmult)      if (retmult)
  return mult;   return mult;
   
     if (difficulty * mult > 100)      olevel = mult * rndm(0, difficulty) + level;
  difficulty = 100/mult;      if (olevel > MAXLEVEL) olevel = MAXLEVEL;
     olevel = mult * rndm(1, difficulty);  
   
     if (olevel > level)  
  return olevel;   return olevel;
     return level;  
 }  }
   
 /*  /*
Line 731
 
Line 755
 void fix_generated_item (object *op, object *creator, int difficulty,  void fix_generated_item (object *op, object *creator, int difficulty,
                          int max_magic, int flags)                           int max_magic, int flags)
 {  {
     int was_magic = op->magic, num_enchantments=0, save_item_power, mult;      int was_magic = op->magic, num_enchantments=0, save_item_power;
   
     if(!creator||creator->type==op->type) creator=op; /*safety & to prevent polymorphed      if(!creator||creator->type==op->type) creator=op; /*safety & to prevent polymorphed
  * objects giving attributes */    * objects giving attributes */
Line 740
 
Line 764
     save_item_power = op->item_power;      save_item_power = op->item_power;
     op->item_power = 0;      op->item_power = 0;
   
       if (op->randomitems && op->type != SPELL) {
    create_treasure(op->randomitems, op,flags ,difficulty, 0);
    if (!op->inv) LOG(llevDebug,"fix_generated_item: Unable to generate treasure for %s\n",
      op->name);
       }
   
     if (difficulty<1) difficulty=1;      if (difficulty<1) difficulty=1;
     if (op->arch == crown_arch) {      if (op->arch == crown_arch) {
  set_magic(difficulty>25?30:difficulty+5, op, max_magic, flags);   set_magic(difficulty>25?30:difficulty+5, op, max_magic, flags);
Line 803
 
Line 833
      case POTION: {       case POTION: {
  int too_many_tries=0,is_special=0;   int too_many_tries=0,is_special=0;
   
  while(!(is_special=special_potion(op)) && !op->stats.sp) {   while(!(is_special=special_potion(op)) && !op->inv) {
      generate_artifact(op,difficulty);       generate_artifact(op,difficulty);
      if(too_many_tries++ > 10) break;       if(too_many_tries++ > 10) break;
  }   }
  if(!is_special) {    if (op->inv) {
      int nrof_potion=spells[op->stats.sp].scrolls-RANDOM()%3;  
      /* these 'potions' have been generated as artifacts   
       * and therefore need a few adjustments   
       */   
      /* give fewer potions than scrolls */  
      if(nrof_potion>0)  
  op->nrof=RANDOM()%(nrof_potion)+1;  
      /* value multiplier is same as for scrolls */       /* value multiplier is same as for scrolls */
      op->value=(op->value*spells[op->stats.sp].level)/       op->value=(op->value*op->inv->value);
  (spells[op->stats.sp].level+4);       op->level = op->inv->level/2+ RANDOM()%difficulty + RANDOM()%difficulty;
    } else {
        FREE_AND_COPY(op->name, "potion");
        FREE_AND_COPY(op->name_pl, "potions");
  }   }
    if ( ! (flags & GT_ONLY_GOOD) && RANDOM() % 2)
        SET_FLAG(op, FLAG_CURSED);
  break;    break;
      }       }
   
Line 887
 
Line 915
  break;   break;
   
      case SPELLBOOK:       case SPELLBOOK:
  if (op->slaying && (op->stats.sp = look_up_spell_name (op->slaying)) >= 0) {   op->value=op->value* op->inv->value;
      free_string (op->slaying);  
      op->slaying = NULL;  
  }  
  else if(!strcmp(op->arch->name,"cleric_book"))   
      do {   
  op->stats.sp=RANDOM()%NROFREALSPELLS;  
      } while((RANDOM()%10>=spells[op->stats.sp].books) || !spells[op->stats.sp].cleric);  
  else do {  
      op->stats.sp=RANDOM()%NROFREALSPELLS;  
  } while((RANDOM()%10>=spells[op->stats.sp].books) || spells[op->stats.sp].cleric);  
   
  op->value=(op->value*spells[op->stats.sp].level)/(spells[op->stats.sp].level+4);  
  change_book(op,-1);  
   
  /* add exp so learning gives xp */   /* add exp so learning gives xp */
  op->level = spells[op->stats.sp].level;   op->level = op->inv->level;
  op->stats.exp = op->value;   op->stats.exp = op->value;
  break;   break;
   
      case WAND:       case WAND:
  do    /* nrof in the treasure list is number of charges,
      op->stats.sp=rndm(0, NROFREALSPELLS-1);   * not number of wands.  So copy that into food (charges),
  while (!spells[op->stats.sp].charges|| spells[op->stats.sp].level>DICESPELL);   * and reset nrof.
    */
  if (spells[op->stats.sp].cleric) {   op->stats.food=op->inv->nrof;
      /* Make the wand into a staff */   op->nrof=1;
      short i = op->stats.sp;   /* If the spell changes by level, choose a random level
      if (staff_arch == NULL)   * for it, and adjust price.  If the spell doesn't
  staff_arch = find_archetype("staff");   * change by level, just set the wand to the level of
      copy_object(&staff_arch->clone, op);   * the spell, and value calculation is simpler.
      op->stats.sp = i;   */
  }   if (op->inv->duration_modifier || op->inv->dam_modifier ||
  op->stats.food=rndm(1, spells[op->stats.sp].charges);     op->inv->range_modifier) {
  op->level = level_for_item(op, difficulty, 0);   op->level = level_for_item(op, difficulty, 0);
  mult = level_for_item(op, difficulty, 1);       op->value= op->value* op->inv->value * (op->level +50)/
  op->value += ((op->level - spells[op->stats.sp].level)/mult) *   (op->inv->level + 50);
      (op->value/(20/mult));   }
    else {
        op->level = op->inv->level;
        op->value = op->value * op->inv->value;
    }
  break;   break;
   
      case ROD:       case ROD:
  if (op->stats.maxhp)   if (op->stats.maxhp)
      op->stats.maxhp += rndm(0, op->stats.maxhp-1);       op->stats.maxhp += rndm(0, op->stats.maxhp-1);
  op->stats.hp = op->stats.maxhp;   op->stats.hp = op->stats.maxhp;
  do  
      op->stats.sp = rndm(0, NROFREALSPELLS-1);  
  while (!spells[op->stats.sp].charges||  
         spells[op->stats.sp].sp > op->stats.maxhp ||  
         spells[op->stats.sp].level>DICESPELL);  
  mult = level_for_item(op, difficulty, 1);  
  op->level = level_for_item(op, difficulty, 0);   op->level = level_for_item(op, difficulty, 0);
  op->value += ((op->level - spells[op->stats.sp].level)/mult *   /* Add 50 to both level an divisor to keep prices a little more
        op->stats.hp) * (op->value/(20/mult));   * reasonable.  Otherwise, a high level version of a low level
    * spell can be worth tons a money (eg, level 20 rod, level 2 spell =
    * 10 time multiplier).  This way, the value are a bit more reasonable.
    */
    op->value= op->value * op->inv->value * (op->level +50) / (op->inv->level + 50);
  break;   break;
   
      case SCROLL:       case SCROLL:
  do  
      op->stats.sp=rndm(0, NROFREALSPELLS-1);  
  while (!spells[op->stats.sp].scrolls || spells[op->stats.sp].scroll_chance<=RANDOM()%10);  
   
  op->nrof=rndm(1, spells[op->stats.sp].scrolls);  
  mult = level_for_item(op, difficulty, 1);  
  op->level = level_for_item(op, difficulty, 0);   op->level = level_for_item(op, difficulty, 0);
  op->value += ((op->level - spells[op->stats.sp].level)/mult) *   op->value= op->value * op->inv->value * (op->level +50) / (op->inv->level + 50);
      (op->value/(20/mult));  
   
  /* add exp so reading them properly gives xp */    /* add exp so reading them properly gives xp */
  op->stats.exp = op->value/5;   op->stats.exp = op->value/5;
    op->nrof = op->inv->nrof;
  break;   break;
   
      case RUNE:       case RUNE:
Line 966
 
Line 975
  break;   break;
  } /* switch type */   } /* switch type */
   
     if (op->type == POTION && special_potion(op)) {  
  /*if(op->face==blank_face) op->face = potion_face;*/  
  FREE_AND_COPY(op->name, "potion");  
  FREE_AND_COPY(op->name_pl, "potions");  
   
  op->level = spells[op->stats.sp].level/2+ RANDOM()%difficulty + RANDOM()%difficulty;  
  if ( ! (flags & GT_ONLY_GOOD) && RANDOM() % 2)  
      SET_FLAG(op, FLAG_CURSED);  
     }  
   
     if (flags & GT_STARTEQUIP) {      if (flags & GT_STARTEQUIP) {
  if (op->nrof < 2 && op->type != CONTAINER   if (op->nrof < 2 && op->type != CONTAINER
      && op->type != MONEY && ! QUERY_FLAG (op, FLAG_IS_THROWN))       && op->type != MONEY && ! QUERY_FLAG (op, FLAG_IS_THROWN))
Line 1181
 
Line 1180
       nrofartifacts++;        nrofartifacts++;
       cp = strchr(cp,' ') + 1;        cp = strchr(cp,' ') + 1;
       if (!strcmp(cp,"all")) continue;        if (!strcmp(cp,"all")) continue;
   
       do {        do {
  nrofallowedstr++;   nrofallowedstr++;
  if ((next=strchr(cp, ','))!=NULL)   if ((next=strchr(cp, ','))!=NULL)
Line 1249
 
Line 1249
   }    }
   for (i = 0; i < 7; i++)    for (i = 0; i < 7; i++)
     change_attr_value(&(op->stats), i, get_attr_value(&(change->stats), i));      change_attr_value(&(op->stats), i, get_attr_value(&(change->stats), i));
   if (QUERY_FLAG(change,FLAG_CURSED))  
     SET_FLAG(op, FLAG_CURSED);  
   if (QUERY_FLAG(change,FLAG_DAMNED))  
     SET_FLAG(op, FLAG_DAMNED);  
   if ((QUERY_FLAG(change,FLAG_CURSED) || QUERY_FLAG(change,FLAG_DAMNED))  
  && op->magic > 0)  
     set_abs_magic(op, -op->magic);  
   op->attacktype |= change->attacktype;    op->attacktype |= change->attacktype;
   op->path_attuned |= change->path_attuned;    op->path_attuned |= change->path_attuned;
   op->path_repelled |= change->path_repelled;    op->path_repelled |= change->path_repelled;
   op->path_denied |= change->path_denied;    op->path_denied |= change->path_denied;
   op->stats.luck += change->stats.luck;    op->stats.luck += change->stats.luck;
   if (QUERY_FLAG(change,FLAG_LIFESAVE))  
     SET_FLAG(op,FLAG_LIFESAVE);      if (QUERY_FLAG(change,FLAG_CURSED))     SET_FLAG(op, FLAG_CURSED);
   if (QUERY_FLAG(change,FLAG_REFL_SPELL))      if (QUERY_FLAG(change,FLAG_DAMNED))     SET_FLAG(op, FLAG_DAMNED);
     SET_FLAG(op,FLAG_REFL_SPELL);      if ((QUERY_FLAG(change,FLAG_CURSED) || QUERY_FLAG(change,FLAG_DAMNED))
   if (QUERY_FLAG(change,FLAG_STEALTH))   && op->magic > 0)
     SET_FLAG(op,FLAG_STEALTH);   set_abs_magic(op, -op->magic);
   if (QUERY_FLAG(change,FLAG_FLYING))  
     SET_FLAG(op,FLAG_FLYING);      if (QUERY_FLAG(change,FLAG_LIFESAVE)) SET_FLAG(op,FLAG_LIFESAVE);
   if (QUERY_FLAG(change,FLAG_XRAYS))      if (QUERY_FLAG(change,FLAG_REFL_SPELL)) SET_FLAG(op,FLAG_REFL_SPELL);
     SET_FLAG(op,FLAG_XRAYS);      if (QUERY_FLAG(change,FLAG_STEALTH)) SET_FLAG(op,FLAG_STEALTH);
   if (QUERY_FLAG(change,FLAG_BLIND))      if (QUERY_FLAG(change,FLAG_FLYING)) SET_FLAG(op,FLAG_FLYING);
     SET_FLAG(op,FLAG_BLIND);      if (QUERY_FLAG(change,FLAG_XRAYS)) SET_FLAG(op,FLAG_XRAYS);
   if (QUERY_FLAG(change,FLAG_SEE_IN_DARK))      if (QUERY_FLAG(change,FLAG_BLIND)) SET_FLAG(op,FLAG_BLIND);
     SET_FLAG(op,FLAG_SEE_IN_DARK);      if (QUERY_FLAG(change,FLAG_SEE_IN_DARK))    SET_FLAG(op,FLAG_SEE_IN_DARK);
   if (QUERY_FLAG(change,FLAG_REFL_MISSILE))      if (QUERY_FLAG(change,FLAG_REFL_MISSILE)) SET_FLAG(op,FLAG_REFL_MISSILE);
     SET_FLAG(op,FLAG_REFL_MISSILE);      if (QUERY_FLAG(change,FLAG_MAKE_INVIS))     SET_FLAG(op,FLAG_MAKE_INVIS);
   if (QUERY_FLAG(change,FLAG_MAKE_INVIS))  
     SET_FLAG(op,FLAG_MAKE_INVIS);  
   if (QUERY_FLAG(change,FLAG_STAND_STILL)) {    if (QUERY_FLAG(change,FLAG_STAND_STILL)) {
     CLEAR_FLAG(op,FLAG_ANIMATE);      CLEAR_FLAG(op,FLAG_ANIMATE);
     /*op->speed = 0.0; */  /* why was this done? */   /* so artifacts will join */
     /* It was done so certain artifacts would join. */  
     if(!QUERY_FLAG(op,FLAG_ALIVE)) op->speed = 0.0;      if(!QUERY_FLAG(op,FLAG_ALIVE)) op->speed = 0.0;
     update_ob_speed(op);      update_ob_speed(op);
   }    }
Line 1290
 
Line 1282
   op->stats.exp += change->stats.exp; /* Speed modifier */    op->stats.exp += change->stats.exp; /* Speed modifier */
   op->stats.wc  += change->stats.wc;    op->stats.wc  += change->stats.wc;
   op->stats.ac  += change->stats.ac;    op->stats.ac  += change->stats.ac;
   
       if (change->other_arch) op->other_arch = change->other_arch;
   
   if (change->stats.hp < 0)    if (change->stats.hp < 0)
      op->stats.hp = -change->stats.hp;       op->stats.hp = -change->stats.hp;
   else    else
Line 1387
 
Line 1382
     op->msg = add_refcount(change->msg);      op->msg = add_refcount(change->msg);
   }    }
   /* GROS: Added support for event_... in artifact file */    /* GROS: Added support for event_... in artifact file */
   for(j=0;j<20;j++)      for(j=0;j<20;j++) {
   {  
     event *evt;      event *evt;
     event *evt2;      event *evt2;
     event *evtn;      event *evtn;
Line 1397
 
Line 1391
     evt = find_event(change,j);      evt = find_event(change,j);
     evt2= find_event(op,j);      evt2= find_event(op,j);
   
     if ((evt) && (evt->hook))   if ((evt) && (evt->hook)) {
     {       if ((evt2)&&(evt2->hook)) {
         if ((evt2)&&(evt2->hook))  
         {  
             free_string(evt2->hook);              free_string(evt2->hook);
             free_string(evt2->plugin);              free_string(evt2->plugin);
             free_string(evt2->options);              free_string(evt2->options);
             evtp = NULL;              evtp = NULL;
             evtn = evt2->next;              evtn = evt2->next;
             if (evt2 == op->events)   if (evt2 == op->events) {
             {  
                 free(evt2);                  free(evt2);
                 op->events = evtn;                  op->events = evtn;
             }              }
             else   else {
             {  
                 evtp = op->events;                  evtp = op->events;
                 while (evtp->next != evt2)                  while (evtp->next != evt2)
                     evtp = evtp->next;                      evtp = evtp->next;
Line 1420
 
Line 1410
                 evtp->next = evtn;                  evtp->next = evtn;
             }              }
         }          }
         else if (evt2 == NULL)       else if (evt2 == NULL) {
         {   if (op->events == NULL) {
             if (op->events == NULL)  
             {  
                 evt2 = (event *)malloc(sizeof(event));                  evt2 = (event *)malloc(sizeof(event));
                 op->events = evt2;                  op->events = evt2;
             }              }
             else   else {
             {  
                 evtp = op->events;                  evtp = op->events;
                 while (evtp->next != NULL)                  while (evtp->next != NULL)
                     evtp = evtp->next;                      evtp = evtp->next;
Line 1675
 
Line 1662
     }      }
     free_artifactlist(first_artifactlist);      free_artifactlist(first_artifactlist);
 }  }
   


Legend:
line(s) removed in v.1.38 
line(s) changed
 line(s) added in v.1.39

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:18