Re: Prolly newbie question

From: Jason Margaritis (jkat@HIGHLANDIL.COM)
Date: 11/09/97


Chris Powell wrote:
>
> I am trying to code it so if a char idles out with more eq the they are
> allowed it will loop through and extract the eq over the limit.  It works
> except it will only extract one object no matter how many over the limit
> they are.
>
> in objsave.c
>
> void Idle_eq_remove(struct char_data *ch, struct obj_data *obj, long *nitems)
> {
> int numitems = 0;
> if (obj) {
> if ((GET_OBJ_TYPE(obj) == ITEM_WEAPON) ||
>    (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);
> }
> }
>
> in limits.c
>
>  else if (ch->char_specials.timer > 48 ) {
>       char_from_room(ch);
>       char_to_room(ch, 1202);
>   for (i = 0; i < NUM_WEARS; i++){
>    if (GET_EQ(ch, i)) {
>       Idle_eq_remove(ch, GET_EQ(ch, i), &numitems);
>       }
>      }
>   Idle_eq_remove(ch, ch->carrying, &numitems);
>   if (ch->in_room != NOWHERE)
>         char_from_room(ch);
>       char_to_room(ch, 3);
>       if (ch->desc)
>         close_socket(ch->desc);
>       ch->desc = NULL;
>
>   ___          _      _
> /  _  \   _   / \    / \   Age Of War
> | |_| |  / \  | |    | |   Telnet: ageofwar.org 4000
> |  _  | | O | | \_/\_/ |   Web page: www.ageofwar.org/~aow
> |_| |_|  \_/  \___/\___/   Email: darkness@ageofwar.org
>

I may be way off on this one, but when I look at this:

      extract_obj(obj);
     }
     Idle_eq_remove(ch, obj->contains, nitems);
     Idle_eq_remove(ch, obj->next_content, nitems);

I wonder if you just extracted the item, you probably shouldn't
refer it it.


     +------------------------------------------------------------+
     | 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