aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptMgr.cpp
diff options
context:
space:
mode:
authorTreeston <treeston.mmoc@gmail.com>2020-09-20 02:50:38 +0200
committerShauren <shauren.trinity@gmail.com>2022-02-27 20:08:41 +0100
commit3fd2eb126cbed36292fa5defc024c2b93e8d8671 (patch)
tree6068f6e874d7552fcf00a92ca75a85381323a038 /src/server/game/Scripting/ScriptMgr.cpp
parent7a2c3af98831364988db25dd1bdd8ca10464c641 (diff)
[3.3.5] ChatCommands, the other half: chat command resolution refactor (PR #25463)
(cherry picked from commit 1eca51b417678b9a48b28552925d5694105f82bb)
Diffstat (limited to 'src/server/game/Scripting/ScriptMgr.cpp')
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index b50f5a21642..30eefe2fb4a 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -19,7 +19,6 @@
#include "AchievementMgr.h"
#include "AreaTrigger.h"
#include "AreaTriggerAI.h"
-#include "Chat.h"
#include "ChatCommand.h"
#include "Conversation.h"
#include "Creature.h"
@@ -1057,17 +1056,17 @@ class ScriptRegistrySwapHooks<CommandScript, Base>
public:
void BeforeReleaseContext(std::string const& /*context*/) final override
{
- ChatHandler::invalidateCommandTable();
+ Trinity::ChatCommands::InvalidateCommandMap();
}
void BeforeSwapContext(bool /*initialize*/) override
{
- ChatHandler::invalidateCommandTable();
+ Trinity::ChatCommands::InvalidateCommandMap();
}
void BeforeUnload() final override
{
- ChatHandler::invalidateCommandTable();
+ Trinity::ChatCommands::InvalidateCommandMap();
}
};
@@ -1753,22 +1752,16 @@ OutdoorPvP* ScriptMgr::CreateOutdoorPvP(uint32 scriptId)
return tmpscript->GetOutdoorPvP();
}
-std::vector<ChatCommand> ScriptMgr::GetChatCommands()
+Trinity::ChatCommands::ChatCommandTable ScriptMgr::GetChatCommands()
{
- std::vector<ChatCommand> table;
+ Trinity::ChatCommands::ChatCommandTable table;
FOR_SCRIPTS_RET(CommandScript, itr, end, table)
{
- std::vector<ChatCommand> cmds = itr->second->GetCommands();
- table.insert(table.end(), cmds.begin(), cmds.end());
+ Trinity::ChatCommands::ChatCommandTable cmds = itr->second->GetCommands();
+ std::move(cmds.begin(), cmds.end(), std::back_inserter(table));
}
- // Sort commands in alphabetical order
- std::sort(table.begin(), table.end(), [](ChatCommand const& a, ChatCommand const& b)
- {
- return strcmp(a.Name, b.Name) < 0;
- });
-
return table;
}