Re: Equipment problem again!

From: Johan Eenfeldt (
Date: 04/14/96

On Sat, 13 Apr 1996 wrote:

> Ok, in response to several people's posts, I've modified the equipment removal
> and deletion function, but I still get core dumps whenever I execute it. 
> Here's the code I have now:
>   /* Remove & delete all objects and equipment */
>   for (i=0; i < NUM_WEARS; i++)
>     if (GET_EQ(ch, i)) obj_from_char(unequip_char(ch, i));
>   for (obj = ch->carrying; obj; obj = next) {
>     next = obj->next;

This is wrong. obj->next points to the next object in the global object list.
What you want is obj->next_content.

>     obj_from_char(obj);
>   } 
> I traced the problem to the REMOVE_FROM_QUEUE function, which is called from

You probably mean REMOVE_FROM_LIST.

> within the obj_from_char function.  The value of the obj pointer is not null, 
> so I am very confused.  Any ideas?

This can be solved much easier as obj_from_char() is actually doing all 
the work for you.
Like this:

while (ch->carrying)

But note that this will only remove the objects from the character's
inventory, not delete (free) the objects themselves. If you want them 
deleted as well, you should change all the obj_from_char() to extract_obj().

/ Johan Eenfeldt
  Student, Computer Science Department @ the University of Uppsala

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