Idle

From: Chris Powell (darkness@AGEOFWAR.ORG)
Date: 11/06/97


On our mud we have it set so you can only quit with so many items.  Now
the problem is when people are extracted for being idle. I made some code
that should count how many items you have then if it is over max_obj_save,
remove it.  Now it crashes on the indicated line and I can not figure out
why.

void Idle_eq_remove(struct char_data *ch, struct obj_data *obj, long *nitems)
{
int numitems = 0;

>>>>>if ((GET_OBJ_TYPE(obj) == ITEM_WEAPON) || <<<<<<  crash here
   (GET_OBJ_TYPE(obj) == ITEM_ARMOR) || (GET_OBJ_TYPE(obj) == ITEM_LIGHT) ||
   (GET_OBJ_TYPE(obj) == ITEM_FIREWEAPON) || (GET_OBJ_TYPE(obj) == ITEM_STAFF) ||
   (GET_OBJ_TYPE(obj) == ITEM_MISSILE) || (GET_OBJ_TYPE(obj) == ITEM_WAND))
{
      (*nitems)++;
      numitems = *nitems;
    if (numitems > max_obj_save)
     extract_obj(obj);
    }
    Idle_eq_remove(ch, obj->contains, nitems);
    Idle_eq_remove(ch, obj->next_content, nitems);
}
GDB Output

GDB 4.16 (i586-unknown-linux), Copyright 1996 Free Software Foundation, Inc...
Core was generated by `bin/circle -q 4002'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libcrypt.so.1...done.
Reading symbols from /lib/ld-linux.so.1...done.
#0  Idle_eq_remove (ch=0x84bcdc8, obj=0x0, nitems=0xbffff78c) at objsave.c:1017
1017    if ((GET_OBJ_TYPE(obj) == ITEM_WEAPON) ||
(gdb)

  ___          _      _
/  _  \   _   / \    / \   Age Of War
| |_| |  / \  | |    | |   Telnet: ageofwar.org 4000
|  _  | | O | | \_/\_/ |   Web page: www.ageofwar.org/~aow
|_| |_|  \_/  \___/\___/   Email: darkness@ageofwar.org


     +------------------------------------------------------------+
     | 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/08/00 PST