Skip to content

Commit 87a30e2

Browse files
authored
Merge branch 'master' into client_c20
2 parents 6a86788 + 09a1a60 commit 87a30e2

File tree

2 files changed

+1543
-1537
lines changed

2 files changed

+1543
-1537
lines changed

Client/core/CCommands.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
128128

129129
// Grab the command
130130
tagCOMMANDENTRY* pEntry = Get(szCommand);
131+
bool wasHandled = false;
131132
if (pEntry)
132133
{
133134
// If its a core command, or if its enabled
@@ -136,13 +137,16 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
136137
// Execute it
137138
if (!bIsScriptedBind || pEntry->bAllowScriptedBind)
138139
ExecuteHandler(pEntry->pfnCmdFunc, szParameters.get());
140+
141+
wasHandled = true;
139142
}
140143
}
141144

142145
// Recompose the original command text
143146
std::string val = std::string(szCommand) + " " + std::string(szParameters ? szParameters.get() : "");
144147

145148
// Is it a cvar? (syntax: cvar[ = value])
149+
if (!wasHandled)
146150
{
147151
// Check to see if '=' exists
148152
unsigned int nOpIndex = val.find('=');
@@ -190,7 +194,7 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
190194

191195
// HACK: if its a 'nick' command, save it here
192196
bool bIsNickCommand = !stricmp(szCommand, "nick");
193-
if (bIsNickCommand && szParameters && !bIsScriptedBind)
197+
if (!wasHandled && bIsNickCommand && szParameters && !bIsScriptedBind)
194198
{
195199
if (CCore::GetSingleton().IsValidNick(szParameters.get()))
196200
{
@@ -211,10 +215,13 @@ bool CCommands::Execute(const char* szCommand, const char* szParametersIn, bool
211215
if (m_pfnExecuteHandler)
212216
{
213217
bool bAllowScriptedBind = (!pEntry || pEntry->bAllowScriptedBind);
214-
if (m_pfnExecuteHandler(szCommand, szParameters.get(), bHandleRemotely, (pEntry != NULL), bIsScriptedBind, bAllowScriptedBind))
218+
if (m_pfnExecuteHandler(szCommand, szParameters.get(), bHandleRemotely, wasHandled, bIsScriptedBind, bAllowScriptedBind))
215219
return true;
216220
}
217221

222+
if (wasHandled)
223+
return true;
224+
218225
// Unknown command
219226
val = _("Unknown command or cvar: ") + szCommand;
220227
if (!bIsScriptedBind && !bIsNickCommand && pEntry == nullptr)

0 commit comments

Comments
 (0)