Ok I know this is going to sound entirly newbieish, but I tought myself how
to code, and ammaross' letters take too long to get answered :P So hopefully
you guys can help :)

This function is a pain in my butt :P
char *fix_string( const char *str )
{
    static char strfix[MAX_STRING_LENGTH * 4];
    int i;
    int o;

    if ( str == NULL )
  return "";

    for ( o = i = 0; str[i+o] != '\0'; i++ )
    {
        while (str[i+o] == '\r' || str[i+o] == '~')
            o++;
        strfix[i] = str[i+o];
    }
    strfix[i] = '\0';
    return strfix;
}

My problem was at first it was MSL * 2 but we were having odd memory
problems after an area would save. So I looked into it and gave the * 4 as a
shot to see if it would work... So everything is all nice and fine but I
don't like that fix cause idk say come in the future we get another string
that is larger then MSL * 4 that gets set their, going to hit the same
problem again..... So rather then having to constantly up this and have it
make it so large when say only a few rooms need it that large.

I was wondering if you could do something along the lines of:

char strfix[sizeof(str)+2];

Would that work? Or can you not do that with delclarations of variables.
Thanks for you input ahead of time :)

Sarix


Reply via email to