diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp index 7cab8d085..16784bbcb 100644 --- a/src/game/ArenaTeamHandler.cpp +++ b/src/game/ArenaTeamHandler.cpp @@ -360,7 +360,7 @@ void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_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); data << unk1; @@ -370,7 +370,7 @@ void WorldSession::SendArenaTeamCommandResult(uint32 unk1, std::string str1, std 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 << eventid; diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp index 2fb8b5d09..22c1a5b1a 100644 --- a/src/game/Channel.cpp +++ b/src/game/Channel.cpp @@ -21,7 +21,7 @@ #include "World.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) { // set special flags if built-in channel @@ -773,7 +773,7 @@ void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid) } // 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); *data << name; diff --git a/src/game/Channel.h b/src/game/Channel.h index fc87efdd0..c3214f824 100644 --- a/src/game/Channel.h +++ b/src/game/Channel.h @@ -170,7 +170,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, std::string name); //+ 0x09 + void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09 void MakeNotOwner(WorldPacket *data); //? 0x0A void MakeChannelOwner(WorldPacket *data); //? 0x0B void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C @@ -244,14 +244,14 @@ class Channel } public: - Channel(std::string name, uint32 channel_id); + Channel(const std::string& name, uint32 channel_id); std::string 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(std::string npassword) { m_password = npassword; } + void SetPassword(const std::string& npassword) { m_password = npassword; } void SetAnnounce(bool nannounce) { m_announce = nannounce; } uint32 GetNumPlayers() const { return players.size(); } uint8 GetFlags() const { return m_flags; } diff --git a/src/game/ChannelMgr.h b/src/game/ChannelMgr.h index b3e3ac2e4..124afec5c 100644 --- a/src/game/ChannelMgr.h +++ b/src/game/ChannelMgr.h @@ -36,7 +36,7 @@ class ChannelMgr delete itr->second; channels.clear(); } - Channel *GetJoinChannel(std::string name, uint32 channel_id) + Channel *GetJoinChannel(const std::string& name, uint32 channel_id) { if(channels.count(name) == 0) { @@ -45,7 +45,7 @@ class ChannelMgr } 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); @@ -59,7 +59,7 @@ class ChannelMgr else return i->second; } - void LeftChannel(std::string name) + void LeftChannel(const std::string& name) { ChannelMap::const_iterator i = channels.find(name); @@ -76,7 +76,7 @@ class ChannelMgr } private: 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) << (uint8)0x05 << name; diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index aa2ad5a0b..3c21a28ca 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -706,7 +706,7 @@ void ChatHandler::PSendSysMessage(const char *format, ...) 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; std::string cmd = ""; diff --git a/src/game/Chat.h b/src/game/Chat.h index 73e0d6d50..bd66f6877 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -80,7 +80,7 @@ class ChatHandler 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 ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd); diff --git a/src/game/GMTicketMgr.h b/src/game/GMTicketMgr.h index 01e00874d..5f7bf69ea 100644 --- a/src/game/GMTicketMgr.h +++ b/src/game/GMTicketMgr.h @@ -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) { } diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index a690254e2..ed9ebb3e5 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -34,7 +34,7 @@ GossipMenu::~GossipMenu() 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 ); @@ -51,7 +51,7 @@ void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, u 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); } @@ -341,7 +341,7 @@ void QuestMenu::ClearMenu() 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 data << uint64(npcGUID); diff --git a/src/game/GossipDef.h b/src/game/GossipDef.h index ba5b36008..7cde0c3b1 100644 --- a/src/game/GossipDef.h +++ b/src/game/GossipDef.h @@ -101,8 +101,8 @@ class MANGOS_DLL_SPEC GossipMenu GossipMenu(); ~GossipMenu(); - void AddMenuItem(uint8 Icon, 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, 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 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 SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint64 npcGUID ); + void SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID ); void SendQuestQueryResponse ( Quest const *pQuest ); void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept); diff --git a/src/game/Guild.cpp b/src/game/Guild.cpp index 19f6214b8..8076757b5 100644 --- a/src/game/Guild.cpp +++ b/src/game/Guild.cpp @@ -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); } -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)) { @@ -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)) { @@ -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 ); } -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)); } diff --git a/src/game/Guild.h b/src/game/Guild.h index a97a8cfb0..952468a26 100644 --- a/src/game/Guild.h +++ b/src/game/Guild.h @@ -242,7 +242,7 @@ struct MemberSlot 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) { @@ -307,8 +307,8 @@ class Guild bool FillPlayerData(uint64 guid, MemberSlot* memslot); void LoadPlayerStatsByGuid(uint64 guid); - void BroadcastToGuild(WorldSession *session, std::string msg, uint32 language = LANG_UNIVERSAL); - void BroadcastToOfficers(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, const std::string& msg, uint32 language = LANG_UNIVERSAL); void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId); void BroadcastPacket(WorldPacket *packet); @@ -405,7 +405,7 @@ class Guild bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry ); protected: - void AddRank(std::string name,uint32 rights,uint32 money); + void AddRank(const std::string& name,uint32 rights,uint32 money); uint32 Id; std::string name; diff --git a/src/game/GuildHandler.cpp b/src/game/GuildHandler.cpp index d40bb9b4d..8b093b808 100644 --- a/src/game/GuildHandler.cpp +++ b/src/game/GuildHandler.cpp @@ -730,7 +730,7 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) 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)); data << typecmd; diff --git a/src/game/Mail.cpp b/src/game/Mail.cpp index 06499d15b..24dbe1f09 100644 --- a/src/game/Mail.cpp +++ b/src/game/Mail.cpp @@ -352,7 +352,7 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data ) 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 { diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 4303e1a6c..a54ce7628 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -114,7 +114,7 @@ void WorldSession::SendTrainerList( uint64 guid ) SendTrainerList( guid, str ); } -void WorldSession::SendTrainerList( uint64 guid,std::string strTitle ) +void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle ) { sLog.outDebug( "WORLD: SendTrainerList" ); diff --git a/src/game/Object.h b/src/game/Object.h index 16e1fbfdf..6abd05203 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -407,7 +407,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object InstanceData* GetInstanceData(); 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(); } diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a936c0cc2..3ac130ff2 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -199,7 +199,7 @@ Guild * ObjectMgr::GetGuildById(const uint32 GuildId) const 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) if ((*itr)->GetName() == guildname) @@ -235,7 +235,7 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(const uint32 ArenaTeamId) const 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) if ((*itr)->GetName() == arenateamname) @@ -1380,7 +1380,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const 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()); if(result) @@ -6135,7 +6135,7 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo return false; } -bool ObjectMgr::IsValidName( std::string name, bool create ) +bool ObjectMgr::IsValidName( const std::string& name, bool create ) { std::wstring wname; if(!Utf8toWStr(name,wname)) @@ -6149,7 +6149,7 @@ bool ObjectMgr::IsValidName( std::string name, bool create ) return isValidString(wname,strictMask,false,create); } -bool ObjectMgr::IsValidCharterName( std::string name ) +bool ObjectMgr::IsValidCharterName( const std::string& name ) { std::wstring wname; if(!Utf8toWStr(name,wname)) @@ -6163,7 +6163,7 @@ bool ObjectMgr::IsValidCharterName( std::string name ) return isValidString(wname,strictMask,true); } -bool ObjectMgr::IsValidPetName( std::string name ) +bool ObjectMgr::IsValidPetName( const std::string& name ) { std::wstring wname; if(!Utf8toWStr(name,wname)) @@ -6792,7 +6792,7 @@ void ObjectMgr::LoadGameTele() 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 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()); } -bool ObjectMgr::DeleteGameTele(std::string name) +bool ObjectMgr::DeleteGameTele(const std::string& name) { // explicit name case std::wstring wname; diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 1c408ce63..fa594e055 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -313,13 +313,13 @@ class ObjectMgr Guild* GetGuildByLeader(uint64 const&guid) 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; void AddGuild(Guild* guild) { mGuildSet.insert( guild ); } void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); } 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; void AddArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.insert( arenateam ); } void RemoveArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.erase( arenateam ); } @@ -405,7 +405,7 @@ class ObjectMgr bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const; uint32 GetPlayerTeamByGUID(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 ); void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost); @@ -698,15 +698,15 @@ class ObjectMgr // reserved names void LoadReservedPlayersNames(); - bool IsReservedName(std::string name) const + bool IsReservedName(const std::string& name) const { return m_ReservedNames.find(name) != m_ReservedNames.end(); } // name with valid structure and symbols - static bool IsValidName( std::string name, bool create = false ); - static bool IsValidCharterName( std::string name ); - static bool IsValidPetName( std::string name ); + static bool IsValidName( const std::string& name, bool create = false ); + static bool IsValidCharterName( const std::string& name ); + static bool IsValidPetName( const std::string& name ); static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names); @@ -730,10 +730,10 @@ class ObjectMgr if(itr==m_GameTeleMap.end()) return NULL; 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; } bool AddGameTele(GameTele& data); - bool DeleteGameTele(std::string name); + bool DeleteGameTele(const std::string& name); CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; } diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index eb51544d3..c1d21e131 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -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); data << uint32(error); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5a517f45d..277d9a341 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -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(); @@ -476,7 +476,7 @@ void Player::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 @@ -15751,7 +15751,7 @@ void Player::Uncharm() 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 << (uint32)language; @@ -15763,28 +15763,28 @@ void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, *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); BuildPlayerChat(&data, CHAT_MSG_SAY, text, language); 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); BuildPlayerChat(&data, CHAT_MSG_YELL, text, language); 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); 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) ); } -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 language = LANG_UNIVERSAL; // whispers should always be readable diff --git a/src/game/Player.h b/src/game/Player.h index bc7e3d39c..89bc27b99 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -859,7 +859,7 @@ class MANGOS_DLL_SPEC PlayerTaxi void AppendTaximaskTo(ByteBuffer& data,bool all); // Destinations - bool LoadTaxiDestinationsFromString(std::string values); + bool LoadTaxiDestinationsFromString(const std::string& values); std::string SaveTaxiDestinationsToString(); void ClearTaxiDestinations() { m_TaxiDestinations.clear(); } @@ -912,7 +912,7 @@ class MANGOS_DLL_SPEC Player : public Unit } 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 ); @@ -1004,11 +1004,11 @@ class MANGOS_DLL_SPEC Player : public Unit GuardianPetList const& GetGuardians() const { return m_guardianPets; } void Uncharm(); - void Say(std::string text, const uint32 language); - void Yell(std::string text, const uint32 language); - void TextEmote(std::string text); - void Whisper(std::string text, const uint32 language,uint64 receiver); - void BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const; + 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; /*********************************************************/ /*** STORAGE SYSTEM ***/ diff --git a/src/game/PlayerDump.cpp b/src/game/PlayerDump.cpp index b7e66c968..b533cab6c 100644 --- a/src/game/PlayerDump.cpp +++ b/src/game/PlayerDump.cpp @@ -337,7 +337,7 @@ std::string PlayerDumpWriter::GetDump(uint32 guid) 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"); if (!fout) @@ -353,7 +353,7 @@ DumpReturn PlayerDumpWriter::WriteDump(std::string file, uint32 guid) // Reading - High-level functions #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 { diff --git a/src/game/PlayerDump.h b/src/game/PlayerDump.h index 2e83102f9..5991b7445 100644 --- a/src/game/PlayerDump.h +++ b/src/game/PlayerDump.h @@ -92,7 +92,7 @@ class PlayerDumpWriter : public PlayerDump PlayerDumpWriter() {} std::string GetDump(uint32 guid); - DumpReturn WriteDump(std::string file, uint32 guid); + DumpReturn WriteDump(const std::string& file, uint32 guid); private: typedef std::set GUIDs; @@ -111,7 +111,7 @@ class PlayerDumpReader : public PlayerDump public: 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 diff --git a/src/game/SocialMgr.h b/src/game/SocialMgr.h index 8c873d8a0..0a7f822a7 100644 --- a/src/game/SocialMgr.h +++ b/src/game/SocialMgr.h @@ -63,7 +63,7 @@ struct FriendInfo Note = ""; } - FriendInfo(uint32 flags, std::string note) + FriendInfo(uint32 flags, const std::string& note) { Status = FRIEND_STATUS_OFFLINE; Flags = flags; diff --git a/src/game/World.cpp b/src/game/World.cpp index 2c2e87a3d..f66846362 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -2281,7 +2281,7 @@ void World::KickAllLess(AccountTypes sec) } /// Kick (and save) the designated player -bool World::KickPlayer(std::string playerName) +bool World::KickPlayer(const std::string& playerName) { SessionMap::iterator itr; diff --git a/src/game/World.h b/src/game/World.h index 2f3c0be57..d5b313503 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -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 IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; } - bool KickPlayer(std::string playerName); + bool KickPlayer(const std::string& playerName); void KickAll(); void KickAllLess(AccountTypes sec); BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author); diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 6077d42b4..34a626d80 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -81,7 +81,7 @@ class MANGOS_DLL_SPEC WorldSession void SendPacket(WorldPacket const* packet); void SendNotification(const char *format,...) ATTR_PRINTF(2,3); 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 SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res); 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); void SendTrainerList( uint64 guid ); - void SendTrainerList( uint64 guid,std::string strTitle ); + void SendTrainerList( uint64 guid, const std::string& strTitle ); void SendListInventory( uint64 guid ); void SendShowBank( uint64 guid ); void SendTabardVendorActivate( uint64 guid ); @@ -153,7 +153,7 @@ class MANGOS_DLL_SPEC WorldSession //mail //used with item_page table 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); //auction @@ -176,9 +176,9 @@ class MANGOS_DLL_SPEC WorldSession bool SendLearnNewTaxiNode( Creature* unit ); // Guild/Arena Team - void SendGuildCommandResult(uint32 typecmd,std::string str,uint32 cmdresult); - void SendArenaTeamCommandResult(uint32 unk1, std::string str1, std::string str2, uint32 unk3); - void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, std::string str1, std::string str2, std::string str3); + void SendGuildCommandResult(uint32 typecmd, const std::string& str, uint32 cmdresult); + void SendArenaTeamCommandResult(uint32 unk1, const std::string& str1, const std::string& str2, uint32 unk3); + 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 SendPetitionShowList( uint64 guid ); void SendSaveGuildEmblem( uint32 msg ); diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index 987e1d210..e1759e7e0 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -298,7 +298,7 @@ void AuthSocket::OnRead() } /// Make the SRP6 calculation from hash in dB -void AuthSocket::_SetVSFields(std::string rI) +void AuthSocket::_SetVSFields(const std::string& rI) { BigNumber I; I.SetHexStr(rI.c_str()); diff --git a/src/realmd/AuthSocket.h b/src/realmd/AuthSocket.h index b46e1d425..0ed37587b 100644 --- a/src/realmd/AuthSocket.h +++ b/src/realmd/AuthSocket.h @@ -56,7 +56,7 @@ class AuthSocket: public TcpSocket bool _HandleXferCancel(); bool _HandleXferAccept(); - void _SetVSFields(std::string rI); + void _SetVSFields(const std::string& rI); FILE *pPatch; ZThread::Mutex patcherLock; diff --git a/src/realmd/RealmList.cpp b/src/realmd/RealmList.cpp index 7f4dd3e15..a25e495b0 100644 --- a/src/realmd/RealmList.cpp +++ b/src/realmd/RealmList.cpp @@ -42,7 +42,7 @@ void RealmList::Initialize(uint32 updateInterval) 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 Realm& realm = m_realms[name]; diff --git a/src/realmd/RealmList.h b/src/realmd/RealmList.h index 15095e8fa..f3e04c07d 100644 --- a/src/realmd/RealmList.h +++ b/src/realmd/RealmList.h @@ -56,7 +56,7 @@ class RealmList uint32 size() const { return m_realms.size(); } private: 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: RealmMap m_realms; ///< Internal map of realms uint32 m_UpdateInterval; diff --git a/src/shared/Common.cpp b/src/shared/Common.cpp index 952997d3b..e7224bc5e 100644 --- a/src/shared/Common.cpp +++ b/src/shared/Common.cpp @@ -30,7 +30,7 @@ char const* localeNames[MAX_LOCALE] = { "ruRU" }; -LocaleConstant GetLocaleByName(std::string name) +LocaleConstant GetLocaleByName(const std::string& name) { for(uint32 i = 0; i < MAX_LOCALE; ++i) if(name==localeNames[i]) diff --git a/src/shared/Common.h b/src/shared/Common.h index 5c938ea67..0fc544fc6 100644 --- a/src/shared/Common.h +++ b/src/shared/Common.h @@ -186,7 +186,7 @@ enum LocaleConstant 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) #ifdef max diff --git a/src/shared/Database/DBCStores.cpp b/src/shared/Database/DBCStores.cpp index e733551d2..1385f089f 100644 --- a/src/shared/Database/DBCStores.cpp +++ b/src/shared/Database/DBCStores.cpp @@ -128,7 +128,7 @@ DBCStorage sWorldSafeLocsStore(WorldSafeLocsEntryfmt); typedef std::list 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); @@ -137,7 +137,7 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, std::string filename } template -inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, std::string dbc_path, std::string filename) +inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage& storage, const std::string& dbc_path, const std::string& filename) { // compatibility format and C++ structure sizes 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/"; diff --git a/src/shared/Database/DBCStores.h b/src/shared/Database/DBCStores.h index 7811286c0..f71888d91 100644 --- a/src/shared/Database/DBCStores.h +++ b/src/shared/Database/DBCStores.h @@ -195,7 +195,7 @@ extern DBCStorage sTotemCategoryStore; //extern DBCStorage sWorldMapAreaStore; -- use Zone2MapCoordinates and Map2ZoneCoordinates extern DBCStorage sWorldSafeLocsStore; -void LoadDBCStores(std::string dataPath); +void LoadDBCStores(const std::string& dataPath); // script support functions MANGOS_DLL_SPEC DBCStorage const* GetSoundEntriesStore(); diff --git a/src/shared/Log.cpp b/src/shared/Log.cpp index ada02e62b..f5d05139b 100644 --- a/src/shared/Log.cpp +++ b/src/shared/Log.cpp @@ -43,7 +43,7 @@ Log::Log() : Initialize(); } -void Log::InitColors(std::string str) +void Log::InitColors(const std::string& str) { if(str.empty()) { diff --git a/src/shared/Log.h b/src/shared/Log.h index 2a4bb97e8..391a93d86 100644 --- a/src/shared/Log.h +++ b/src/shared/Log.h @@ -82,7 +82,7 @@ class Log : public MaNGOS::Singleton iMainFiles; G3D::Array iSingeFiles; - void appendToMain(std::string pStr) { iMainFiles.append(pStr); } - void appendToSingle(std::string pStr) { iSingeFiles.append(pStr); } + void appendToMain(const std::string& pStr) { iMainFiles.append(pStr); } + void appendToSingle(const std::string& pStr) { iSingeFiles.append(pStr); } size_t size() { return (iMainFiles.size() + iSingeFiles.size()); } }; @@ -113,7 +113,7 @@ namespace VMAP 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; @@ -126,8 +126,8 @@ namespace VMAP } const G3D::Array& getMaps() const { return iMapIds; } - bool isAlreadyProcessedSingleFile(std::string pName) const { return iProcesseSingleFiles.containsKey(pName); } - void addAlreadyProcessedSingleFile(std::string pName) { iProcesseSingleFiles.set(pName,pName); } + bool isAlreadyProcessedSingleFile(const std::string& pName) const { return iProcesseSingleFiles.containsKey(pName); } + void addAlreadyProcessedSingleFile(const std::string& pName) { iProcesseSingleFiles.set(pName,pName); } inline void addWorldAreaMap(unsigned int pMapId) {