Page 2 of 2

Posted: Mon Aug 02, 2010 6:38 pm
by BackTrak

Code: Select all

    int MatchName(const char*   pszText, const char* pszName)
    {
        assert (*pszText != '\0');

        while (true)
        {
            if (*pszText == '\0')
            {
                //Ran out of typed text ... return the number of unmatched characters
                //in pszName
                return strlen(pszName);
            }
            else if (tolower(*pszText) != tolower(*pszName))
            {
                //No match
                return c_badMatch;
            }

            pszText++;
            pszName++;
        }
    }
Yep, you were right, this appears to be the right function from console.cpp that is called when tab is hit. (called from OnTab()).

OnTab() is quite large, I won't bother to rip it up now. If a ticket gets opened, and Xynth doesn't fix it immediately ;) , this is something I could do.

However, the powers that be should decide first if it's a wanted feature.

Posted: Mon Aug 02, 2010 8:50 pm
by cashto

Code: Select all

if(foundPlayer == NULL)
{
    // Else prefer the match on the beginning of the string less the token.
    if(tokenMatchingPlayer != NULL)
        foundPlayer = tokenMatchingPlayer;

    // Else match on the first player with the string anywhere in the character name.
    else if(substringMatchingPlayer != NULL)
        foundPlayer = substringMatchingPlayer;
}

return foundPlayer;
}

Code: Select all

return foundPlayer ? foundPlayer :
       tokenMatchingPlayer ? tokenMatchingPlayer :
       substringMatchingPlayer;