Re: d->character being Null?!

From: Kras Kresh (kras_kresh@hotmail.com)
Date: 03/19/02


>From: Templar Viper <templarviper@HOTMAIL.COM>

>That's weird, how can that variable can be empty? It's in the function
>nanny(), the non-player handler. What's even more weird, is that you can
>perfectly use the menu logging in at first, but when you begin playing,
>quit, and reenter the game (Or any other procedure where character is being
>called), the mud chrashes.


Basically, you free'd d->character when he quit. free'd as in
free_char(d->character) or free(d->character) somewhere in your code.
You should check your extract_char_final() or extract_char() function
and your do_quit() function because those are the most likely places.
It should only be elsewhere if you call some function to free it in one
of those functions.

For your reference, the following is what should appear at end of
extract_char_final() if your mud is updated, else in extract_char().

  if (IS_NPC(ch)) {
    if (GET_MOB_RNUM(ch) != NOTHING)    /* prototyped */
      mob_index[GET_MOB_RNUM(ch)].number--;
    clearMemory(ch);
  } else {
    save_char(ch);
    Crash_delete_crashfile(ch);
  }

  /* If there's a descriptor, they're in the menu now. */
  if (IS_NPC(ch) || !ch->desc)
    free_char(ch);

Mine is a little bit older than the newest:

  if (IS_NPC(ch)) {
    if (GET_MOB_RNUM(ch) >= 0)         /* prototyped */
      mob_index[GET_MOB_RNUM(ch)].number--;
    clearMemory(ch);
    free_char(ch);
  } else {
    save_char(ch);
    Crash_delete_crashfile(ch);
    /* Don't free, we're a player in the menu now. */
  }


_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT