Difference for server/shop.c from version 1.18 to 1.19


version 1.18 version 1.19
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_shop_c =   * static char *rcsid_shop_c =
  *   "$Id: shop.c,v 1.18 2003/01/09 20:22:11 garbled Exp $";   *   "$Id: shop.c,v 1.19 2003/01/17 06:23:55 mwedel Exp $";
  */   */
   
 /*  /*
Line 658
 
Line 658
   
 void shop_listing(object *op)  void shop_listing(object *op)
 {  {
     int i,j,numitems=0,numallocated=0;      int i,j,numitems=0,numallocated=0, nx, ny;
       char *map_mark = (char *) calloc(MAGIC_MAP_SIZE * MAGIC_MAP_SIZE,1);
     object *stack;      object *stack;
     shopinv *items;      shopinv *items;
   
Line 667
 
Line 668
   
     new_draw_info(NDI_UNIQUE, 0, op, "\nThe shop contains:");      new_draw_info(NDI_UNIQUE, 0, op, "\nThe shop contains:");
   
       magic_mapping_mark(op, map_mark, 3);
     items=malloc(40*sizeof(shopinv));      items=malloc(40*sizeof(shopinv));
     numallocated=40;      numallocated=40;
   
     /* Find all the appropriate items */      /* Find all the appropriate items */
     for (i=0; i<MAP_WIDTH(op->map); i++) {      for (i=0; i<MAP_WIDTH(op->map); i++) {
  for (j=0; j<MAP_HEIGHT(op->map); j++) {   for (j=0; j<MAP_HEIGHT(op->map); j++) {
        /* magic map code now centers the map on the object at MAGIC_MAP_HALF.
         *
         */
        nx = i - op->x + MAGIC_MAP_HALF;
        ny = j - op->y + MAGIC_MAP_HALF;
        /* unlikely, but really big shops could run into this issue */
        if (nx < 0 || ny < 0 || nx > MAGIC_MAP_SIZE || ny > MAGIC_MAP_SIZE) continue;
   
        if (map_mark[nx + MAGIC_MAP_SIZE * ny] & FACE_FLOOR) {
      stack = get_map_ob(op->map, i, j);       stack = get_map_ob(op->map, i, j);
   
      while (stack) {       while (stack) {
  if (QUERY_FLAG(stack, FLAG_UNPAID)) {   if (QUERY_FLAG(stack, FLAG_UNPAID)) {
      if (numitems==numallocated) {       if (numitems==numallocated) {
Line 686
 
Line 698
      }       }
  }   }
     }      }
       }
       free(map_mark);
     if (numitems == 0) {      if (numitems == 0) {
  new_draw_info(NDI_UNIQUE, 0, op, "The shop is currently empty.\n");   new_draw_info(NDI_UNIQUE, 0, op, "The shop is currently empty.\n");
  free(items);   free(items);


Legend:
line(s) removed in v.1.18 
line(s) changed
 line(s) added in v.1.19

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