From b6d2c9b2260c74367a868d8ead2e57b425d97775 Mon Sep 17 00:00:00 2001 From: ShinDarth Date: Mon, 22 Aug 2016 01:40:58 +0200 Subject: [PATCH] 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... --- src/game/Chat/Chat.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp index 72f68994d..432fa19c9 100644 --- a/src/game/Chat/Chat.cpp +++ b/src/game/Chat/Chat.cpp @@ -247,7 +247,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c for (uint32 i = 0; i < table.size(); ++i) { // for data fill use full explicit command names - if (table[i].Name == nullptr || table[i].Name != cmd) + if (table[i].Name == nullptr) continue; if (!hasStringAbbr(table[i].Name, cmd.c_str())) @@ -261,15 +261,14 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c if (!hasStringAbbr(table[j].Name, cmd.c_str())) continue; - if (strcmp(table[j].Name, cmd.c_str()) != 0) - continue; - else + if (strcmp(table[j].Name, cmd.c_str()) == 0) { match = true; break; } } } + if (match) continue; @@ -278,7 +277,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector const& table, c { if (!ExecuteCommandInTable(table[i].ChildCommands, text, fullcmd)) { - if (text && text[0] != '\0') + if (text[0] != '\0') SendSysMessage(LANG_NO_SUBCMD); else SendSysMessage(LANG_CMD_SYNTAX);