fixed crash on command execution
seems that clang is now compilable and playable on linux too \o/
This commit is contained in:
@@ -244,7 +244,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||||||
|
|
||||||
while (*text == ' ') ++text;
|
while (*text == ' ') ++text;
|
||||||
|
|
||||||
for (uint32 i = 0; i < table.size(); ++i)
|
for (uint32 i = 0; table[i].Name != nullptr; ++i)
|
||||||
{
|
{
|
||||||
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
if (!hasStringAbbr(table[i].Name, cmd.c_str()))
|
||||||
continue;
|
continue;
|
||||||
@@ -252,7 +252,7 @@ bool ChatHandler::ExecuteCommandInTable(std::vector<ChatCommand> const& table, c
|
|||||||
bool match = false;
|
bool match = false;
|
||||||
if (strlen(table[i].Name) > cmd.length())
|
if (strlen(table[i].Name) > cmd.length())
|
||||||
{
|
{
|
||||||
for (uint32 j = 0; j < table.size(); ++j)
|
for (uint32 j = 0; table[j].Name != nullptr; ++j)
|
||||||
{
|
{
|
||||||
if (!hasStringAbbr(table[j].Name, cmd.c_str()))
|
if (!hasStringAbbr(table[j].Name, cmd.c_str()))
|
||||||
continue;
|
continue;
|
||||||
@@ -348,7 +348,7 @@ bool ChatHandler::SetDataForCommandInTable(std::vector<ChatCommand>& table, char
|
|||||||
|
|
||||||
while (*text == ' ') ++text;
|
while (*text == ' ') ++text;
|
||||||
|
|
||||||
for (uint32 i = 0; i < table.size(); i++)
|
for (uint32 i = 0; table[i].Name != nullptr; i++)
|
||||||
{
|
{
|
||||||
// for data fill use full explicit command names
|
// for data fill use full explicit command names
|
||||||
if (table[i].Name != cmd)
|
if (table[i].Name != cmd)
|
||||||
@@ -398,12 +398,12 @@ bool ChatHandler::ParseCommands(char const* text)
|
|||||||
|
|
||||||
std::string fullcmd;
|
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)
|
/// chat case (.command or !command format)
|
||||||
if (m_session)
|
if (m_session)
|
||||||
{
|
{
|
||||||
|
if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS))
|
||||||
|
return false;
|
||||||
|
|
||||||
if (text[0] != '!' && text[0] != '.')
|
if (text[0] != '!' && text[0] != '.')
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -494,7 +494,7 @@ Valid examples:
|
|||||||
bool ChatHandler::ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd)
|
bool ChatHandler::ShowHelpForSubCommands(std::vector<ChatCommand> const& table, char const* cmd, char const* subcmd)
|
||||||
{
|
{
|
||||||
std::string list;
|
std::string list;
|
||||||
for (uint32 i = 0; i < table.size(); ++i)
|
for (uint32 i = 0; table[i].Name != nullptr; ++i)
|
||||||
{
|
{
|
||||||
// must be available (ignore handler existence for show command with possible available subcommands)
|
// must be available (ignore handler existence for show command with possible available subcommands)
|
||||||
if (!isAvailable(table[i]))
|
if (!isAvailable(table[i]))
|
||||||
@@ -533,7 +533,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
|
|||||||
{
|
{
|
||||||
if (*cmd)
|
if (*cmd)
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < table.size(); ++i)
|
for (uint32 i = 0; table[i].Name != nullptr; ++i)
|
||||||
{
|
{
|
||||||
// must be available (ignore handler existence for show command with possible available subcommands)
|
// must be available (ignore handler existence for show command with possible available subcommands)
|
||||||
if (!isAvailable(table[i]))
|
if (!isAvailable(table[i]))
|
||||||
@@ -563,7 +563,7 @@ bool ChatHandler::ShowHelpForCommand(std::vector<ChatCommand> const& table, cons
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (uint32 i = 0; i < table.size(); ++i)
|
for (uint32 i = 0; table[i].Name != nullptr; ++i)
|
||||||
{
|
{
|
||||||
// must be available (ignore handler existence for show command with possible available subcommands)
|
// must be available (ignore handler existence for show command with possible available subcommands)
|
||||||
if (!isAvailable(table[i]))
|
if (!isAvailable(table[i]))
|
||||||
|
|||||||
Reference in New Issue
Block a user