Core/Misc: reduced amount of string memory allocations (Step II)

This commit is contained in:
Spp committed 2012-10-24 15:34:48 +02:00
1 parent 013fb1f4d9
commit 9fbc4c0ae2
35 files changed
+160 -163

No files matched your search

+2 -2
View File
@@ -176,7 +176,7 @@ AccountOpResult ChangePassword(uint32 accountId, std::string newPassword)
return AOR_OK;
}
uint32 GetId(std::string username)
uint32 GetId(std::string const& username)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME);
stmt->setString(0, username);
@@ -265,7 +265,7 @@ bool normalizeString(std::string& utf8String)
return WStrToUtf8(buffer, maxLength, utf8String);
}
std::string CalculateShaPassHash(std::string& name, std::string& password)
std::string CalculateShaPassHash(std::string const& name, std::string const& password)
{
SHA1Hash sha;
sha.Initialize();
+2 -2
View File
@@ -42,12 +42,12 @@ namespace AccountMgr
AccountOpResult ChangePassword(uint32 accountId, std::string newPassword);
bool CheckPassword(uint32 accountId, std::string password);
uint32 GetId(std::string username);
uint32 GetId(std::string const& username);
uint32 GetSecurity(uint32 accountId);
uint32 GetSecurity(uint32 accountId, int32 realmId);
bool GetName(uint32 accountId, std::string& name);
uint32 GetCharactersCount(uint32 accountId);
std::string CalculateShaPassHash(std::string& name, std::string& password);
std::string CalculateShaPassHash(std::string const& name, std::string const& password);
bool normalizeString(std::string& utf8String);
bool IsPlayerAccount(uint32 gmlevel);
+1 -1
View File
@@ -440,7 +440,7 @@ void Battlefield::BroadcastPacketToWar(WorldPacket& data) const
player->GetSession()->SendPacket(&data);
}
WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg)
WorldPacket Battlefield::BuildWarningAnnPacket(std::string const& msg)
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
+1 -1
View File
@@ -314,7 +314,7 @@ class Battlefield : public ZoneScript
/// Called when a player enter in battlefield zone
virtual void OnPlayerEnterZone(Player* /*player*/) {};
WorldPacket BuildWarningAnnPacket(std::string msg);
WorldPacket BuildWarningAnnPacket(std::string const& msg);
void SendWarningToAllInZone(uint32 entry);
//void SendWarningToAllInWar(int32 entry, ...); -- UNUSED
void SendWarningToPlayer(Player* player, uint32 entry);
+2 -2
View File
@@ -38,7 +38,7 @@ ArenaTeam::ArenaTeam()
ArenaTeam::~ArenaTeam()
{ }
bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor)
{
// Check if captain is present
if (!ObjectAccessor::FindPlayer(captainGuid))
@@ -479,7 +479,7 @@ void ArenaTeam::BroadcastPacket(WorldPacket* packet)
player->GetSession()->SendPacket(packet);
}
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3)
void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3)
{
WorldPacket data(SMSG_ARENA_TEAM_EVENT, 1+1+1);
data << uint8(event);
+4 -4
View File
@@ -119,7 +119,7 @@ class ArenaTeam
ArenaTeam();
~ArenaTeam();
bool Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
bool Create(uint64 captainGuid, uint8 type, std::string const& teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor);
void Disband(WorldSession* session);
typedef std::list<ArenaTeamMember> MemberList;
@@ -129,7 +129,7 @@ class ArenaTeam
uint8 GetSlot() const { return GetSlotByType(GetType()); }
static uint8 GetSlotByType(uint32 type);
uint64 GetCaptain() const { return CaptainGuid; }
std::string GetName() const { return TeamName; }
std::string const& GetName() const { return TeamName; }
const ArenaTeamStats& GetStats() const { return Stats; }
uint32 GetRating() const { return Stats.Rating; }
@@ -149,7 +149,7 @@ class ArenaTeam
bool IsMember(uint64 guid) const;
ArenaTeamMember* GetMember(uint64 guid);
ArenaTeamMember* GetMember(const std::string& name);
ArenaTeamMember* GetMember(std::string const& name);
bool IsFighting() const;
@@ -159,7 +159,7 @@ class ArenaTeam
void SaveToDB();
void BroadcastPacket(WorldPacket* packet);
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3);
void BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string const& str1, std::string const& str2, std::string const& str3);
void NotifyStatsChanged();
void Roster(WorldSession* session);
+6 -6
View File
@@ -46,8 +46,8 @@ class CalendarInvite
void SetStatusTime(uint32 statusTime) { _statusTime = statusTime; }
uint32 GetStatusTime() const { return _statusTime; }
void SetText(std::string text) { _text = text; }
std::string GetText() const { return _text; }
void SetText(std::string const& text) { _text = text; }
std::string const& GetText() const { return _text; }
void SetStatus(CalendarInviteStatus status) { _status = status; }
CalendarInviteStatus GetStatus() const { return _status; }
@@ -89,11 +89,11 @@ class CalendarEvent
void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; }
void SetTitle(std::string title) { _title = title; }
std::string GetTitle() const { return _title; }
void SetTitle(std::string const& title) { _title = title; }
std::string const& GetTitle() const { return _title; }
void SetDescription(std::string description) { _description = description; }
std::string GetDescription() const { return _description; }
void SetDescription(std::string const& description) { _description = description; }
std::string const& GetDescription() const { return _description; }
void SetType(CalendarEventType type) { _type = type; }
CalendarEventType GetType() const { return _type; }
+7 -7
View File
@@ -172,7 +172,7 @@ class Channel
void MakeNotModerator(WorldPacket* data); //? 0x06
void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07
void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08
void MakePlayerNotFound(WorldPacket* data, const std::string& name); //+ 0x09
void MakePlayerNotFound(WorldPacket* data, std::string const& name); //+ 0x09
void MakeNotOwner(WorldPacket* data); //? 0x0A
void MakeChannelOwner(WorldPacket* data); //? 0x0B
void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C
@@ -183,15 +183,15 @@ class Channel
void MakeBanned(WorldPacket* data); //? 0x13
void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14
void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15
void MakePlayerNotBanned(WorldPacket* data, const std::string& name); //? 0x16
void MakePlayerNotBanned(WorldPacket* data, std::string const& name); //? 0x16
void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17
void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18
void MakeInviteWrongFaction(WorldPacket* data); //? 0x19
void MakeWrongFaction(WorldPacket* data); //? 0x1A
void MakeInvalidName(WorldPacket* data); //? 0x1B
void MakeNotModerated(WorldPacket* data); //? 0x1C
void MakePlayerInvited(WorldPacket* data, const std::string& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket* data, const std::string &name);//? 0x1E
void MakePlayerInvited(WorldPacket* data, std::string const& name); //+ 0x1D
void MakePlayerInviteBanned(WorldPacket* data, std::string const& name);//? 0x1E
void MakeThrottled(WorldPacket* data); //? 0x1F
void MakeNotInArea(WorldPacket* data); //? 0x20
void MakeNotInLfg(WorldPacket* data); //? 0x21
@@ -245,14 +245,14 @@ class Channel
public:
uint32 m_Team;
Channel(const std::string& name, uint32 channel_id, uint32 Team = 0);
Channel(std::string const& name, uint32 channel_id, uint32 Team = 0);
std::string const& GetName() const { return m_name; }
uint32 GetChannelId() const { return m_channelId; }
bool IsConstant() const { return m_channelId != 0; }
bool IsAnnounce() const { return m_announce; }
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
std::string GetPassword() const { return m_password; }
void SetPassword(const std::string& npassword) { m_password = npassword; }
std::string const& GetPassword() const { return m_password; }
void SetPassword(std::string const& npassword) { m_password = npassword; }
void SetAnnounce(bool nannounce) { m_announce = nannounce; }
uint32 GetNumPlayers() const { return players.size(); }
uint8 GetFlags() const { return m_flags; }
+1 -1
View File
@@ -128,7 +128,7 @@ class ChatHandler
protected:
explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd);
bool ExecuteCommandInTable(ChatCommand* table, const char* text, std::string const& fullcmd);
bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd);
private:
+1 -1
View File
@@ -156,7 +156,7 @@ struct LfgJoinResultData
struct LfgUpdateData
{
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") {}
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string _comment):
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
updateType(_type), dungeons(_dungeons), comment(_comment) {}
LfgUpdateType updateType;
+1 -1
View File
@@ -584,7 +584,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId, language, TargetGuid); }
// override WorldObject function for proper name localization
std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const;
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void setDeathState(DeathState s); // override virtual Unit::setDeathState
@@ -645,7 +645,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId, language, TargetGuid); }
// overwrite WorldObject function for proper name localization
std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const;
std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const;
void SaveToDB();
void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
+2 -2
View File
@@ -655,7 +655,7 @@ class WorldObject : public Object, public WorldLocation
InstanceScript* GetInstanceScript();
std::string const& GetName() const { return m_name; }
void SetName(const std::string& newname) { m_name=newname; }
void SetName(std::string const& newname) { m_name=newname; }
virtual std::string const& GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return m_name; }
@@ -743,7 +743,7 @@ class WorldObject : public Object, public WorldLocation
void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false);
void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false);
void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid);
void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const &name, uint64 TargetGuid) const;
void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, std::string const& name, uint64 TargetGuid) const;
void PlayDistanceSound(uint32 sound_id, Player* target = NULL);
void PlayDirectSound(uint32 sound_id, Player* target = NULL);
+5 -7
View File
@@ -190,16 +190,14 @@ void PlayerTaxi::InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level
SetTaximaskNode(213); //Shattered Sun Staging Area
}
void PlayerTaxi::LoadTaxiMask(const char* data)
void PlayerTaxi::LoadTaxiMask(std::string const &data)
{
Tokenizer tokens(data, ' ');
uint8 index;
Tokenizer::const_iterator iter;
for (iter = tokens.begin(), index = 0;
(index < TaxiMaskSize) && (iter != tokens.end()); ++iter, ++index)
uint8 index = 0;
for (Tokenizer::const_iterator iter = tokens.begin(); index < TaxiMaskSize && iter != tokens.end(); ++iter, ++index)
{
// load and set bits only for existed taxi nodes
// load and set bits only for existing taxi nodes
m_taximask[index] = sTaxiNodesMask[index] & uint32(atol(*iter));
}
}
@@ -17062,7 +17060,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
m_resetTalentsCost = fields[24].GetUInt32();
m_resetTalentsTime = time_t(fields[25].GetUInt32());
m_taxi.LoadTaxiMask(fields[17].GetCString()); // must be before InitTaxiNodesForLevel
m_taxi.LoadTaxiMask(fields[17].GetString()); // must be before InitTaxiNodesForLevel
uint32 extraflags = fields[31].GetUInt16();
+7 -7
View File
@@ -911,7 +911,7 @@ class PlayerTaxi
~PlayerTaxi() {}
// Nodes
void InitTaxiNodesForLevel(uint32 race, uint32 chrClass, uint8 level);
void LoadTaxiMask(const char* data);
void LoadTaxiMask(std::string const& data);
bool IsTaximaskNodeKnown(uint32 nodeidx) const
{
@@ -934,7 +934,7 @@ class PlayerTaxi
void AppendTaximaskTo(ByteBuffer& data, bool all);
// Destinations
bool LoadTaxiDestinationsFromString(const std::string& values, uint32 team);
bool LoadTaxiDestinationsFromString(std::string const& values, uint32 team);
std::string SaveTaxiDestinationsToString();
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
@@ -1198,11 +1198,11 @@ class Player : public Unit, public GridObject<Player>
void RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent = false);
uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn
void Say(const std::string& text, const uint32 language);
void Yell(const std::string& text, const uint32 language);
void TextEmote(const std::string& text);
void Whisper(const std::string& text, const uint32 language, uint64 receiver);
void BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std::string& text, uint32 language) const;
void Say(std::string const& text, const uint32 language);
void Yell(std::string const& text, const uint32 language);
void TextEmote(std::string const& text);
void Whisper(std::string const& text, const uint32 language, uint64 receiver);
void BuildPlayerChat(WorldPacket* data, uint8 msgtype, std::string const& text, uint32 language) const;
/*********************************************************/
/*** STORAGE SYSTEM ***/
+1 -1
View File
@@ -57,7 +57,7 @@ struct FriendInfo
FriendInfo() : Status(FRIEND_STATUS_OFFLINE), Flags(0), Area(0), Level(0), Class(0), Note()
{ }
FriendInfo(uint8 flags, const std::string& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note)
FriendInfo(uint8 flags, std::string const& note) : Status(FRIEND_STATUS_OFFLINE), Flags(flags), Area(0), Level(0), Class(0), Note(note)
{ }
};
+2 -3
View File
@@ -1865,7 +1865,7 @@ Player* ObjectMgr::GetPlayerByLowGUID(uint32 lowguid) const
}
// name must be checked to correctness (if received) before call this function
uint64 ObjectMgr::GetPlayerGUIDByName(std::string name) const
uint64 ObjectMgr::GetPlayerGUIDByName(std::string const& name) const
{
uint64 guid = 0;
@@ -7062,7 +7062,7 @@ void ObjectMgr::DeleteCorpseCellData(uint32 mapid, uint32 cellid, uint32 player_
cell_guids.corpses.erase(player_guid);
}
void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go)
void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go)
{
uint32 oldMSTime = getMSTime();
@@ -7075,7 +7075,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
if (!result)
{
sLog->outError(LOG_FILTER_SQL, ">> Loaded 0 quest relations from `%s`, table is empty.", table.c_str());
return;
}
+10 -10
View File
@@ -665,11 +665,11 @@ class ObjectMgr
void GetPlayerLevelInfo(uint32 race, uint32 class_, uint8 level, PlayerLevelInfo* info) const;
uint64 GetPlayerGUIDByName(std::string name) const;
uint64 GetPlayerGUIDByName(std::string const& name) const;
bool GetPlayerNameByGUID(uint64 guid, std::string &name) const;
uint32 GetPlayerTeamByGUID(uint64 guid) const;
uint32 GetPlayerAccountIdByGUID(uint64 guid) const;
uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const;
uint32 GetPlayerAccountIdByPlayerName(std::string const& name) const;
uint32 GetNearestTaxiNode(float x, float y, float z, uint32 mapid, uint32 team);
void GetTaxiPath(uint32 source, uint32 destination, uint32 &path, uint32 &cost);
@@ -1057,12 +1057,12 @@ class ObjectMgr
// reserved names
void LoadReservedPlayersNames();
bool IsReservedName(const std::string& name) const;
bool IsReservedName(std::string const& name) const;
// name with valid structure and symbols
static uint8 CheckPlayerName(const std::string& name, bool create = false);
static PetNameInvalidReason CheckPetName(const std::string& name);
static bool IsValidCharterName(const std::string& name);
static uint8 CheckPlayerName(std::string const& name, bool create = false);
static PetNameInvalidReason CheckPetName(std::string const& name);
static bool IsValidCharterName(std::string const& name);
static bool CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& names);
@@ -1072,10 +1072,10 @@ class ObjectMgr
if (itr == _gameTeleStore.end()) return NULL;
return &itr->second;
}
GameTele const* GetGameTele(const std::string& name) const;
GameTele const* GetGameTele(std::string const& name) const;
GameTeleContainer const& GetGameTeleMap() const { return _gameTeleStore; }
bool AddGameTele(GameTele& data);
bool DeleteGameTele(const std::string& name);
bool DeleteGameTele(std::string const& name);
TrainerSpellData const* GetNpcTrainerSpells(uint32 entry) const
{
@@ -1130,7 +1130,7 @@ class ObjectMgr
// for wintergrasp only
GraveYardContainer GraveYardStore;
static void AddLocaleString(const std::string& s, LocaleConstant locale, StringVector& data);
static void AddLocaleString(std::string const& s, LocaleConstant locale, StringVector& data);
static inline void GetLocaleString(const StringVector& data, int loc_idx, std::string& value)
{
if (data.size() > size_t(loc_idx) && !data[loc_idx].empty())
@@ -1222,7 +1222,7 @@ class ObjectMgr
private:
void LoadScripts(ScriptsType type);
void CheckScripts(ScriptsType type, std::set<int32>& ids);
void LoadQuestRelationsHelper(QuestRelations& map, std::string table, bool starter, bool go);
void LoadQuestRelationsHelper(QuestRelations& map, std::string const& table, bool starter, bool go);
void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count);
MailLevelRewardContainer _mailLevelRewardStore;
+28 -28
View File
@@ -260,18 +260,18 @@ private:
Member(uint32 guildId, uint64 guid, uint8 rankId) : m_guildId(guildId), m_guid(guid), m_logoutTime(::time(NULL)), m_rankId(rankId) { }
void SetStats(Player* player);
void SetStats(const std::string& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId);
void SetStats(std::string const& name, uint8 level, uint8 _class, uint32 zoneId, uint32 accountId);
bool CheckStats() const;
void SetPublicNote(const std::string& publicNote);
void SetOfficerNote(const std::string& officerNote);
void SetPublicNote(std::string const& publicNote);
void SetOfficerNote(std::string const& officerNote);
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
void WritePacket(WorldPacket& data) const;
uint64 GetGUID() const { return m_guid; }
std::string GetName() const { return m_name; }
std::string const& GetName() const { return m_name; }
uint32 GetAccountId() const { return m_accountId; }
uint8 GetRankId() const { return m_rankId; }
@@ -414,7 +414,7 @@ private:
{
public:
RankInfo(uint32 guildId) : m_guildId(guildId), m_rankId(GUILD_RANK_NONE), m_rights(GR_RIGHT_EMPTY), m_bankMoneyPerDay(0) { }
RankInfo(uint32 guildId, uint8 rankId, const std::string& name, uint32 rights, uint32 money) :
RankInfo(uint32 guildId, uint8 rankId, std::string const& name, uint32 rights, uint32 money) :
m_guildId(guildId), m_rankId(rankId), m_name(name), m_rights(rights), m_bankMoneyPerDay(money) { }
void LoadFromDB(Field* fields);
@@ -423,8 +423,8 @@ private:
uint8 GetId() const { return m_rankId; }
std::string GetName() const { return m_name; }
void SetName(const std::string& name);
std::string const& GetName() const { return m_name; }
void SetName(std::string const& name);
uint32 GetRights() const { return m_rights; }
void SetRights(uint32 rights);
@@ -471,8 +471,8 @@ private:
data << m_icon;
}
void SetInfo(const std::string& name, const std::string& icon);
void SetText(const std::string& text);
void SetInfo(std::string const& name, std::string const& icon);
void SetText(std::string const& text);
void SendText(const Guild* guild, WorldSession* session) const;
inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; }
@@ -579,39 +579,39 @@ private:
typedef std::vector<BankTab*> BankTabs;
public:
static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, const std::string& param = "");
static void SendCommandResult(WorldSession* session, GuildCommandType type, GuildCommandError errCode, std::string const& param = "");
static void SendSaveEmblemResult(WorldSession* session, GuildEmblemError errCode);
Guild();
~Guild();
bool Create(Player* pLeader, const std::string& name);
bool Create(Player* pLeader, std::string const& name);
void Disband();
// Getters
uint32 GetId() const { return m_id; }
uint64 GetLeaderGUID() const { return m_leaderGuid; }
const std::string& GetName() const { return m_name; }
const std::string& GetMOTD() const { return m_motd; }
const std::string& GetInfo() const { return m_info; }
std::string const& GetName() const { return m_name; }
std::string const& GetMOTD() const { return m_motd; }
std::string const& GetInfo() const { return m_info; }
// Handle client commands
void HandleRoster(WorldSession* session = NULL); // NULL = broadcast
void HandleQuery(WorldSession* session);
void HandleSetMOTD(WorldSession* session, const std::string& motd);
void HandleSetInfo(WorldSession* session, const std::string& info);
void HandleSetMOTD(WorldSession* session, std::string const& motd);
void HandleSetInfo(WorldSession* session, std::string const& info);
void HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo);
void HandleSetLeader(WorldSession* session, const std::string& name);
void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, const std::string& name, const std::string& icon);
void HandleSetMemberNote(WorldSession* session, const std::string& name, const std::string& note, bool officer);
void HandleSetRankInfo(WorldSession* session, uint8 rankId, const std::string& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots);
void HandleSetLeader(WorldSession* session, std::string const& name);
void HandleSetBankTabInfo(WorldSession* session, uint8 tabId, std::string const& name, std::string const& icon);
void HandleSetMemberNote(WorldSession* session, std::string const& name, std::string const& note, bool officer);
void HandleSetRankInfo(WorldSession* session, uint8 rankId, std::string const& name, uint32 rights, uint32 moneyPerDay, GuildBankRightsAndSlotsVec rightsAndSlots);
void HandleBuyBankTab(WorldSession* session, uint8 tabId);
void HandleInviteMember(WorldSession* session, const std::string& name);
void HandleInviteMember(WorldSession* session, std::string const& name);
void HandleAcceptMember(WorldSession* session);
void HandleLeaveMember(WorldSession* session);
void HandleRemoveMember(WorldSession* session, const std::string& name);
void HandleUpdateMemberRank(WorldSession* session, const std::string& name, bool demote);
void HandleAddNewRank(WorldSession* session, const std::string& name);
void HandleRemoveMember(WorldSession* session, std::string const& name);
void HandleUpdateMemberRank(WorldSession* session, std::string const& name, bool demote);
void HandleAddNewRank(WorldSession* session, std::string const& name);
void HandleRemoveLowestRank(WorldSession* session);
void HandleMemberDepositMoney(WorldSession* session, uint32 amount);
bool HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair = false);
@@ -641,7 +641,7 @@ public:
bool Validate();
// Broadcasts
void BroadcastToGuild(WorldSession* session, bool officerOnly, const std::string& msg, uint32 language = LANG_UNIVERSAL) const;
void BroadcastToGuild(WorldSession* session, bool officerOnly, std::string const& msg, uint32 language = LANG_UNIVERSAL) const;
void BroadcastPacketToRank(WorldPacket* packet, uint8 rankId) const;
void BroadcastPacket(WorldPacket* packet) const;
@@ -665,7 +665,7 @@ public:
void SwapItemsWithInventory(Player* player, bool toChar, uint8 tabId, uint8 slotId, uint8 playerBag, uint8 playerSlotId, uint32 splitedAmount);
// Bank tabs
void SetBankTabText(uint8 tabId, const std::string& text);
void SetBankTabText(uint8 tabId, std::string const& text);
protected:
uint32 m_id;
@@ -708,7 +708,7 @@ private:
Members::iterator itr = m_members.find(GUID_LOPART(guid));
return itr != m_members.end() ? itr->second : NULL;
}
inline Member* GetMember(WorldSession* session, const std::string& name)
inline Member* GetMember(WorldSession* session, std::string const& name)
{
for (Members::iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if (itr->second->GetName() == name)
@@ -731,7 +731,7 @@ private:
// Creates default guild ranks with names in given locale
void _CreateDefaultGuildRanks(LocaleConstant loc);
// Creates new rank
void _CreateRank(const std::string& name, uint32 rights);
void _CreateRank(std::string const& name, uint32 rights);
// Update account number when member added/removed from guild
void _UpdateAccountsNumber();
bool _IsLeader(Player* player) const;
+1 -1
View File
@@ -32,7 +32,7 @@ public:
Guild* GetGuildByLeader(uint64 guid) const;
Guild* GetGuildById(uint32 guildId) const;
Guild* GetGuildByName(const std::string& guildName) const;
Guild* GetGuildByName(std::string const& guildName) const;
std::string GetGuildNameById(uint32 guildId) const;
void LoadGuilds();
@@ -1145,7 +1145,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data)
_charRenameCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string newName)
void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName)
{
if (!result)
{
+2 -2
View File
@@ -604,14 +604,14 @@ void WorldSession::HandleChannelDeclineInvite(WorldPacket &recvPacket)
sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode());
}
void WorldSession::SendPlayerNotFoundNotice(std::string name)
void WorldSession::SendPlayerNotFoundNotice(std::string const& name)
{
WorldPacket data(SMSG_CHAT_PLAYER_NOT_FOUND, name.size()+1);
data << name;
SendPacket(&data);
}
void WorldSession::SendPlayerAmbiguousNotice(std::string name)
void WorldSession::SendPlayerAmbiguousNotice(std::string const& name)
{
WorldPacket data(SMSG_CHAT_PLAYER_AMBIGUOUS, name.size()+1);
data << name;
+1 -1
View File
@@ -557,7 +557,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData)
_addFriendCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
}
void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string friendNote)
void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote)
{
if (!GetPlayer())
return;
+1 -1
View File
@@ -119,7 +119,7 @@ class MailDraft
explicit MailDraft(uint16 mailTemplateId, bool need_items = true)
: m_mailTemplateId(mailTemplateId), m_mailTemplateItemsNeed(need_items), m_money(0), m_COD(0)
{}
MailDraft(std::string subject, std::string body)
MailDraft(std::string const& subject, std::string const& body)
: m_mailTemplateId(0), m_mailTemplateItemsNeed(false), m_subject(subject), m_body(body), m_money(0), m_COD(0) {}
public: // Accessors
uint16 GetMailTemplateId() const { return m_mailTemplateId; }
+28 -31
View File
@@ -45,6 +45,12 @@
#include "WardenWin.h"
#include "WardenMac.h"
namespace {
std::string const DefaultPlayerName = "<none>";
} // namespace
bool MapSessionFilter::Process(WorldPacket* packet)
{
OpcodeHandler const& opHandle = opcodeTable[packet->GetOpcode()];
@@ -137,29 +143,20 @@ WorldSession::~WorldSession()
LoginDatabase.PExecute("UPDATE account SET online = 0 WHERE id = %u;", GetAccountId()); // One-time query
}
/// Get the player name
std::string WorldSession::GetPlayerName(bool simple /* = true */) const
{
std::string name = "[Player: ";
uint32 guidLow = 0;
std::string const & WorldSession::GetPlayerName() const
{
return _player != NULL ? _player->GetName() : DefaultPlayerName;
}
if (Player* player = GetPlayer())
{
name.append(player->GetName());
guidLow = player->GetGUIDLow();
}
else
name.append("<none>");
std::string WorldSession::GetPlayerInfo() const
{
std::ostringstream ss;
if (!simple)
{
std::ostringstream ss;
ss << " (Guid: " << guidLow << ", Account: " << GetAccountId() << ")";
name.append(ss.str());
}
ss << "[Player: " << GetPlayerName()
<< " (Guid: " << (_player != NULL ? _player->GetGUID() : 0)
<< ", Account: " << GetAccountId() << ")]";
name.append("]");
return name;
return ss.str();
}
/// Get player guid if available. Use for logging purposes only
@@ -222,14 +219,14 @@ void WorldSession::QueuePacket(WorldPacket* new_packet)
void WorldSession::LogUnexpectedOpcode(WorldPacket* packet, const char* status, const char *reason)
{
sLog->outError(LOG_FILTER_OPCODES, "Received unexpected opcode %s Status: %s Reason: %s from %s",
GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerName(false).c_str());
GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), status, reason, GetPlayerInfo().c_str());
}
/// Logging helper for unexpected opcodes
void WorldSession::LogUnprocessedTail(WorldPacket* packet)
{
sLog->outError(LOG_FILTER_OPCODES, "Unprocessed tail data (read stop at %u from %u) Opcode %s from %s",
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerName(false).c_str());
uint32(packet->rpos()), uint32(packet->wpos()), GetOpcodeNameForLogging(packet->GetOpcode()).c_str(), GetPlayerInfo().c_str());
packet->print_storage();
}
@@ -263,7 +260,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
if (packet->GetOpcode() >= NUM_MSG_TYPES)
{
sLog->outError(LOG_FILTER_OPCODES, "Received non-existed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerName(false).c_str());
, GetPlayerInfo().c_str());
sScriptMgr->OnUnknownPacketReceive(m_Socket, WorldPacket(*packet));
}
else
@@ -347,11 +344,11 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
break;
case STATUS_NEVER:
sLog->outError(LOG_FILTER_OPCODES, "Received not allowed opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerName(false).c_str());
, GetPlayerInfo().c_str());
break;
case STATUS_UNHANDLED:
sLog->outDebug(LOG_FILTER_OPCODES, "Received not handled opcode %s from %s", GetOpcodeNameForLogging(packet->GetOpcode()).c_str()
, GetPlayerName(false).c_str());
, GetPlayerInfo().c_str());
break;
}
}
@@ -620,25 +617,25 @@ const char *WorldSession::GetTrinityString(int32 entry) const
void WorldSession::Handle_NULL(WorldPacket& recvPacket)
{
sLog->outError(LOG_FILTER_OPCODES, "Received unhandled opcode %s from %s"
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::Handle_EarlyProccess(WorldPacket& recvPacket)
{
sLog->outError(LOG_FILTER_OPCODES, "Received opcode %s that must be processed in WorldSocket::OnRead from %s"
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::Handle_ServerSide(WorldPacket& recvPacket)
{
sLog->outError(LOG_FILTER_OPCODES, "Received server-side opcode %s from %s"
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::Handle_Deprecated(WorldPacket& recvPacket)
{
sLog->outError(LOG_FILTER_OPCODES, "Received deprecated opcode %s from %s"
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerName(false).c_str());
, GetOpcodeNameForLogging(recvPacket.GetOpcode()).c_str(), GetPlayerInfo().c_str());
}
void WorldSession::SendAuthWaitQue(uint32 position)
@@ -699,7 +696,7 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask)
while (result->NextRow());
}
void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string data)
void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string const& data)
{
uint32 id = 0;
uint32 index = 0;
@@ -1179,7 +1176,7 @@ void WorldSession::ProcessQueryCallbacks()
}
}
void WorldSession::InitWarden(BigNumber* k, std::string os)
void WorldSession::InitWarden(BigNumber* k, std::string const& os)
{
if (os == "Win")
{
+14 -12
View File
@@ -197,7 +197,7 @@ class CharacterCreateInfo
friend class Player;
protected:
CharacterCreateInfo(std::string name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId,
CharacterCreateInfo(std::string const& name, uint8 race, uint8 cclass, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId,
WorldPacket& data) : Name(name), Race(race), Class(cclass), Gender(gender), Skin(skin), Face(face), HairStyle(hairStyle), HairColor(hairColor), FacialHair(facialHair),
OutfitId(outfitId), Data(data), CharCount(0)
{}
@@ -243,8 +243,8 @@ class WorldSession
void SendPacket(WorldPacket const* packet);
void SendNotification(const char *format, ...) ATTR_PRINTF(2, 3);
void SendNotification(uint32 string_id, ...);
void SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName);
void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res, uint32 val = 0);
void SendPetNameInvalid(uint32 error, std::string const& name, DeclinedName *declinedName);
void SendPartyResult(PartyOperation operation, std::string const& member, PartyResult res, uint32 val = 0);
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3);
void SendSetPhaseShift(uint32 phaseShift);
void SendQueryTimeResponse();
@@ -255,14 +255,16 @@ class WorldSession
AccountTypes GetSecurity() const { return _security; }
uint32 GetAccountId() const { return _accountId; }
Player* GetPlayer() const { return _player; }
std::string GetPlayerName(bool simple = true) const;
std::string const& GetPlayerName() const;
std::string GetPlayerInfo() const;
uint32 GetGuidLow() const;
void SetSecurity(AccountTypes security) { _security = security; }
std::string const& GetRemoteAddress() { return m_Address; }
void SetPlayer(Player* player);
uint8 Expansion() const { return m_expansion; }
void InitWarden(BigNumber* k, std::string os);
void InitWarden(BigNumber* k, std::string const& os);
/// Session in auth.queue currently
void SetInQueue(bool state) { m_inQueue = state; }
@@ -295,7 +297,7 @@ class WorldSession
void SendNameQueryOpcode(uint64 guid);
void SendTrainerList(uint64 guid);
void SendTrainerList(uint64 guid, const std::string& strTitle);
void SendTrainerList(uint64 guid, std::string const& strTitle);
void SendListInventory(uint64 guid);
void SendShowBank(uint64 guid);
void SendTabardVendorActivate(uint64 guid);
@@ -324,7 +326,7 @@ class WorldSession
// Account Data
AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; }
void SetAccountData(AccountDataType type, time_t tm, std::string data);
void SetAccountData(AccountDataType type, time_t tm, std::string const& data);
void SendAccountDataTimes(uint32 mask);
void LoadGlobalAccountData();
void LoadAccountData(PreparedQueryResult result, uint32 mask);
@@ -361,7 +363,7 @@ class WorldSession
void SendDiscoverNewTaxiNode(uint32 nodeid);
// Guild/Arena Team
void SendArenaTeamCommandResult(uint32 team_action, const std::string& team, const std::string& player, uint32 error_id);
void SendArenaTeamCommandResult(uint32 team_action, std::string const& team, std::string const& player, uint32 error_id);
void SendNotInArenaTeamPacket(uint8 type);
void SendPetitionShowList(uint64 guid);
@@ -483,7 +485,7 @@ class WorldSession
void HandleEmoteOpcode(WorldPacket& recvPacket);
void HandleContactListOpcode(WorldPacket& recvPacket);
void HandleAddFriendOpcode(WorldPacket& recvPacket);
void HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string friendNote);
void HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote);
void HandleDelFriendOpcode(WorldPacket& recvPacket);
void HandleAddIgnoreOpcode(WorldPacket& recvPacket);
void HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result);
@@ -702,8 +704,8 @@ class WorldSession
bool processChatmessageFurtherAfterSecurityChecks(std::string&, uint32);
void HandleMessagechatOpcode(WorldPacket& recvPacket);
void SendPlayerNotFoundNotice(std::string name);
void SendPlayerAmbiguousNotice(std::string name);
void SendPlayerNotFoundNotice(std::string const& name);
void SendPlayerAmbiguousNotice(std::string const& name);
void SendWrongFactionNotice();
void SendChatRestrictedNotice(ChatRestrictionType restriction);
void HandleTextEmoteOpcode(WorldPacket& recvPacket);
@@ -763,7 +765,7 @@ class WorldSession
void HandleSetActionBarToggles(WorldPacket& recv_data);
void HandleCharRenameOpcode(WorldPacket& recv_data);
void HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string newName);
void HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult result, std::string const& newName);
void HandleSetPlayerDeclinedNames(WorldPacket& recv_data);
void HandleTotemDestroyed(WorldPacket& recv_data);
+2 -2
View File
@@ -683,7 +683,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
case CMSG_AUTH_SESSION:
if (m_Session)
{
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerName(false).c_str());
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::ProcessIncoming: received duplicate CMSG_AUTH_SESSION from %s", m_Session->GetPlayerInfo().c_str());
return -1;
}
@@ -1006,7 +1006,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity()))
{
sLog->outError(LOG_FILTER_NETWORKIO, "WorldSocket::HandlePing: %s kicked for over-speed pings (address: %s)",
m_Session->GetPlayerName(false).c_str(), GetRemoteAddress().c_str());
m_Session->GetPlayerInfo().c_str(), GetRemoteAddress().c_str());
return -1;
}
+4 -2
View File
@@ -72,6 +72,8 @@ class _SpellScript
{
public:
EffectHook(uint8 _effIndex);
virtual ~EffectHook() { }
uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry);
bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex);
virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0;
@@ -83,7 +85,7 @@ class _SpellScript
class EffectNameCheck
{
public:
EffectNameCheck(uint16 _effName) {effName = _effName;};
EffectNameCheck(uint16 _effName) { effName = _effName; }
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
private:
@@ -118,7 +120,7 @@ class _SpellScript
virtual bool Load() { return true; }
// Function called when script is destroyed
// use for: deallocating memory allocated by script
virtual void Unload() {}
virtual void Unload() { }
};
// SpellScript interface - enum used for runtime checks of script function calls
+6 -6
View File
@@ -94,8 +94,8 @@ public:
uint32 GetId() const { return _id; }
Player* GetPlayer() const { return ObjectAccessor::FindPlayer(_playerGuid); }
std::string GetPlayerName() const { return _playerName; }
std::string GetMessage() const { return _message; }
std::string const& GetPlayerName() const { return _playerName; }
std::string const& GetMessage() const { return _message; }
Player* GetAssignedPlayer() const { return ObjectAccessor::FindPlayer(_assignedTo); }
uint64 GetAssignedToGUID() const { return _assignedTo; }
std::string GetAssignedToName() const
@@ -120,16 +120,16 @@ public:
_escalatedStatus = TICKET_ASSIGNED;
}
void SetClosedBy(const int64& value) { _closedBy = value; }
void SetMessage(const std::string& message)
void SetMessage(std::string const& message)
{
_message = message;
_lastModifiedTime = uint64(time(NULL));
}
void SetComment(const std::string& comment) { _comment = comment; }
void SetComment(std::string const& comment) { _comment = comment; }
void SetViewed() { _viewed = true; }
void SetUnassigned();
void AppendResponse(const std::string& response) { _response += response; }
void AppendResponse(std::string const& response) { _response += response; }
bool LoadFromDB(Field* fields);
void SaveToDB(SQLTransaction& trans) const;
@@ -143,7 +143,7 @@ public:
std::string FormatMessageString(ChatHandler& handler, const char* szClosedName, const char* szAssignedToName, const char* szUnassignedName, const char* szDeletedName) const;
void SetChatLog(std::list<uint32> time, std::string const& log);
std::string GetChatLog() const { return _chatLog; }
std::string const& GetChatLog() const { return _chatLog; }
private:
uint32 _id;
+4 -4
View File
@@ -117,7 +117,7 @@ std::string gettablename(std::string &str)
return str.substr(s, e-s);
}
bool changenth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false)
bool changenth(std::string &str, int n, char const* with, bool insert = false, bool nonzero = false)
{
std::string::size_type s, e;
if (!findnth(str, n, s, e))
@@ -142,7 +142,7 @@ std::string getnth(std::string &str, int n)
return str.substr(s, e-s);
}
bool changetoknth(std::string &str, int n, const char *with, bool insert = false, bool nonzero = false)
bool changetoknth(std::string &str, int n, char const* with, bool insert = false, bool nonzero = false)
{
std::string::size_type s = 0, e = 0;
if (!findtoknth(str, n, s, e))
@@ -198,7 +198,7 @@ std::string CreateDumpString(char const* tableName, QueryResult result)
{
if (!tableName || !result) return "";
std::ostringstream ss;
ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
ss << "INSERT INTO " << _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES (";
Field* fields = result->Fetch();
for (uint32 i = 0; i < result->GetFieldCount(); ++i)
{
@@ -395,7 +395,7 @@ void fixNULLfields(std::string &line)
}
}
DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid)
DumpReturn PlayerDumpReader::LoadDump(std::string const& file, uint32 account, std::string name, uint32 guid)
{
uint32 charcount = AccountMgr::GetCharactersCount(account);
if (charcount >= 10)
+2 -3
View File
@@ -73,7 +73,7 @@ class PlayerDumpWriter : public PlayerDump
PlayerDumpWriter() {}
bool GetDump(uint32 guid, std::string& dump);
DumpReturn WriteDump(const std::string& file, uint32 guid);
DumpReturn WriteDump(std::string const& file, uint32 guid);
private:
typedef std::set<uint32> GUIDs;
@@ -91,8 +91,7 @@ class PlayerDumpReader : public PlayerDump
public:
PlayerDumpReader() {}
DumpReturn LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid);
DumpReturn LoadDump(std::string const& file, uint32 account, std::string name, uint32 guid);
};
#endif
+1 -1
View File
@@ -106,7 +106,7 @@ void Warden::Update()
if (_clientResponseTimer > maxClientResponseDelay * IN_MILLISECONDS)
{
sLog->outWarn(LOG_FILTER_WARDEN, "%s (latency: %u, IP: %s) exceeded Warden module response delay for more than %s - disconnecting client",
_session->GetPlayerName(false).c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str());
_session->GetPlayerInfo().c_str(), _session->GetLatency(), _session->GetRemoteAddress().c_str(), secsToTimeString(maxClientResponseDelay, true).c_str());
_session->KickPlayer();
}
else
+1 -1
View File
@@ -152,7 +152,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, sha1.GetDigest(), 20) != 0)
{
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
+4 -4
View File
@@ -156,7 +156,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff)
// Verify key
if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, 20) != 0)
{
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed hash reply. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
@@ -341,7 +341,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length))
{
buff.rpos(buff.wpos());
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed checksum. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
@@ -352,7 +352,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
// TODO: test it.
if (result == 0x00)
{
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerName(false).c_str(), Penalty().c_str());
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed timing check. Action: %s", _session->GetPlayerInfo().c_str(), Penalty().c_str());
return;
}
@@ -494,7 +494,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
if (checkFailed > 0)
{
WardenCheck* check = sWardenCheckMgr->GetWardenDataById(checkFailed);
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerName(false).c_str(), checkFailed, Penalty(check).c_str());
sLog->outWarn(LOG_FILTER_WARDEN, "%s failed Warden check %u. Action: %s", _session->GetPlayerInfo().c_str(), checkFailed, Penalty(check).c_str());
}
// Set hold off timer, minimum timer should at least be 1 second
+4 -4
View File
@@ -605,19 +605,19 @@ class World
void SetAllowMovement(bool allow) { m_allowMovement = allow; }
/// Set a new Message of the Day
void SetMotd(const std::string& motd);
void SetMotd(std::string const& motd);
/// Get the current Message of the Day
const char* GetMotd() const;
/// Set the string for new characters (first login)
void SetNewCharString(std::string str) { m_newCharString = str; }
void SetNewCharString(std::string const& str) { m_newCharString = str; }
/// Get the string for new characters (first login)
const std::string& GetNewCharString() const { return m_newCharString; }
std::string const& GetNewCharString() const { return m_newCharString; }
LocaleConstant GetDefaultDbcLocale() const { return m_defaultDbcLocale; }
/// Get the path where data (dbc, maps) are stored on disk
std::string GetDataPath() const { return m_dataPath; }
std::string const& GetDataPath() const { return m_dataPath; }
/// When server started?
time_t const& GetStartTime() const { return m_startTime; }