<snip>
--- Josh <[EMAIL PROTECTED]> wrote:
> Ok i was playing around with my first descriptor loop(i wanted to see if
an
> id matched any character playing...) and i kept (might be keep, dunno
havent
> had real time to test it) getting segmentation faults.
>
> Not having gdb (don't ask... its broke) i made little functions to test
> things, and one i did tested to see if the d->character was NULL, i was
> surprised when i had a couple NULL characters on my descriptor list.  Did
i
>
> A) delete something i shouldnt have somewhere?
> B) do something wrong?
> C) thats normal to have a couple d->characters on your descriptor_list
NULL
> D) waste your time with a stupid newbie question?
>

This is typical. It occurs when someone has connected to the mud, but has
not
yet been assigned a character.. Like looking at the login prompt, or
whatever.
As long as you make the appropriate tests you won't have any problems.
<snip>

One thing I did with mine, which I'm only using it for my greeting screen,
is I created a CHAR_DATA *ch = new_char(); in my init_descriptor(you can put
yours somewhere else as long as you pass it), then before I use ch, I have
ch->desc = dnew;  And voila, ch is declared.  This is only one suggestion,
tho.  It works for me, no bugs or anything. Also, before exiting
init_descriptor(), I have free_char( ch ); so I free up the memory before
the player is reassigned a new char_data.  Just a thought.


Rheede


PS, if someone has a better way of doin this, or has suggestions, comments,
questions, send me an e-mail please.  Thanks.


Reply via email to