summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorShinDarth <borzifrancesco@gmail.com>2016-08-21 12:58:14 +0200
committerShinDarth <borzifrancesco@gmail.com>2016-08-21 12:58:14 +0200
commit744e05d872502dc9e438c7aa1062d82e7bc8297c (patch)
tree522fb243a6f76ed9db99895e2417a6ada108f4c1 /src/game
parent0ba91d7c3ee994607a6e0437ab47c2c79ba1ab0a (diff)
Revert "fixed crash on command execution"
This reverts commit d6133057ca43c2c08fe880344843ba70008c2edc.
Diffstat (limited to 'src/game')
-rw-r--r--src/game/Chat/Chat.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/game/Chat/Chat.cpp b/src/game/Chat/Chat.cpp
index 220e9685f7..6ad71b0cdb 100644
--- a/src/game/Chat/Chat.cpp
+++ b/src/game/Chat/Chat.cpp
@@ -244,7 +244,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
while (*text == ' ') ++text;
- for (uint32 i = 0; table[i].Name != nullptr; ++i)
+ for (uint32 i = 0; i < table.size(); ++i)
{
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
continue;
@@ -252,7 +252,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
bool match = false;
if (strlen(table[i].Name) > cmd.length())
{
- for (uint32 j = 0; table[j].Name != nullptr; ++j)
+ for (uint32 j = 0; j < table.size(); ++j)
{
if (!hasStringAbbr(table[j].Name, cmd.c_str()))
continue;
@@ -398,12 +398,12 @@ bool ChatHandler::ParseCommands(char const* text)
std::string fullcmd;
+ if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS))
+ return false;
+
/// chat case (.command or !command format)
if (m_session)
{
- if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS))
- return false;
-
if (text[0] != '!' && text[0] != '.')
return false;
}
@@ -494,7 +494,7 @@ Valid examples:
bool ChatHandler::ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd)
{
std::string list;
- for (uint32 i = 0; table[i].Name != nullptr; ++i)
+ for (uint32 i = 0; i < table.size(); ++i)
{
// must be available (ignore handler existence for show command with possible available subcommands)
if (!isAvailable(table[i]))
@@ -533,7 +533,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
{
if (*cmd)
{
- for (uint32 i = 0; table[i].Name != nullptr; ++i)
+ for (uint32 i = 0; i < table.size(); ++i)
{
// must be available (ignore handler existence for show command with possible available subcommands)
if (!isAvailable(table[i]))
@@ -563,7 +563,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
}
else
{
- for (uint32 i = 0; table[i].Name != nullptr; ++i)
+ for (uint32 i = 0; i < table.size(); ++i)
{
// must be available (ignore handler existence for show command with possible available subcommands)
if (!isAvailable(table[i]))