aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Chat/Chat.cpp7
-rw-r--r--src/server/game/Chat/Chat.h2
-rw-r--r--src/server/game/Scripting/ScriptMgr.h8
3 files changed, 9 insertions, 8 deletions
diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp
index 26e07ab62c3..d3e153e3a89 100644
--- a/src/server/game/Chat/Chat.cpp
+++ b/src/server/game/Chat/Chat.cpp
@@ -959,9 +959,9 @@ void ChatHandler::PSendSysMessage(const char *format, ...)
SendSysMessage(str);
}
-bool ChatHandler::ExecuteCommandInTables(std::vector<ChatCommand*>& tables, const char* text, const std::string& fullcmd)
+bool ChatHandler::ExecuteCommandInTables(std::vector<ChatCommand*> const& tables, const char* text, const std::string& fullcmd)
{
- for (std::vector<ChatCommand*>::iterator it = tables.begin(); it != tables.end(); ++it)
+ for (std::vector<ChatCommand*>::const_iterator it = tables.begin(); it != tables.end(); ++it)
if (ExecuteCommandInTable((*it), text, fullcmd))
return true;
@@ -1125,7 +1125,8 @@ int ChatHandler::ParseCommands(const char* text)
if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd))
{
- if (!ExecuteCommandInTables(sScriptMgr.GetChatCommands(), text, fullcmd))
+ std::vector<ChatCommand*> const& tables = sScriptMgr.GetChatCommands();
+ if (!ExecuteCommandInTables(tables, text, fullcmd))
{
if (m_session && m_session->GetSecurity() == SEC_PLAYER)
return 0;
diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h
index cf3ef686f3e..93ccd6658cc 100644
--- a/src/server/game/Chat/Chat.h
+++ b/src/server/game/Chat/Chat.h
@@ -98,7 +98,7 @@ class ChatHandler
void SendGlobalGMSysMessage(const char *str);
static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
- bool ExecuteCommandInTables(std::vector<ChatCommand*>& tables, const char* text, const std::string& fullcmd);
+ bool ExecuteCommandInTables(std::vector<ChatCommand*> const& tables, const char* text, const std::string& fullcmd);
bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd);
bool ShowHelpForCommand(ChatCommand *table, const char* cmd);
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd);
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 842befaf057..5ae790e2cb7 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -914,11 +914,11 @@ class ScriptMgr
// Gets a script by its ID (assigned by ObjectMgr).
static TScript* GetScriptById(uint32 id)
{
- for (ScriptMap::iterator it = ScriptPointerList.begin(); it != ScriptPointerList.end(); ++it)
- if (it->first == id)
- return it->second;
+ ScriptMap::iterator it = ScriptPointerList.find(id);
+ if (it == ScriptPointerList.end())
+ return NULL;
- return NULL;
+ return it->second;
}
// Attempts to add a new script to the list.