diff options
| author | Shauren <shauren.trinity@gmail.com> | 2024-03-24 14:39:29 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2024-03-24 17:19:10 +0100 |
| commit | 94b78ebc8b0eb09409d0db36bebfde85a1644fe8 (patch) | |
| tree | a948fed605007b2fb3c19c883b26da7eb0ef266d /src/server/game/Chat | |
| parent | aac5581bfce1955d5f483521bf77d3d97397d201 (diff) | |
Core/Players: Slightly improve neutral player faction support
Diffstat (limited to 'src/server/game/Chat')
| -rw-r--r-- | src/server/game/Chat/Channels/ChannelMgr.cpp | 23 | ||||
| -rw-r--r-- | src/server/game/Chat/Channels/ChannelMgr.h | 7 |
2 files changed, 19 insertions, 11 deletions
diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 396e1e20254..7b05b344f65 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -69,7 +69,7 @@ ChannelMgr::~ChannelMgr() { Field* fields = result->Fetch(); std::string dbName = fields[0].GetString(); - uint32 team = fields[1].GetUInt32(); + Team team = Team(fields[1].GetUInt32()); bool dbAnnounce = fields[2].GetBool(); bool dbOwnership = fields[3].GetBool(); std::string dbPass = fields[4].GetString(); @@ -111,19 +111,26 @@ ChannelMgr::~ChannelMgr() TC_LOG_INFO("server.loading", ">> Loaded {} custom chat channels in {} ms", count, GetMSTimeDiffToNow(oldMSTime)); } -/*static*/ ChannelMgr* ChannelMgr::ForTeam(uint32 team) +/*static*/ ChannelMgr* ChannelMgr::ForTeam(Team team) { static ChannelMgr allianceChannelMgr(ALLIANCE); static ChannelMgr hordeChannelMgr(HORDE); + static ChannelMgr neutralChannelMgr(PANDARIA_NEUTRAL); if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) - return &allianceChannelMgr; // cross-faction + return &neutralChannelMgr; // cross-faction - if (team == ALLIANCE) - return &allianceChannelMgr; - - if (team == HORDE) - return &hordeChannelMgr; + switch (team) + { + case HORDE: + return &hordeChannelMgr; + case ALLIANCE: + return &allianceChannelMgr; + case PANDARIA_NEUTRAL: + return &neutralChannelMgr; + default: + break; + } return nullptr; } diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 72dc50c0fcd..e9e379b3005 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -19,6 +19,7 @@ #include "Define.h" #include "ObjectGuid.h" +#include "SharedDefines.h" #include <string> #include <unordered_map> @@ -32,7 +33,7 @@ class TC_GAME_API ChannelMgr typedef std::unordered_map<ObjectGuid, Channel*> BuiltinChannelContainer; protected: - explicit ChannelMgr(uint32 team) : _team(team), _guidGenerator(HighGuid::ChatChannel) { } + explicit ChannelMgr(Team team) : _team(team), _guidGenerator(HighGuid::ChatChannel) { } ~ChannelMgr(); public: @@ -42,7 +43,7 @@ class TC_GAME_API ChannelMgr ChannelMgr& operator=(ChannelMgr&& right) = delete; static void LoadFromDB(); - static ChannelMgr* ForTeam(uint32 team); + static ChannelMgr* ForTeam(Team team); static Channel* GetChannelForPlayerByNamePart(std::string const& namePart, Player* playerSearcher); static Channel* GetChannelForPlayerByGuid(ObjectGuid channelGuid, Player* playerSearcher); static AreaTableEntry const* SpecialLinkedArea; @@ -57,7 +58,7 @@ class TC_GAME_API ChannelMgr private: CustomChannelContainer _customChannels; BuiltinChannelContainer _channels; - uint32 const _team; + Team const _team; ObjectGuidGenerator _guidGenerator; static void SendNotOnChannelNotify(Player const* player, std::string const& name); |
