mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-26 20:02:25 +01:00
Core/Commands: Refactored chat command script hook, fixes a crash when building with gcc 5
Closes #15616 Closes #15740
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "Player.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Chat.h"
|
||||
|
||||
// namespace
|
||||
// {
|
||||
@@ -975,12 +976,15 @@ OutdoorPvP* ScriptMgr::CreateOutdoorPvP(OutdoorPvPData const* data)
|
||||
return tmpscript->GetOutdoorPvP();
|
||||
}
|
||||
|
||||
std::vector<ChatCommand*> ScriptMgr::GetChatCommands()
|
||||
std::vector<ChatCommand> ScriptMgr::GetChatCommands()
|
||||
{
|
||||
std::vector<ChatCommand*> table;
|
||||
std::vector<ChatCommand> table;
|
||||
|
||||
FOR_SCRIPTS_RET(CommandScript, itr, end, table)
|
||||
table.push_back(itr->second->GetCommands());
|
||||
{
|
||||
std::vector<ChatCommand> cmds = itr->second->GetCommands();
|
||||
table.insert(table.end(), cmds.begin(), cmds.end());
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
@@ -553,7 +553,7 @@ class CommandScript : public ScriptObject
|
||||
public:
|
||||
|
||||
// Should return a pointer to a valid command table (ChatCommand array) to be used by ChatHandler.
|
||||
virtual ChatCommand* GetCommands() const = 0;
|
||||
virtual std::vector<ChatCommand> GetCommands() const = 0;
|
||||
};
|
||||
|
||||
class WeatherScript : public ScriptObject, public UpdatableScript<Weather>
|
||||
@@ -1013,7 +1013,7 @@ class ScriptMgr
|
||||
|
||||
public: /* CommandScript */
|
||||
|
||||
std::vector<ChatCommand*> GetChatCommands();
|
||||
std::vector<ChatCommand> GetChatCommands();
|
||||
|
||||
public: /* WeatherScript */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user