Difference for server/apply.c from version 1.112 to 1.113


version 1.112 version 1.113
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_apply_c =   * static char *rcsid_apply_c =
  *   "$Id: apply.c,v 1.112 2004/08/17 06:41:04 mwedel Exp $";   *   "$Id: apply.c,v 1.113 2004/10/15 07:09:40 mwedel Exp $";
  */   */
 /*  /*
     CrossFire, A Multiplayer game for X-windows      CrossFire, A Multiplayer game for X-windows
Line 3261
 
Line 3261
  * Generates shop floor's item, and treasures.   * Generates shop floor's item, and treasures.
  */   */
 int auto_apply (object *op) {  int auto_apply (object *op) {
     object *tmp = NULL;      object *tmp = NULL, *tmp2;
     int i;      int i;
   
     switch(op->type) {      switch(op->type) {
Line 3294
 
Line 3294
  op->stats.exp ? (int)op->stats.exp :    op->stats.exp ? (int)op->stats.exp :
  op->map == NULL ?  14: op->map->difficulty,0);   op->map == NULL ?  14: op->map->difficulty,0);
   
      /* If we generated on object and put it in this object inventory,       /* If we generated an object and put it in this object inventory,
       * move it to the parent object as the current object is about        * move it to the parent object as the current object is about
       * to disappear.  An example of this item is the random_* stuff        * to disappear.  An example of this item is the random_* stuff
       * that is put inside other objects.        * that is put inside other objects.
       */        */
      if (op->inv) {       for (tmp=op->inv; tmp; tmp=tmp2) {
  tmp=op->inv;   tmp2 = tmp->below;
  remove_ob(tmp);   remove_ob(tmp);
  if (op->env) insert_ob_in_ob(tmp, op->env);   if (op->env) insert_ob_in_ob(tmp, op->env);
  else free_object(tmp);   else free_object(tmp);
Line 3330
 
Line 3330
      for(tmp=get_map_ob(m,x,y);tmp!=NULL;tmp=above) {       for(tmp=get_map_ob(m,x,y);tmp!=NULL;tmp=above) {
  above=tmp->above;   above=tmp->above;
   
   
  if (tmp->inv) {   if (tmp->inv) {
      object *invtmp, *invnext;       object *invtmp, *invnext;
   
Line 3342
 
Line 3343
  create_treasure(invtmp->randomitems, invtmp, 0,   create_treasure(invtmp->randomitems, invtmp, 0,
  m->difficulty,0);   m->difficulty,0);
  }   }
    else if (invtmp && invtmp->arch &&
    invtmp->type!=TREASURE &&
    invtmp->type != SPELL &&
    HAS_RANDOM_ITEMS(invtmp)) {
        create_treasure(invtmp->randomitems, invtmp, 0,
        m->difficulty,0);
    /* Need to clear this so that we never try to create
    * treasure again for this object
    */
    invtmp->randomitems = NULL;
    }
      }       }
      /* This is really temporary - the code at the bottom will       /* This is really temporary - the code at the bottom will
       * also set randomitems to null.  The problem is there are bunches        * also set randomitems to null.  The problem is there are bunches
Line 3382
 
Line 3394
     tmp->type != SPELL && HAS_RANDOM_ITEMS(tmp)) {      tmp->type != SPELL && HAS_RANDOM_ITEMS(tmp)) {
      create_treasure(tmp->randomitems, tmp, GT_APPLY,       create_treasure(tmp->randomitems, tmp, GT_APPLY,
                             m->difficulty,0);                              m->difficulty,0);
      /* Purely debugging - I've seen crashes in monster_should_cast_spell()  
       * where the monster has a scroll with no inventory - need to figure  
       * out how that is happening.  Observed that it happens on random  
       * maps, which should be covered by this code.  
       */  
      if (tmp->type == SCROLL && !tmp->inv)  
  LOG(llevError,"fix_auto_apply: create treasure failed to create spell for scroll.\n");  
      tmp->randomitems = NULL;       tmp->randomitems = NULL;
        /* Treasure has been created for all the inventory, so clear out
         * their treasurelists also.
         */
        for (above=tmp->inv; above; above=above->below)
    above->randomitems=NULL;
   
  }   }
      }       }
   


Legend:
line(s) removed in v.1.112 
line(s) changed
 line(s) added in v.1.113

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