mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-06 04:23:47 +00:00
refactor(Core): apply clang-tidy modernize-* (#9975)
Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
class Player;
|
||||
|
||||
@@ -121,10 +122,10 @@ enum ChannelMemberFlags
|
||||
class ChannelRights
|
||||
{
|
||||
public:
|
||||
ChannelRights() : flags(0), speakDelay(0) {}
|
||||
ChannelRights(const uint32& f, const uint32& d, const std::string& jm, const std::string& sm, const std::set<uint32>& ml) : flags(f), speakDelay(d), joinMessage(jm), speakMessage(sm), moderators(ml) {}
|
||||
uint32 flags;
|
||||
uint32 speakDelay;
|
||||
ChannelRights() = default;
|
||||
ChannelRights(const uint32& f, const uint32& d, std::string jm, std::string sm, std::set<uint32> ml) : flags(f), speakDelay(d), joinMessage(std::move(jm)), speakMessage(std::move(sm)), moderators(std::move(ml)) {}
|
||||
uint32 flags{0};
|
||||
uint32 speakDelay{0};
|
||||
std::string joinMessage;
|
||||
std::string speakMessage;
|
||||
std::set<uint32> moderators;
|
||||
@@ -152,23 +153,23 @@ class Channel
|
||||
uint64 lastSpeakTime; // pussywizard
|
||||
Player* plrPtr; // pussywizard
|
||||
|
||||
bool HasFlag(uint8 flag) const { return flags & flag; }
|
||||
[[nodiscard]] bool HasFlag(uint8 flag) const { return flags & flag; }
|
||||
void SetFlag(uint8 flag) { if (!HasFlag(flag)) flags |= flag; }
|
||||
bool IsOwner() const { return flags & MEMBER_FLAG_OWNER; }
|
||||
[[nodiscard]] bool IsOwner() const { return flags & MEMBER_FLAG_OWNER; }
|
||||
void SetOwner(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_OWNER;
|
||||
else flags &= ~MEMBER_FLAG_OWNER;
|
||||
}
|
||||
bool IsOwnerGM() const { return _gmStatus; }
|
||||
[[nodiscard]] bool IsOwnerGM() const { return _gmStatus; }
|
||||
void SetOwnerGM(bool on) { _gmStatus = on; }
|
||||
bool IsModerator() const { return flags & MEMBER_FLAG_MODERATOR; }
|
||||
[[nodiscard]] bool IsModerator() const { return flags & MEMBER_FLAG_MODERATOR; }
|
||||
void SetModerator(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_MODERATOR;
|
||||
else flags &= ~MEMBER_FLAG_MODERATOR;
|
||||
}
|
||||
bool IsMuted() const { return flags & MEMBER_FLAG_MUTED; }
|
||||
[[nodiscard]] bool IsMuted() const { return flags & MEMBER_FLAG_MUTED; }
|
||||
void SetMuted(bool state)
|
||||
{
|
||||
if (state) flags |= MEMBER_FLAG_MUTED;
|
||||
@@ -190,16 +191,16 @@ class Channel
|
||||
|
||||
public:
|
||||
Channel(std::string const& name, uint32 channel_id, uint32 channelDBId, TeamId teamId = TEAM_NEUTRAL, bool announce = true, bool ownership = true);
|
||||
std::string const& GetName() const { return _name; }
|
||||
uint32 GetChannelId() const { return _channelId; }
|
||||
bool IsConstant() const { return _channelId != 0; }
|
||||
bool IsAnnounce() const { return _announce; }
|
||||
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||
std::string const& GetPassword() const { return _password; }
|
||||
[[nodiscard]] std::string const& GetName() const { return _name; }
|
||||
[[nodiscard]] uint32 GetChannelId() const { return _channelId; }
|
||||
[[nodiscard]] bool IsConstant() const { return _channelId != 0; }
|
||||
[[nodiscard]] bool IsAnnounce() const { return _announce; }
|
||||
[[nodiscard]] bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||
[[nodiscard]] std::string const& GetPassword() const { return _password; }
|
||||
void SetPassword(std::string const& npassword) { _password = npassword; }
|
||||
uint32 GetNumPlayers() const { return playersStore.size(); }
|
||||
uint8 GetFlags() const { return _flags; }
|
||||
bool HasFlag(uint8 flag) const { return _flags & flag; }
|
||||
[[nodiscard]] uint32 GetNumPlayers() const { return playersStore.size(); }
|
||||
[[nodiscard]] uint8 GetFlags() const { return _flags; }
|
||||
[[nodiscard]] bool HasFlag(uint8 flag) const { return _flags & flag; }
|
||||
|
||||
void JoinChannel(Player* player, std::string const& pass);
|
||||
void LeaveChannel(Player* player, bool send = true);
|
||||
@@ -280,15 +281,15 @@ private:
|
||||
void SendToOne(WorldPacket* data, ObjectGuid who);
|
||||
void SendToAllWatching(WorldPacket* data);
|
||||
|
||||
bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
bool IsBanned(ObjectGuid guid) const;
|
||||
[[nodiscard]] bool IsOn(ObjectGuid who) const { return playersStore.find(who) != playersStore.end(); }
|
||||
[[nodiscard]] bool IsBanned(ObjectGuid guid) const;
|
||||
|
||||
void UpdateChannelInDB() const;
|
||||
void UpdateChannelUseageInDB() const;
|
||||
void AddChannelBanToDB(ObjectGuid guid, uint32 time) const;
|
||||
void RemoveChannelBanFromDB(ObjectGuid guid) const;
|
||||
|
||||
uint8 GetPlayerFlags(ObjectGuid guid) const
|
||||
[[nodiscard]] uint8 GetPlayerFlags(ObjectGuid guid) const
|
||||
{
|
||||
PlayerContainer::const_iterator itr = playersStore.find(guid);
|
||||
return itr != playersStore.end() ? itr->second.flags : 0;
|
||||
|
||||
Reference in New Issue
Block a user