diff options
Diffstat (limited to 'src/server/game/Scripting')
-rw-r--r-- | src/server/game/Scripting/ScriptMgr.cpp | 21 | ||||
-rw-r--r-- | src/server/game/Scripting/ScriptMgr.h | 7 |
2 files changed, 11 insertions, 17 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; } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 9d420542cae..36e0a2addfc 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -34,7 +34,6 @@ class Battlefield; class Battleground; class BattlegroundMap; class Channel; -class ChatCommand; class Conversation; class Creature; class CreatureAI; @@ -79,6 +78,8 @@ struct Position; struct QuestObjective; struct SceneTemplate; +namespace Trinity::ChatCommands { struct ChatCommandBuilder; } + enum BattlegroundTypeId : uint32; enum Difficulty : uint8; enum DuelCompleteType : uint8; @@ -569,7 +570,7 @@ class TC_GAME_API CommandScript : public ScriptObject ~CommandScript(); // Should return a pointer to a valid command table (ChatCommand array) to be used by ChatHandler. - virtual std::vector<ChatCommand> GetCommands() const = 0; + virtual std::vector<Trinity::ChatCommands::ChatCommandBuilder> GetCommands() const = 0; }; class TC_GAME_API WeatherScript : public ScriptObject, public UpdatableScript<Weather> @@ -1149,7 +1150,7 @@ class TC_GAME_API ScriptMgr public: /* CommandScript */ - std::vector<ChatCommand> GetChatCommands(); + std::vector<Trinity::ChatCommands::ChatCommandBuilder> GetChatCommands(); public: /* WeatherScript */ |