Fixed amb1927 - client command case sensitivity did not match the server's logic.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402483
This commit is contained in:
David Anderson 2008-09-02 03:58:34 +00:00
parent 58870a30fb
commit 4951dccded
2 changed files with 34 additions and 1 deletions

View File

@ -296,7 +296,32 @@ void ConCmdManager::InternalDispatch(const CCommand &command)
ConCmdInfo *pInfo;
if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
{
return;
/* Unfortunately, we now have to do a slow lookup because Valve made client commands
* case-insensitive. We can't even use our sortedness.
*/
if (client == 0 && !engine->IsDedicatedServer())
{
return;
}
List<ConCmdInfo *>::iterator iter;
pInfo = NULL;
iter = m_CmdList.begin();
while (iter != m_CmdList.end())
{
if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
{
pInfo = (*iter);
break;
}
iter++;
}
if (pInfo == NULL)
{
return;
}
}
/* This is a hack to prevent say triggers from firing on messages that were

View File

@ -298,6 +298,8 @@ functag SrvCmd Action:public(args);
/**
* Creates a server-only console command, or hooks an already existing one.
*
* Server commands are case sensitive.
*
* @param cmd Name of the command to hook or create.
* @param callback A function to use as a callback for when the command is invoked.
* @param description Optional description to use for command creation.
@ -320,6 +322,10 @@ functag ConCmd Action:public(client, args);
/**
* Creates a console command, or hooks an already existing one.
*
* Console commands are case sensitive. However, if the command already exists in the game,
* the a client may enter the command in any case. SourceMod corrects for this automatically,
* and you should only hook the "real" version of the command.
*
* @param cmd Name of the command to hook or create.
* @param callback A function to use as a callback for when the command is invoked.
* @param description Optional description to use for command creation.
@ -334,6 +340,8 @@ native RegConsoleCmd(const String:cmd[], ConCmd:callback, const String:descripti
* it is created. When this command is invoked, the access rights of the player are
* automatically checked before allowing it to continue.
*
* Admin commands are case sensitive from both the client and server.
*
* @param cmd String containing command to register.
* @param callback A function to use as a callback for when the command is invoked.
* @param adminflags Administrative flags (bitstring) to use for permissions.