[CODE] Obj stacking problems

From: Phillip A Ames (kirk47@juno.com)
Date: 03/21/99

OK, I got bored this morning and decided to cut down on complaints by a
lot of people about the spam they get when looking at the people who
hoard eq.  So, I added a bit of code to look_at_char, trying to make the
objects stack, and am having a bit of trouble with it.  When I look at a
char(who has 5 of the exact same obj in his inventory) no eq shows up...
I've put a comment where the stacking code starts, and ends...  If anyone
can tell me what I might be doing wrong, I'd be appreciative....  I'm
running BPL14 if it makes a difference.

void look_at_char(struct char_data * i, struct char_data * ch)
  int j, found, num;
  struct obj_data *tmp_obj, *nxt_obj;

  if (!ch->desc)

   if (i->player.description)
    send_to_char(i->player.description, ch);
    act("You see nothing special about $m.", FALSE, i, 0, ch, TO_VICT);

  diag_char_to_char(i, ch);

  found = FALSE;
  for (j = 0; !found && j < NUM_WEARS; j++)
    if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j)))
      found = TRUE;

  if (found) {
    act("\r\n$n is using:", FALSE, i, 0, ch, TO_VICT);
    for (j = 0; j < NUM_WEARS; j++)
      if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j))) {
        send_to_char(where[j], ch);
        show_obj_to_char(GET_EQ(i, j), ch, 1);
  if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) {
    found = FALSE;
    act("\r\nYou attempt to peek at $s inventory:", FALSE, i, 0, ch,
    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))) {
/* Begin stacking */
   for(nxt_obj = tmp_obj; nxt_obj; nxt_obj = nxt_obj->next_content) {

     if(nxt_obj->item_number == NOTHING){
        if(strcmp(nxt_obj->short_description, tmp_obj->short_description)
== 0)

else if (nxt_obj->item_number==tmp_obj->item_number) break;
      if (nxt_obj!=tmp_obj) continue;
      for (nxt_obj = tmp_obj; nxt_obj; nxt_obj = nxt_obj->next_content)

if (nxt_obj->item_number==NOTHING) {

else if (nxt_obj->item_number==tmp_obj->item_number)
      if (CAN_SEE_OBJ(ch, tmp_obj)) {

if (num!=1) {
  sprintf(buf,"[%2i ] ",num);
  strcat(buf, tmp_obj->short_description);
  send_to_char(buf, ch);
/*              End stacking                */

/*        show_obj_to_char(tmp_obj, ch, 1); */
        found = TRUE;

    if (!found)
      send_to_char("You can't see anything.\r\n", ch);


Phillip Ames    | Implementor of Apocalypse MUD
kirk47@juno.com | telnet://oberon.krans.com:1701
ICQ: 8778335    | AOL IM: Grathol

You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]

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

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