Object Stacking [by Nashak]
Snippet Posted Wednesday, August 12th @ 11:32:33 PM, by George Greer in the Objects dept.
Added Dec 3, 1996. Click the link below to read it or download it.

From: Brian Williams <bmw@efn.org>
Subject: Object Stacking code

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);
}


<< Object Damage [by Andy Hubbard] | Reply | View as text | Threaded | Object Timers [by ?] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.