Bug in 'combinig objects when looking code'

From: Carlos Rodriguez (crodrigu@academ01.chs.itesm.mx)
Date: 07/12/96


 Anyone has implemented the 'combining objects when looking code' that 
was posted here in the list? Wll, I have, and it gives me this bug:

  Sometimes, when I look at someone's inventory, some objects will be 
listed twice. For example:

>  You try to peek at his inventory:
>    a guard's chain mail hauberk
>    a guard's chain mail hauberk

 However, when the character sees his inventory the item is listed only 
once!

 I've noticed that this happens when I give something to someone or when 
someone stops wearing the item (but not when someone uses 'remove all'). 
Anyone else has experienced this? How can I fix the bug? I've looked 
everywhere but I still don't know what is causing the problem...


----------------------- Time for some code ------------------------------

In act.informative.c:
------------------------------------
in list_obj_to_char
-----------------------------------

void list_obj_to_char(struct obj_data * list, struct char_data * ch, int mode,
                           bool show)
{
  struct obj_data *i, *j;
  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 (j->item_number==NOTHING) {
         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) num++;

    if (CAN_SEE_OBJ(ch, i)) {
      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);
}

----------------------------------------
in look_at_char
----------------------------------------

 if (ch != i && (GET_CLASS(ch) == CLASS_THIEF || GET_LEVEL(ch) >= LVL_IMMORT)) {
   found = FALSE;
   act("\r\nYou peek at $s inventory:", FALSE, i, 0, ch, TO_VICT);
        list_obj_to_char(i->carrying, ch, 1, TRUE);
        found = TRUE;
    for (tmp_obj = i->carrying; tmp_obj; tmp_obj = tmp_obj->next_content) 
{
      if (CAN_SEE_OBJ(ch, tmp_obj) && (number(0, 20) < GET_LEVEL(ch))) {
        show_obj_to_char(tmp_obj, ch, 1);
        found = TRUE;
      }
    }



------------------------------------------------------------------------------
  Visita Agharti!!!                 |             	    Carlos Rodriguez
    http://wwww.chs.itesm.mx:8080/  |		crodrigu@campus.chs.itesm.mx
    crodrigu/Agharti/		    |		webadmin@campus.chs.itesm.mx
				    |  http://www.chs.itesm.mx:8080/crodrigu/
------------------------------------------------------------------------------
 



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