[CODE] Stacking probs

From: Chuck (creed@EXIT1.I-55.COM)
Date: 06/29/98


I'm just brewing with questions today eh . . .

Anyhow.  I've just made objects that can have the same vnum, but different
descriptions, and the stacking snippet just doesn't like that.  It just got
the description of the first item in the list and listed it as '(2) an
item' where one item had the s_descr of 'an item' and the other had 'a
super duper thing'.I've tried modifying the list_obj_to_char funtion to
check for same descriptions, and now it just leaves one of the items out
completely.  I've included the entire function below if anyone feels like
taking a gander.

void list_obj_to_char(struct obj_data * list, struct char_data * ch, int mode,
                      bool show)
{
  extern struct index_data *obj_index;
  struct obj_data *i, *j;
  int tangible;
  char buf[10];
  bool found;
  int num;

  found = FALSE;
  for (i = list; i; i = i->next_content) {
     num = 0;
     for (j = list; j != i; j = j->next_content)
        if(strcmp(j->short_description,i->short_description)==0)
           break;
        else if (j->item_number==i->item_number)
           break;
     if (j!=i)
        continue;
     for (j = i; j; j = j->next_content)
        if (j->item_number==NOTHING) {
           if(strcmp(j->short_description,i->short_description)==0)
              num++;
       }else if (j->item_number==i->item_number &&
!strcmp(j->short_description,
                 i->short_description))
           num++;

    tangible = TRUE;
    if(ANTI_OBJ_STAT(i, ANTI_SEE) && GET_LEVEL(ch) < LVL_IMMORTAL)
       tangible = FALSE;
    if (CAN_SEE_OBJ(ch, i) && tangible) {
       if (PRF_FLAGGED(ch, PRF_ROOMFLAGS)) {
          sprintf(buf, "[%5d] ", GET_OBJ_VNUM(i));
          send_to_char(buf, ch);
        }
       if (ANTI_OBJ_STAT(i, ANTI_SEE) && tangible != FALSE)
          send_to_char("(Intangible) ", ch);

       if (num!=1) {
          sprintf(buf,"(%2i) ",num);
          send_to_char(buf,ch);
        }
       show_obj_to_char(i, ch, mode);
       found = TRUE;
     }
    }

    if (!found && show)
    send_to_char(" Nothing.\r\n", ch);
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST