Fixed amb1927 - client command case sensitivity did not match the server's logic.
Fixed
amb1927 - client command case sensitivity did not match the server's logic.
1.1 --- a/core/ConCmdManager.cpp Fri Aug 29 02:26:22 2008 +0000
1.2 +++ b/core/ConCmdManager.cpp Tue Sep 02 03:58:34 2008 +0000
1.3 @@ -296,7 +296,32 @@
1.4 ConCmdInfo *pInfo;
1.5 if (!sm_trie_retrieve(m_pCmds, cmd, (void **)&pInfo))
1.6 {
1.7 - return;
1.8 + /* Unfortunately, we now have to do a slow lookup because Valve made client commands
1.9 + * case-insensitive. We can't even use our sortedness.
1.10 + */
1.11 + if (client == 0 && !engine->IsDedicatedServer())
1.12 + {
1.13 + return;
1.14 + }
1.15 +
1.16 + List<ConCmdInfo *>::iterator iter;
1.17 +
1.18 + pInfo = NULL;
1.19 + iter = m_CmdList.begin();
1.20 + while (iter != m_CmdList.end())
1.21 + {
1.22 + if (strcasecmp((*iter)->pCmd->GetName(), cmd) == 0)
1.23 + {
1.24 + pInfo = (*iter);
1.25 + break;
1.26 + }
1.27 + iter++;
1.28 + }
1.29 +
1.30 + if (pInfo == NULL)
1.31 + {
1.32 + return;
1.33 + }
1.34 }
1.35
1.36 /* This is a hack to prevent say triggers from firing on messages that were
2.1 --- a/plugins/include/console.inc Fri Aug 29 02:26:22 2008 +0000
2.2 +++ b/plugins/include/console.inc Tue Sep 02 03:58:34 2008 +0000
2.3 @@ -298,6 +298,8 @@
2.4 /**
2.5 * Creates a server-only console command, or hooks an already existing one.
2.6 *
2.7 + * Server commands are case sensitive.
2.8 + *
2.9 * @param cmd Name of the command to hook or create.
2.10 * @param callback A function to use as a callback for when the command is invoked.
2.11 * @param description Optional description to use for command creation.
2.12 @@ -320,6 +322,10 @@
2.13 /**
2.14 * Creates a console command, or hooks an already existing one.
2.15 *
2.16 + * Console commands are case sensitive. However, if the command already exists in the game,
2.17 + * the a client may enter the command in any case. SourceMod corrects for this automatically,
2.18 + * and you should only hook the "real" version of the command.
2.19 + *
2.20 * @param cmd Name of the command to hook or create.
2.21 * @param callback A function to use as a callback for when the command is invoked.
2.22 * @param description Optional description to use for command creation.
2.23 @@ -334,6 +340,8 @@
2.24 * it is created. When this command is invoked, the access rights of the player are
2.25 * automatically checked before allowing it to continue.
2.26 *
2.27 + * Admin commands are case sensitive from both the client and server.
2.28 + *
2.29 * @param cmd String containing command to register.
2.30 * @param callback A function to use as a callback for when the command is invoked.
2.31 * @param adminflags Administrative flags (bitstring) to use for permissions.