> >
> > TO:
> > mob->name = str_dup(pMobIndex->player_name);
> > etc.
>
> Exactly..
> Understanding how the shared and unshared strings work can be kind of a
big > hurdle :)
> --Palrich.
>
Hrmmm....I've added the str_dup's to the strings that needed them. Still
not working correctly. So I went to the create_* functions and they were
the same way. I changed them (1st question was this correct in doing?) to
str_dup's instead of just assignments. Still not working. So I looked over
it again just to make sure *grins at Edwin* and still look pretty good. So
on to the free_string and str_dup functions. I don't have a friggin clue as
to what's going on in them. So here's one and maybe you guys can help.
/*
* Free a string.
* Null is legal here to simplify callers.
* Read-only shared strings are not touched.
*/
void free_string( char *pstr )
{
if ( pstr == NULL
|| pstr == &str_empty[0]
|| ( pstr >= string_space && pstr < top_string ) )
return;
free_mem( pstr, strlen(pstr) + 1 );
return;
}
now I can see how it's checking the pstr sent to it but I don't see where
string_space and top_string come from. Also, why free the length of the
string plus one?
Thanks again everyone.
Arkham