[6899] Pass const reference instead of value for some strings in some functions.

Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
hunuza 2008-12-12 14:16:24 +01:00
parent d386a67d27
commit 0f12997ef1
40 changed files with 108 additions and 108 deletions

View file

@ -360,7 +360,7 @@ void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_data
at->BroadcastPacket(&data); at->BroadcastPacket(&data);
} }
void WorldSession::SendArenaTeamCommandResult(uint32 unk1, std::string str1, std::string str2, uint32 unk3) void WorldSession::SendArenaTeamCommandResult(uint32 unk1, const std::string& str1, const std::string& str2, uint32 unk3)
{ {
WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+str1.length()+1+str2.length()+1+4); WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+str1.length()+1+str2.length()+1+4);
data << unk1; data << unk1;
@ -370,7 +370,7 @@ void WorldSession::SendArenaTeamCommandResult(uint32 unk1, std::string str1, std
SendPacket(&data); SendPacket(&data);
} }
void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, std::string str1, std::string str2, std::string str3) void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3)
{ {
data->Initialize(SMSG_ARENA_TEAM_EVENT, 1+1+1); data->Initialize(SMSG_ARENA_TEAM_EVENT, 1+1+1);
*data << eventid; *data << eventid;

View file

@ -21,7 +21,7 @@
#include "World.h" #include "World.h"
#include "SocialMgr.h" #include "SocialMgr.h"
Channel::Channel(std::string name, uint32 channel_id) Channel::Channel(const std::string& name, uint32 channel_id)
: m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0) : m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0)
{ {
// set special flags if built-in channel // set special flags if built-in channel
@ -773,7 +773,7 @@ void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid)
} }
// done 0x09 // done 0x09
void Channel::MakePlayerNotFound(WorldPacket *data, std::string name) void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name)
{ {
MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE); MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
*data << name; *data << name;

View file

@ -170,7 +170,7 @@ class Channel
void MakeNotModerator(WorldPacket *data); //? 0x06 void MakeNotModerator(WorldPacket *data); //? 0x06
void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07 void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07
void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08 void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08
void MakePlayerNotFound(WorldPacket *data, std::string name); //+ 0x09 void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09
void MakeNotOwner(WorldPacket *data); //? 0x0A void MakeNotOwner(WorldPacket *data); //? 0x0A
void MakeChannelOwner(WorldPacket *data); //? 0x0B void MakeChannelOwner(WorldPacket *data); //? 0x0B
void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C
@ -244,14 +244,14 @@ class Channel
} }
public: public:
Channel(std::string name, uint32 channel_id); Channel(const std::string& name, uint32 channel_id);
std::string GetName() const { return m_name; } std::string GetName() const { return m_name; }
uint32 GetChannelId() const { return m_channelId; } uint32 GetChannelId() const { return m_channelId; }
bool IsConstant() const { return m_channelId != 0; } bool IsConstant() const { return m_channelId != 0; }
bool IsAnnounce() const { return m_announce; } bool IsAnnounce() const { return m_announce; }
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; } bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
std::string GetPassword() const { return m_password; } std::string GetPassword() const { return m_password; }
void SetPassword(std::string npassword) { m_password = npassword; } void SetPassword(const std::string& npassword) { m_password = npassword; }
void SetAnnounce(bool nannounce) { m_announce = nannounce; } void SetAnnounce(bool nannounce) { m_announce = nannounce; }
uint32 GetNumPlayers() const { return players.size(); } uint32 GetNumPlayers() const { return players.size(); }
uint8 GetFlags() const { return m_flags; } uint8 GetFlags() const { return m_flags; }

View file

@ -36,7 +36,7 @@ class ChannelMgr
delete itr->second; delete itr->second;
channels.clear(); channels.clear();
} }
Channel *GetJoinChannel(std::string name, uint32 channel_id) Channel *GetJoinChannel(const std::string& name, uint32 channel_id)
{ {
if(channels.count(name) == 0) if(channels.count(name) == 0)
{ {
@ -45,7 +45,7 @@ class ChannelMgr
} }
return channels[name]; return channels[name];
} }
Channel *GetChannel(std::string name, Player *p) Channel *GetChannel(const std::string& name, Player *p)
{ {
ChannelMap::const_iterator i = channels.find(name); ChannelMap::const_iterator i = channels.find(name);
@ -59,7 +59,7 @@ class ChannelMgr
else else
return i->second; return i->second;
} }
void LeftChannel(std::string name) void LeftChannel(const std::string& name)
{ {
ChannelMap::const_iterator i = channels.find(name); ChannelMap::const_iterator i = channels.find(name);
@ -76,7 +76,7 @@ class ChannelMgr
} }
private: private:
ChannelMap channels; ChannelMap channels;
void MakeNotOnPacket(WorldPacket *data, std::string name) void MakeNotOnPacket(WorldPacket *data, const std::string& name)
{ {
data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
(*data) << (uint8)0x05 << name; (*data) << (uint8)0x05 << name;

View file

@ -706,7 +706,7 @@ void ChatHandler::PSendSysMessage(const char *format, ...)
SendSysMessage(str); SendSysMessage(str);
} }
bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, std::string fullcmd) bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd)
{ {
char const* oldtext = text; char const* oldtext = text;
std::string cmd = ""; std::string cmd = "";

View file

@ -80,7 +80,7 @@ class ChatHandler
void SendGlobalSysMessage(const char *str); void SendGlobalSysMessage(const char *str);
bool ExecuteCommandInTable(ChatCommand *table, const char* text, std::string fullcommand); bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand);
bool ShowHelpForCommand(ChatCommand *table, const char* cmd); bool ShowHelpForCommand(ChatCommand *table, const char* cmd);
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd); bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd);

View file

@ -31,7 +31,7 @@ class GMTicket
{ {
} }
GMTicket(uint32 guid, std::string text, time_t update) : m_guid(guid), m_text(text), m_lastUpdate(update) GMTicket(uint32 guid, const std::string& text, time_t update) : m_guid(guid), m_text(text), m_lastUpdate(update)
{ {
} }

View file

@ -34,7 +34,7 @@ GossipMenu::~GossipMenu()
ClearMenu(); ClearMenu();
} }
void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, uint32 dtAction, std::string BoxMessage, uint32 BoxMoney, bool Coded) void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded)
{ {
ASSERT( m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS ); ASSERT( m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS );
@ -51,7 +51,7 @@ void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, u
m_gItems.push_back(gItem); m_gItems.push_back(gItem);
} }
void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, bool Coded) void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, bool Coded)
{ {
AddMenuItem( Icon, Message, 0, 0, "", 0, Coded); AddMenuItem( Icon, Message, 0, 0, "", 0, Coded);
} }
@ -341,7 +341,7 @@ void QuestMenu::ClearMenu()
m_qItems.clear(); m_qItems.clear();
} }
void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint64 npcGUID ) void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID )
{ {
WorldPacket data( SMSG_QUESTGIVER_QUEST_LIST, 100 ); // guess size WorldPacket data( SMSG_QUESTGIVER_QUEST_LIST, 100 ); // guess size
data << uint64(npcGUID); data << uint64(npcGUID);

View file

@ -101,8 +101,8 @@ class MANGOS_DLL_SPEC GossipMenu
GossipMenu(); GossipMenu();
~GossipMenu(); ~GossipMenu();
void AddMenuItem(uint8 Icon, std::string Message, bool Coded = false); void AddMenuItem(uint8 Icon, const std::string& Message, bool Coded = false);
void AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, uint32 dtAction, std::string BoxMessage, uint32 BoxMoney, bool Coded = false); void AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded = false);
// for using from scripts, don't must be inlined // for using from scripts, don't must be inlined
void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false); void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false);
@ -195,7 +195,7 @@ class MANGOS_DLL_SPEC PlayerMenu
/*********************************************************/ /*********************************************************/
void SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ); void SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID );
void SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint64 npcGUID ); void SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID );
void SendQuestQueryResponse ( Quest const *pQuest ); void SendQuestQueryResponse ( Quest const *pQuest );
void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept); void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept);

View file

@ -517,7 +517,7 @@ void Guild::SetOFFNOTE(uint64 guid,std::string offnote)
CharacterDatabase.PExecute("UPDATE guild_member SET offnote = '%s' WHERE guid = '%u'", offnote.c_str(), itr->first); CharacterDatabase.PExecute("UPDATE guild_member SET offnote = '%s' WHERE guid = '%u'", offnote.c_str(), itr->first);
} }
void Guild::BroadcastToGuild(WorldSession *session, std::string msg, uint32 language) void Guild::BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language)
{ {
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_GCHATSPEAK)) if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_GCHATSPEAK))
{ {
@ -534,7 +534,7 @@ void Guild::BroadcastToGuild(WorldSession *session, std::string msg, uint32 lang
} }
} }
void Guild::BroadcastToOfficers(WorldSession *session, std::string msg, uint32 language) void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language)
{ {
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_OFFCHATSPEAK)) if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_OFFCHATSPEAK))
{ {
@ -593,7 +593,7 @@ void Guild::CreateRank(std::string name_,uint32 rights)
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", Id, m_ranks.size(), name_.c_str(), rights ); CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", Id, m_ranks.size(), name_.c_str(), rights );
} }
void Guild::AddRank(std::string name_,uint32 rights, uint32 money) void Guild::AddRank(const std::string& name_,uint32 rights, uint32 money)
{ {
m_ranks.push_back(RankInfo(name_,rights,money)); m_ranks.push_back(RankInfo(name_,rights,money));
} }

View file

@ -242,7 +242,7 @@ struct MemberSlot
struct RankInfo struct RankInfo
{ {
RankInfo(std::string _name, uint32 _rights, uint32 _money) : name(_name), rights(_rights), BankMoneyPerDay(_money) RankInfo(const std::string& _name, uint32 _rights, uint32 _money) : name(_name), rights(_rights), BankMoneyPerDay(_money)
{ {
for(uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i) for(uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
{ {
@ -307,8 +307,8 @@ class Guild
bool FillPlayerData(uint64 guid, MemberSlot* memslot); bool FillPlayerData(uint64 guid, MemberSlot* memslot);
void LoadPlayerStatsByGuid(uint64 guid); void LoadPlayerStatsByGuid(uint64 guid);
void BroadcastToGuild(WorldSession *session, std::string msg, uint32 language = LANG_UNIVERSAL); void BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
void BroadcastToOfficers(WorldSession *session, std::string msg, uint32 language = LANG_UNIVERSAL); void BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId); void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId);
void BroadcastPacket(WorldPacket *packet); void BroadcastPacket(WorldPacket *packet);
@ -405,7 +405,7 @@ class Guild
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry ); bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry );
protected: protected:
void AddRank(std::string name,uint32 rights,uint32 money); void AddRank(const std::string& name,uint32 rights,uint32 money);
uint32 Id; uint32 Id;
std::string name; std::string name;

View file

@ -730,7 +730,7 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
guild->Roster(this); guild->Roster(this);
} }
void WorldSession::SendGuildCommandResult(uint32 typecmd,std::string str,uint32 cmdresult) void WorldSession::SendGuildCommandResult(uint32 typecmd, const std::string& str,uint32 cmdresult)
{ {
WorldPacket data(SMSG_GUILD_COMMAND_RESULT, (8+str.size()+1)); WorldPacket data(SMSG_GUILD_COMMAND_RESULT, (8+str.size()+1));
data << typecmd; data << typecmd;

View file

@ -352,7 +352,7 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data )
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0); pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0);
} }
void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId ) void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, const std::string& subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId )
{ {
if(messageType != MAIL_NORMAL) // return only to players if(messageType != MAIL_NORMAL) // return only to players
{ {

View file

@ -114,7 +114,7 @@ void WorldSession::SendTrainerList( uint64 guid )
SendTrainerList( guid, str ); SendTrainerList( guid, str );
} }
void WorldSession::SendTrainerList( uint64 guid,std::string strTitle ) void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
{ {
sLog.outDebug( "WORLD: SendTrainerList" ); sLog.outDebug( "WORLD: SendTrainerList" );

View file

@ -407,7 +407,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
InstanceData* GetInstanceData(); InstanceData* GetInstanceData();
const char* GetName() const { return m_name.c_str(); } const char* GetName() const { return m_name.c_str(); }
void SetName(std::string newname) { m_name=newname; } void SetName(const std::string& newname) { m_name=newname; }
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); } virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }

View file

@ -199,7 +199,7 @@ Guild * ObjectMgr::GetGuildById(const uint32 GuildId) const
return NULL; return NULL;
} }
Guild * ObjectMgr::GetGuildByName(std::string guildname) const Guild * ObjectMgr::GetGuildByName(const std::string& guildname) const
{ {
for(GuildSet::const_iterator itr = mGuildSet.begin(); itr != mGuildSet.end(); ++itr) for(GuildSet::const_iterator itr = mGuildSet.begin(); itr != mGuildSet.end(); ++itr)
if ((*itr)->GetName() == guildname) if ((*itr)->GetName() == guildname)
@ -235,7 +235,7 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(const uint32 ArenaTeamId) const
return NULL; return NULL;
} }
ArenaTeam* ObjectMgr::GetArenaTeamByName(std::string arenateamname) const ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
{ {
for(ArenaTeamSet::const_iterator itr = mArenaTeamSet.begin(); itr != mArenaTeamSet.end(); ++itr) for(ArenaTeamSet::const_iterator itr = mArenaTeamSet.begin(); itr != mArenaTeamSet.end(); ++itr)
if ((*itr)->GetName() == arenateamname) if ((*itr)->GetName() == arenateamname)
@ -1380,7 +1380,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
return 0; return 0;
} }
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(std::string name) const uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const
{ {
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str()); QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str());
if(result) if(result)
@ -6135,7 +6135,7 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo
return false; return false;
} }
bool ObjectMgr::IsValidName( std::string name, bool create ) bool ObjectMgr::IsValidName( const std::string& name, bool create )
{ {
std::wstring wname; std::wstring wname;
if(!Utf8toWStr(name,wname)) if(!Utf8toWStr(name,wname))
@ -6149,7 +6149,7 @@ bool ObjectMgr::IsValidName( std::string name, bool create )
return isValidString(wname,strictMask,false,create); return isValidString(wname,strictMask,false,create);
} }
bool ObjectMgr::IsValidCharterName( std::string name ) bool ObjectMgr::IsValidCharterName( const std::string& name )
{ {
std::wstring wname; std::wstring wname;
if(!Utf8toWStr(name,wname)) if(!Utf8toWStr(name,wname))
@ -6163,7 +6163,7 @@ bool ObjectMgr::IsValidCharterName( std::string name )
return isValidString(wname,strictMask,true); return isValidString(wname,strictMask,true);
} }
bool ObjectMgr::IsValidPetName( std::string name ) bool ObjectMgr::IsValidPetName( const std::string& name )
{ {
std::wstring wname; std::wstring wname;
if(!Utf8toWStr(name,wname)) if(!Utf8toWStr(name,wname))
@ -6792,7 +6792,7 @@ void ObjectMgr::LoadGameTele()
sLog.outString( ">> Loaded %u game tele's", count ); sLog.outString( ">> Loaded %u game tele's", count );
} }
GameTele const* ObjectMgr::GetGameTele(std::string name) const GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
{ {
// explicit name case // explicit name case
std::wstring wname; std::wstring wname;
@ -6835,7 +6835,7 @@ bool ObjectMgr::AddGameTele(GameTele& tele)
new_id,tele.position_x,tele.position_y,tele.position_z,tele.orientation,tele.mapId,tele.name.c_str()); new_id,tele.position_x,tele.position_y,tele.position_z,tele.orientation,tele.mapId,tele.name.c_str());
} }
bool ObjectMgr::DeleteGameTele(std::string name) bool ObjectMgr::DeleteGameTele(const std::string& name)
{ {
// explicit name case // explicit name case
std::wstring wname; std::wstring wname;

View file

@ -313,13 +313,13 @@ class ObjectMgr
Guild* GetGuildByLeader(uint64 const&guid) const; Guild* GetGuildByLeader(uint64 const&guid) const;
Guild* GetGuildById(const uint32 GuildId) const; Guild* GetGuildById(const uint32 GuildId) const;
Guild* GetGuildByName(std::string guildname) const; Guild* GetGuildByName(const std::string& guildname) const;
std::string GetGuildNameById(const uint32 GuildId) const; std::string GetGuildNameById(const uint32 GuildId) const;
void AddGuild(Guild* guild) { mGuildSet.insert( guild ); } void AddGuild(Guild* guild) { mGuildSet.insert( guild ); }
void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); } void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); }
ArenaTeam* GetArenaTeamById(const uint32 ArenaTeamId) const; ArenaTeam* GetArenaTeamById(const uint32 ArenaTeamId) const;
ArenaTeam* GetArenaTeamByName(std::string ArenaTeamName) const; ArenaTeam* GetArenaTeamByName(const std::string& ArenaTeamName) const;
ArenaTeam* GetArenaTeamByCapitan(uint64 const& guid) const; ArenaTeam* GetArenaTeamByCapitan(uint64 const& guid) const;
void AddArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.insert( arenateam ); } void AddArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.insert( arenateam ); }
void RemoveArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.erase( arenateam ); } void RemoveArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.erase( arenateam ); }
@ -405,7 +405,7 @@ class ObjectMgr
bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const; bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const;
uint32 GetPlayerTeamByGUID(const uint64 &guid) const; uint32 GetPlayerTeamByGUID(const uint64 &guid) const;
uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const; uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const;
uint32 GetPlayerAccountIdByPlayerName(std::string name) const; uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const;
uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid ); uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid );
void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost);
@ -698,15 +698,15 @@ class ObjectMgr
// reserved names // reserved names
void LoadReservedPlayersNames(); void LoadReservedPlayersNames();
bool IsReservedName(std::string name) const bool IsReservedName(const std::string& name) const
{ {
return m_ReservedNames.find(name) != m_ReservedNames.end(); return m_ReservedNames.find(name) != m_ReservedNames.end();
} }
// name with valid structure and symbols // name with valid structure and symbols
static bool IsValidName( std::string name, bool create = false ); static bool IsValidName( const std::string& name, bool create = false );
static bool IsValidCharterName( std::string name ); static bool IsValidCharterName( const std::string& name );
static bool IsValidPetName( std::string name ); static bool IsValidPetName( const std::string& name );
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names); static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
@ -730,10 +730,10 @@ class ObjectMgr
if(itr==m_GameTeleMap.end()) return NULL; if(itr==m_GameTeleMap.end()) return NULL;
return &itr->second; return &itr->second;
} }
GameTele const* GetGameTele(std::string name) const; GameTele const* GetGameTele(const std::string& name) const;
GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; } GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; }
bool AddGameTele(GameTele& data); bool AddGameTele(GameTele& data);
bool DeleteGameTele(std::string name); bool DeleteGameTele(const std::string& name);
CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; }

View file

@ -668,7 +668,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
} }
} }
void WorldSession::SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName) void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName)
{ {
WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1); WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
data << uint32(error); data << uint32(error);

View file

@ -182,7 +182,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all )
} }
} }
bool PlayerTaxi::LoadTaxiDestinationsFromString( std::string values ) bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values )
{ {
ClearTaxiDestinations(); ClearTaxiDestinations();
@ -476,7 +476,7 @@ void Player::CleanupsBeforeDelete()
Unit::CleanupsBeforeDelete(); Unit::CleanupsBeforeDelete();
} }
bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ) bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId )
{ {
//FIXME: outfitId not used in player creating //FIXME: outfitId not used in player creating
@ -15751,7 +15751,7 @@ void Player::Uncharm()
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
} }
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
{ {
*data << (uint8)msgtype; *data << (uint8)msgtype;
*data << (uint32)language; *data << (uint32)language;
@ -15763,28 +15763,28 @@ void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text,
*data << (uint8)chatTag(); *data << (uint8)chatTag();
} }
void Player::Say(const std::string text, const uint32 language) void Player::Say(const std::string& text, const uint32 language)
{ {
WorldPacket data(SMSG_MESSAGECHAT, 200); WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language); BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true); SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
} }
void Player::Yell(const std::string text, const uint32 language) void Player::Yell(const std::string& text, const uint32 language)
{ {
WorldPacket data(SMSG_MESSAGECHAT, 200); WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language); BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true); SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
} }
void Player::TextEmote(const std::string text) void Player::TextEmote(const std::string& text)
{ {
WorldPacket data(SMSG_MESSAGECHAT, 200); WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL); BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) ); SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) );
} }
void Player::Whisper(std::string text, uint32 language,uint64 receiver) void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
{ {
if (language != LANG_ADDON) // if not addon data if (language != LANG_ADDON) // if not addon data
language = LANG_UNIVERSAL; // whispers should always be readable language = LANG_UNIVERSAL; // whispers should always be readable

View file

@ -859,7 +859,7 @@ class MANGOS_DLL_SPEC PlayerTaxi
void AppendTaximaskTo(ByteBuffer& data,bool all); void AppendTaximaskTo(ByteBuffer& data,bool all);
// Destinations // Destinations
bool LoadTaxiDestinationsFromString(std::string values); bool LoadTaxiDestinationsFromString(const std::string& values);
std::string SaveTaxiDestinationsToString(); std::string SaveTaxiDestinationsToString();
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); } void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
@ -912,7 +912,7 @@ class MANGOS_DLL_SPEC Player : public Unit
} }
void SummonIfPossible(bool agree); void SummonIfPossible(bool agree);
bool Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId ); bool Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId );
void Update( uint32 time ); void Update( uint32 time );
@ -1004,11 +1004,11 @@ class MANGOS_DLL_SPEC Player : public Unit
GuardianPetList const& GetGuardians() const { return m_guardianPets; } GuardianPetList const& GetGuardians() const { return m_guardianPets; }
void Uncharm(); void Uncharm();
void Say(std::string text, const uint32 language); void Say(const std::string& text, const uint32 language);
void Yell(std::string text, const uint32 language); void Yell(const std::string& text, const uint32 language);
void TextEmote(std::string text); void TextEmote(const std::string& text);
void Whisper(std::string text, const uint32 language,uint64 receiver); void Whisper(const std::string& text, const uint32 language,uint64 receiver);
void BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const; void BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const;
/*********************************************************/ /*********************************************************/
/*** STORAGE SYSTEM ***/ /*** STORAGE SYSTEM ***/

View file

@ -337,7 +337,7 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
return dump; return dump;
} }
DumpReturn PlayerDumpWriter::WriteDump(std::string file, uint32 guid) DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
{ {
FILE *fout = fopen(file.c_str(), "w"); FILE *fout = fopen(file.c_str(), "w");
if (!fout) if (!fout)
@ -353,7 +353,7 @@ DumpReturn PlayerDumpWriter::WriteDump(std::string file, uint32 guid)
// Reading - High-level functions // Reading - High-level functions
#define ROLLBACK(DR) {CharacterDatabase.RollbackTransaction(); fclose(fin); return (DR);} #define ROLLBACK(DR) {CharacterDatabase.RollbackTransaction(); fclose(fin); return (DR);}
DumpReturn PlayerDumpReader::LoadDump(std::string file, uint32 account, std::string name, uint32 guid) DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid)
{ {
// check character count // check character count
{ {

View file

@ -92,7 +92,7 @@ class PlayerDumpWriter : public PlayerDump
PlayerDumpWriter() {} PlayerDumpWriter() {}
std::string GetDump(uint32 guid); std::string GetDump(uint32 guid);
DumpReturn WriteDump(std::string file, uint32 guid); DumpReturn WriteDump(const std::string& file, uint32 guid);
private: private:
typedef std::set<uint32> GUIDs; typedef std::set<uint32> GUIDs;
@ -111,7 +111,7 @@ class PlayerDumpReader : public PlayerDump
public: public:
PlayerDumpReader() {} PlayerDumpReader() {}
DumpReturn LoadDump(std::string file, uint32 account, std::string name, uint32 guid); DumpReturn LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid);
}; };
#endif #endif

View file

@ -63,7 +63,7 @@ struct FriendInfo
Note = ""; Note = "";
} }
FriendInfo(uint32 flags, std::string note) FriendInfo(uint32 flags, const std::string& note)
{ {
Status = FRIEND_STATUS_OFFLINE; Status = FRIEND_STATUS_OFFLINE;
Flags = flags; Flags = flags;

View file

@ -2281,7 +2281,7 @@ void World::KickAllLess(AccountTypes sec)
} }
/// Kick (and save) the designated player /// Kick (and save) the designated player
bool World::KickPlayer(std::string playerName) bool World::KickPlayer(const std::string& playerName)
{ {
SessionMap::iterator itr; SessionMap::iterator itr;

View file

@ -438,7 +438,7 @@ class World
bool IsPvPRealm() { return (getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); } bool IsPvPRealm() { return (getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); }
bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; } bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
bool KickPlayer(std::string playerName); bool KickPlayer(const std::string& playerName);
void KickAll(); void KickAll();
void KickAllLess(AccountTypes sec); void KickAllLess(AccountTypes sec);
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);

View file

@ -81,7 +81,7 @@ class MANGOS_DLL_SPEC WorldSession
void SendPacket(WorldPacket const* packet); void SendPacket(WorldPacket const* packet);
void SendNotification(const char *format,...) ATTR_PRINTF(2,3); void SendNotification(const char *format,...) ATTR_PRINTF(2,3);
void SendNotification(int32 string_id,...); void SendNotification(int32 string_id,...);
void SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName); void SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName);
void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type); void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type);
void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res); void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res);
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3); void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
@ -128,7 +128,7 @@ class MANGOS_DLL_SPEC WorldSession
static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId); static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId);
void SendTrainerList( uint64 guid ); void SendTrainerList( uint64 guid );
void SendTrainerList( uint64 guid,std::string strTitle ); void SendTrainerList( uint64 guid, const std::string& strTitle );
void SendListInventory( uint64 guid ); void SendListInventory( uint64 guid );
void SendShowBank( uint64 guid ); void SendShowBank( uint64 guid );
void SendTabardVendorActivate( uint64 guid ); void SendTabardVendorActivate( uint64 guid );
@ -153,7 +153,7 @@ class MANGOS_DLL_SPEC WorldSession
//mail //mail
//used with item_page table //used with item_page table
bool SendItemInfo( uint32 itemid, WorldPacket data ); bool SendItemInfo( uint32 itemid, WorldPacket data );
static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId = 0); static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, const std::string& subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId = 0);
static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0); static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0);
//auction //auction
@ -176,9 +176,9 @@ class MANGOS_DLL_SPEC WorldSession
bool SendLearnNewTaxiNode( Creature* unit ); bool SendLearnNewTaxiNode( Creature* unit );
// Guild/Arena Team // Guild/Arena Team
void SendGuildCommandResult(uint32 typecmd,std::string str,uint32 cmdresult); void SendGuildCommandResult(uint32 typecmd, const std::string& str, uint32 cmdresult);
void SendArenaTeamCommandResult(uint32 unk1, std::string str1, std::string str2, uint32 unk3); void SendArenaTeamCommandResult(uint32 unk1, const std::string& str1, const std::string& str2, uint32 unk3);
void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, std::string str1, std::string str2, std::string str3); void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3);
void SendNotInArenaTeamPacket(uint8 type); void SendNotInArenaTeamPacket(uint8 type);
void SendPetitionShowList( uint64 guid ); void SendPetitionShowList( uint64 guid );
void SendSaveGuildEmblem( uint32 msg ); void SendSaveGuildEmblem( uint32 msg );

View file

@ -298,7 +298,7 @@ void AuthSocket::OnRead()
} }
/// Make the SRP6 calculation from hash in dB /// Make the SRP6 calculation from hash in dB
void AuthSocket::_SetVSFields(std::string rI) void AuthSocket::_SetVSFields(const std::string& rI)
{ {
BigNumber I; BigNumber I;
I.SetHexStr(rI.c_str()); I.SetHexStr(rI.c_str());

View file

@ -56,7 +56,7 @@ class AuthSocket: public TcpSocket
bool _HandleXferCancel(); bool _HandleXferCancel();
bool _HandleXferAccept(); bool _HandleXferAccept();
void _SetVSFields(std::string rI); void _SetVSFields(const std::string& rI);
FILE *pPatch; FILE *pPatch;
ZThread::Mutex patcherLock; ZThread::Mutex patcherLock;

View file

@ -42,7 +42,7 @@ void RealmList::Initialize(uint32 updateInterval)
UpdateRealms(true); UpdateRealms(true);
} }
void RealmList::UpdateRealm( uint32 ID, std::string name, std::string address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu) void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu)
{ {
///- Create new if not exist or update existed ///- Create new if not exist or update existed
Realm& realm = m_realms[name]; Realm& realm = m_realms[name];

View file

@ -56,7 +56,7 @@ class RealmList
uint32 size() const { return m_realms.size(); } uint32 size() const { return m_realms.size(); }
private: private:
void UpdateRealms(bool init); void UpdateRealms(bool init);
void UpdateRealm( uint32 ID, std::string name, std::string address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu); void UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu);
private: private:
RealmMap m_realms; ///< Internal map of realms RealmMap m_realms; ///< Internal map of realms
uint32 m_UpdateInterval; uint32 m_UpdateInterval;

View file

@ -30,7 +30,7 @@ char const* localeNames[MAX_LOCALE] = {
"ruRU" "ruRU"
}; };
LocaleConstant GetLocaleByName(std::string name) LocaleConstant GetLocaleByName(const std::string& name)
{ {
for(uint32 i = 0; i < MAX_LOCALE; ++i) for(uint32 i = 0; i < MAX_LOCALE; ++i)
if(name==localeNames[i]) if(name==localeNames[i])

View file

@ -186,7 +186,7 @@ enum LocaleConstant
extern char const* localeNames[MAX_LOCALE]; extern char const* localeNames[MAX_LOCALE];
LocaleConstant GetLocaleByName(std::string name); LocaleConstant GetLocaleByName(const std::string& name);
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms) // we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
#ifdef max #ifdef max

View file

@ -128,7 +128,7 @@ DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore(WorldSafeLocsEntryfmt);
typedef std::list<std::string> StoreProblemList; typedef std::list<std::string> StoreProblemList;
static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, std::string filename) static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& filename)
{ {
sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize); sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize);
@ -137,7 +137,7 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, std::string filename
} }
template<class T> template<class T>
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, std::string dbc_path, std::string filename) inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
{ {
// compatibility format and C++ structure sizes // compatibility format and C++ structure sizes
assert(DBCFile::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFile::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename)); assert(DBCFile::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFile::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
@ -172,7 +172,7 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
} }
} }
void LoadDBCStores(std::string dataPath) void LoadDBCStores(const std::string& dataPath)
{ {
std::string dbcPath = dataPath+"dbc/"; std::string dbcPath = dataPath+"dbc/";

View file

@ -195,7 +195,7 @@ extern DBCStorage <TotemCategoryEntry> sTotemCategoryStore;
//extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates //extern DBCStorage <WorldMapAreaEntry> sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates
extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore; extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
void LoadDBCStores(std::string dataPath); void LoadDBCStores(const std::string& dataPath);
// script support functions // script support functions
MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore(); MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();

View file

@ -43,7 +43,7 @@ Log::Log() :
Initialize(); Initialize();
} }
void Log::InitColors(std::string str) void Log::InitColors(const std::string& str)
{ {
if(str.empty()) if(str.empty())
{ {

View file

@ -82,7 +82,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
} }
public: public:
void Initialize(); void Initialize();
void InitColors(std::string init_str); void InitColors(const std::string& init_str);
void outTitle( const char * str); void outTitle( const char * str);
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4); void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4);
void outString(); // any log level void outString(); // any log level

View file

@ -131,13 +131,13 @@ std::string secsToTimeString(uint32 timeInSecs, bool shortText, bool hoursOnly)
return ss.str(); return ss.str();
} }
uint32 TimeStringToSecs(std::string timestring) uint32 TimeStringToSecs(const std::string& timestring)
{ {
uint32 secs = 0; uint32 secs = 0;
uint32 buffer = 0; uint32 buffer = 0;
uint32 multiplier = 0; uint32 multiplier = 0;
for(std::string::iterator itr = timestring.begin(); itr != timestring.end(); itr++ ) for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
{ {
if(isdigit(*itr)) if(isdigit(*itr))
{ {
@ -193,7 +193,7 @@ bool IsIPAddress(char const* ipaddress)
} }
/// create PID file /// create PID file
uint32 CreatePIDFile(std::string filename) uint32 CreatePIDFile(const std::string& filename)
{ {
FILE * pid_file = fopen (filename.c_str(), "w" ); FILE * pid_file = fopen (filename.c_str(), "w" );
if (pid_file == NULL) if (pid_file == NULL)
@ -271,7 +271,7 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
return true; return true;
} }
bool Utf8toWStr(std::string utf8str, std::wstring& wstr) bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
{ {
try try
{ {
@ -376,7 +376,7 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
return wname; return wname;
} }
bool utf8ToConsole(std::string utf8str, std::string& conStr) bool utf8ToConsole(const std::string& utf8str, std::string& conStr)
{ {
#if PLATFORM == PLATFORM_WINDOWS #if PLATFORM == PLATFORM_WINDOWS
std::wstring wstr; std::wstring wstr;
@ -393,7 +393,7 @@ bool utf8ToConsole(std::string utf8str, std::string& conStr)
return true; return true;
} }
bool consoleToUtf8(std::string conStr,std::string& utf8str) bool consoleToUtf8(const std::string& conStr,std::string& utf8str)
{ {
#if PLATFORM == PLATFORM_WINDOWS #if PLATFORM == PLATFORM_WINDOWS
std::wstring wstr; std::wstring wstr;
@ -408,7 +408,7 @@ bool consoleToUtf8(std::string conStr,std::string& utf8str)
#endif #endif
} }
bool Utf8FitTo(std::string str, std::wstring search) bool Utf8FitTo(const std::string& str, std::wstring search)
{ {
std::wstring temp; std::wstring temp;

View file

@ -31,7 +31,7 @@ Tokens StrSplit(const std::string &src, const std::string &sep);
void stripLineInvisibleChars(std::string &src); void stripLineInvisibleChars(std::string &src);
std::string secsToTimeString(uint32 timeInSecs, bool shortText = false, bool hoursOnly = false); std::string secsToTimeString(uint32 timeInSecs, bool shortText = false, bool hoursOnly = false);
uint32 TimeStringToSecs(std::string timestring); uint32 TimeStringToSecs(const std::string& timestring);
std::string TimeToTimestampStr(time_t t); std::string TimeToTimestampStr(time_t t);
inline uint32 secsToTimeBitFields(time_t secs) inline uint32 secsToTimeBitFields(time_t secs)
@ -95,10 +95,10 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
var *= (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)); var *= (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val));
} }
bool Utf8toWStr(std::string utf8str, std::wstring& wstr); bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr);
// in wsize==max size of buffer, out wsize==real string size // in wsize==max size of buffer, out wsize==real string size
bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize); bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize);
inline bool Utf8toWStr(std::string utf8str, wchar_t* wstr, size_t& wsize) inline bool Utf8toWStr(const std::string& utf8str, wchar_t* wstr, size_t& wsize)
{ {
return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize); return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize);
} }
@ -280,9 +280,9 @@ inline void wstrToLower(std::wstring& str)
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension); std::wstring GetMainPartOfName(std::wstring wname, uint32 declension);
bool utf8ToConsole(std::string utf8str, std::string& conStr); bool utf8ToConsole(const std::string& utf8str, std::string& conStr);
bool consoleToUtf8(std::string conStr,std::string& utf8str); bool consoleToUtf8(const std::string& conStr,std::string& utf8str);
bool Utf8FitTo(std::string str, std::wstring search); bool Utf8FitTo(const std::string& str, std::wstring search);
#if PLATFORM == PLATFORM_WINDOWS #if PLATFORM == PLATFORM_WINDOWS
#define UTF8PRINTF(OUT,FRM,RESERR) \ #define UTF8PRINTF(OUT,FRM,RESERR) \
@ -311,6 +311,6 @@ bool Utf8FitTo(std::string str, std::wstring search);
#endif #endif
bool IsIPAddress(char const* ipaddress); bool IsIPAddress(char const* ipaddress);
uint32 CreatePIDFile(std::string filename); uint32 CreatePIDFile(const std::string& filename);
#endif #endif

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "6898" #define REVISION_NR "6899"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__

View file

@ -43,8 +43,8 @@ namespace VMAP
G3D::Array<std::string> iMainFiles; G3D::Array<std::string> iMainFiles;
G3D::Array<std::string> iSingeFiles; G3D::Array<std::string> iSingeFiles;
void appendToMain(std::string pStr) { iMainFiles.append(pStr); } void appendToMain(const std::string& pStr) { iMainFiles.append(pStr); }
void appendToSingle(std::string pStr) { iSingeFiles.append(pStr); } void appendToSingle(const std::string& pStr) { iSingeFiles.append(pStr); }
size_t size() { return (iMainFiles.size() + iSingeFiles.size()); } size_t size() { return (iMainFiles.size() + iSingeFiles.size()); }
}; };
@ -113,7 +113,7 @@ namespace VMAP
const NameCollection getFilenamesForCoordinate(unsigned int pMapId, int xPos, int yPos); const NameCollection getFilenamesForCoordinate(unsigned int pMapId, int xPos, int yPos);
static unsigned int getMapIdFromFilename(std::string pName) static unsigned int getMapIdFromFilename(const std::string& pName)
{ {
size_t spos; size_t spos;
@ -126,8 +126,8 @@ namespace VMAP
} }
const G3D::Array<unsigned int>& getMaps() const { return iMapIds; } const G3D::Array<unsigned int>& getMaps() const { return iMapIds; }
bool isAlreadyProcessedSingleFile(std::string pName) const { return iProcesseSingleFiles.containsKey(pName); } bool isAlreadyProcessedSingleFile(const std::string& pName) const { return iProcesseSingleFiles.containsKey(pName); }
void addAlreadyProcessedSingleFile(std::string pName) { iProcesseSingleFiles.set(pName,pName); } void addAlreadyProcessedSingleFile(const std::string& pName) { iProcesseSingleFiles.set(pName,pName); }
inline void addWorldAreaMap(unsigned int pMapId) inline void addWorldAreaMap(unsigned int pMapId)
{ {