Oh. You did use it, but like, I don't even know where to start here,
cause I -think- I understand what you wanna do. This is wrong...

void start_wt( void )
{
        int first;
        int last;
        char first_l[MAX_STRING_LENGTH];
        char last_l[MAX_STRING_LENGTH];

        first = number_range( 1, 26 );
        last = number_range( 1, 26 );
        sprintf(first_l,"%s",get_letter(first));
        sprintf(last_l,"%s",get_letter(last));
        pWrd->first = get_letter(first);
        pWrd->last = get_letter(last);
        sprintf(pWrd->dict,"wordtwist/wt_%s.txt", pWrd->first );
        pWrd->turns_left -= 1;
        pWrd->turns_left = 4;
        pWrd->newround = FALSE;
        announce_wt();
        return;
}


Look. pWrd isn't even declared. Does this even compile? Heh. Unless
like, its globle, in which case...

bool has_been_guessed( struct wordtwist_data *pWrd,  char *word )
{   
        char log_buf[MAX_INPUT_LENGTH];
        int i;  
        for( i = 0 ; i < pWrd->guess_count ; i++ ) //this crashes on second+ 
guess
                if(!str_cmp(word, pWrd->guesses[i]) )
                        return TRUE;
        return FALSE;
}

That shouldn't compile... it would have problems with a redefinition of pWrd...

Also if you have a typedef for pWrd, you can use that instead of the
struct style.


In do_wtcorrect(), after guesses, and guesser's are allocated, you have ->
                pWrd->guesses[pWrd->guess_count] = str_dup(argument);
                pWrd->guessers[pWrd->guess_count] = str_dup(ch->name);

These p2p's, are sized to pWrd->guess_count. Ok. Just think of the
p2p's as an array. We have it basicly declared as

char array[guess_count]. Lets say its 10. So its sized to 10. So we
have spots from 0-9. So if we're trying to set it to the size, we're
using spot 10, and this is where the problem lies :P. When ever your
dynamicly allocating something like this, you always use the spot
before. Sooo! We'll make it

                pWrd->guesses[pWrd->guess_count-1] = str_dup(argument);
                pWrd->guessers[pWrd->guess_count-1] = str_dup(ch->name);

I hope that makes a lick of sense :P. That would explain why its
crashing. Your trying to access something that aint set to anything. I
hope it helps.

Davion

Reply via email to