autocomplete to ignore ^, *, SRM_ , etc.

A place to post suggestions for new features, new bugs, and comments about the existing code.
BackTrak
Posts: 2079
Joined: Thu Mar 08, 2007 4:52 am
Location: Chicago, IL
Contact:

Post 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.
ImageImage
cashto
Posts: 3165
Joined: Mon Sep 10, 2007 5:40 am
Location: Seattle

Post 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;
Globemaster_III wrote:QUOTE (Globemaster_III @ Jan 11 2018, 11:27 PM) as you know i think very little of cashto, cashto alway a flying low pilot, he alway flying a trainer airplane and he rented
Post Reply