Core/Chat: fixed some commands
This fixes all those commands that can take in input both a param and a subcommand, e.g.: .learn, .tele, etc...
This commit is contained in:
@@ -247,7 +247,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||||||
for (uint32 i = 0; i < table.size(); ++i)
|
for (uint32 i = 0; i < table.size(); ++i)
|
||||||
{
|
{
|
||||||
// for data fill use full explicit command names
|
// for data fill use full explicit command names
|
||||||
if (table[i].Name == nullptr || table[i].Name != cmd)
|
if (table[i].Name == nullptr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
||||||
@@ -261,15 +261,14 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||||||
if (!hasStringAbbr(table[j].Name, cmd.c_str()))
|
if (!hasStringAbbr(table[j].Name, cmd.c_str()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (strcmp(table[j].Name, cmd.c_str()) != 0)
|
if (strcmp(table[j].Name, cmd.c_str()) == 0)
|
||||||
continue;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
match = true;
|
match = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match)
|
if (match)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -278,7 +277,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||||||
{
|
{
|
||||||
if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd))
|
if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd))
|
||||||
{
|
{
|
||||||
if (text && text[0] != '\0')
|
if (text[0] != '\0')
|
||||||
SendSysMessage(LANG_NO_SUBCMD);
|
SendSysMessage(LANG_NO_SUBCMD);
|
||||||
else
|
else
|
||||||
SendSysMessage(LANG_CMD_SYNTAX);
|
SendSysMessage(LANG_CMD_SYNTAX);
|
||||||
|
|||||||
Reference in New Issue
Block a user