Man, I tried to go through the code and make life a little easier for
you, but some of those functions are crazy. I more or less stopped
after the 'start_wt' function. There's no reason why you need to
dynamically declare the wordtwist structure at all. You need one simple
struct. I posted some of the the code changes here:
http://members.cox.net/jeremyhill/wordtwist.c
I didn't touch, or barely touched, void do_wtcorrect(CHAR_DATA *ch, char
*argument), void do_guesswt(CHAR_DATA *ch, char *argument), void
do_wordtwist( CHAR_DATA *ch, char *argument ), void announce_wt( void ),
or void wordtwist_cc( CHAR_DATA *ch, char *argument ) because those
functions are way more complicated than necessary.
If you don't see where I'm going with this--trying to make your life
much easier--I suppose I can finish it out.
Davion Kalhen wrote:
On Thu, 26 Aug 2004 10:56:04 -0500 (EST),
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
You never set pWrd->guess_count to 0, so it could be anything. If it
happened to be 1, then this is probably going to coredump when it accesses
pWrd->guesses[i] because you do not call calloc on that until
do_wtcorrect().
&
A lot of people that learned other languages before C (like java) tend to
forget that C will not initialize data for you. You need to set every
variable before you can be sure what it is. Declaring an int does not
mean it will equal 0. It /may/ but it is not guaranteed to be.
With alloc_perm, it uses calloc which 0's everything, no? And free_x
should set it to 0 if its done properly. Orrr, if the new_* is done
properly you should have a static variable, which is set to zero when
allocated, so it should all be zeroed... of course, if done properly
:P
Davion