ASCII Pfiles and load_char()

From: Tony Robbins (tonyr@pacific101.com)
Date: 05/04/99


When I installed ASCII Pfiles into my MUD, I ran into errors with various
sections of code due to the fact that the character structure was not being
CREATE'd or clear_char()'d.  Now I went into load_char() and added this:

  if (ch == NULL) {
    CREATE(ch, struct char_data, 1);
    clear_char(ch);
    CREATE(ch->player_specials, struct player_special_data, 1); /* I think
*/
  }

In theory, it would allocate memory if necessary, in actuality, it does not.
load_char() goes through and does a successful return, but once I'm back in
the calling function (do_last, for example), the char_data structure has
been NULL'd again.

Is there a way I can make the if() check inside load_char() work as kind of
a blanket check?  I just found it odd that the allocated memory would vanish
at the end of the function.

-K.


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