Difference for server/shop.c from version 1.15 to 1.16


version 1.15 version 1.16
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_shop_c =   * static char *rcsid_shop_c =
  *   "$Id: shop.c,v 1.15 2002/11/13 04:57:32 garbled Exp $";   *   "$Id: shop.c,v 1.16 2002/12/03 07:40:18 mwedel Exp $";
  */   */
   
 /*  /*
Line 624
 
Line 624
   
     CLEAR_FLAG(tmp, FLAG_UNPAID);      CLEAR_FLAG(tmp, FLAG_UNPAID);
     items[*numitems].nrof=tmp->nrof;      items[*numitems].nrof=tmp->nrof;
       /* Non mergable items have nrof of 0, but count them as one
        * so the display is properly.
        */
       if (tmp->nrof == 0) items[*numitems].nrof++;
     items[*numitems].type=tmp->type;      items[*numitems].type=tmp->type;
   
     switch (tmp->type) {      switch (tmp->type) {
   #if 0
    case BOOTS:
    case GLOVES:
  case RING:   case RING:
  case AMULET:   case AMULET:
  case BRACERS:   case BRACERS:
  case BOOTS:  
  case GLOVES:  
  case GIRDLE:   case GIRDLE:
      sprintf(buf,"%s %s",query_base_name(tmp,0),describe_item(tmp, NULL));       sprintf(buf,"%s %s",query_base_name(tmp,0),describe_item(tmp, NULL));
      items[*numitems].item_sort = strdup_local(buf);       items[*numitems].item_sort = strdup_local(buf);
Line 639
 
Line 644
      items[*numitems].item_real = strdup_local(buf);       items[*numitems].item_real = strdup_local(buf);
      (*numitems)++;       (*numitems)++;
      break;       break;
   #endif
   
  default:   default:
      items[*numitems].item_sort = strdup_local(query_base_name(tmp, 0));       items[*numitems].item_sort = strdup_local(query_base_name(tmp, 0));
      items[*numitems].item_real = strdup_local(query_name(tmp));       items[*numitems].item_real = strdup_local(query_base_name(tmp, 1));
      (*numitems)++;       (*numitems)++;
      break;       break;
     }      }
Line 694
 
Line 700
     qsort(items, numitems, sizeof(shopinv), (int (*)())shop_sort);      qsort(items, numitems, sizeof(shopinv), (int (*)())shop_sort);
   
     for (i=0; i<numitems; i++) {      for (i=0; i<numitems; i++) {
  new_draw_info(NDI_UNIQUE, 0, op, items[i].item_real);   /* Collapse items of the same name together */
    if ((i+1)<numitems && !strcmp(items[i].item_real, items[i+1].item_real)) {
        items[i+1].nrof += items[i].nrof;
  free(items[i].item_sort);   free(items[i].item_sort);
  free(items[i].item_real);   free(items[i].item_real);
    } else {
        new_draw_info_format(NDI_UNIQUE, 0, op, "%d %s",
    items[i].nrof? items[i].nrof:1,
    items[i].nrof==1?items[i].item_sort: items[i].item_real);
        free(items[i].item_sort);
        free(items[i].item_real);
    }
     }      }
     free(items);      free(items);
 }  }


Legend:
line(s) removed in v.1.15 
line(s) changed
 line(s) added in v.1.16

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