mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
[Performance] Change to use Pass by reference where valid. (#3163)
* [Performance] Change to use Pass by reference where valid. * typo
This commit is contained in:
+4
-4
@@ -32,7 +32,7 @@ void ServerToClient45SayLink(std::string& clientSayLink, const std::string& serv
|
||||
void ServerToClient50SayLink(std::string& clientSayLink, const std::string& serverSayLink);
|
||||
void ServerToClient55SayLink(std::string& clientSayLink, const std::string& serverSayLink);
|
||||
|
||||
ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus) :
|
||||
ChatChannel::ChatChannel(const std::string& inName, const std::string& inOwner, const std::string& inPassword, bool inPermanent, int inMinimumStatus) :
|
||||
m_delete_timer(0) {
|
||||
|
||||
m_name = inName;
|
||||
@@ -137,7 +137,7 @@ ChatChannel *ChatChannelList::CreateChannel(
|
||||
return new_channel;
|
||||
}
|
||||
|
||||
ChatChannel* ChatChannelList::FindChannel(std::string Name) {
|
||||
ChatChannel* ChatChannelList::FindChannel(const std::string& Name) {
|
||||
|
||||
std::string normalized_name = CapitaliseName(Name);
|
||||
|
||||
@@ -283,7 +283,7 @@ void ChatChannel::SetPassword(const std::string& in_password) {
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannel::SetOwner(std::string& in_owner) {
|
||||
void ChatChannel::SetOwner(const std::string& in_owner) {
|
||||
|
||||
m_owner = in_owner;
|
||||
|
||||
@@ -784,7 +784,7 @@ bool ChatChannel::HasVoice(std::string inVoiced)
|
||||
return std::find(std::begin(m_voiced), std::end(m_voiced), inVoiced) != std::end(m_voiced);
|
||||
}
|
||||
|
||||
std::string CapitaliseName(std::string inString) {
|
||||
std::string CapitaliseName(const std::string& inString) {
|
||||
|
||||
std::string NormalisedName = inString;
|
||||
|
||||
|
||||
+6
-6
@@ -15,7 +15,7 @@ class ChatChannel {
|
||||
|
||||
public:
|
||||
|
||||
ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus = 0);
|
||||
ChatChannel(const std::string& inName, const std::string& inOwner, const std::string& inPassword, bool inPermanent, int inMinimumStatus = 0);
|
||||
~ChatChannel();
|
||||
|
||||
void AddClient(Client *c);
|
||||
@@ -29,7 +29,7 @@ public:
|
||||
void SetPassword(const std::string& in_password);
|
||||
bool IsOwner(const std::string& name) { return (m_owner == name); }
|
||||
const std::string& GetPassword() { return m_password; }
|
||||
void SetOwner(std::string& inOwner);
|
||||
void SetOwner(const std::string& in_owner);
|
||||
std::string& GetOwnerName();
|
||||
void SetTemporary();
|
||||
void SetPermanent();
|
||||
@@ -76,7 +76,7 @@ class ChatChannelList {
|
||||
|
||||
public:
|
||||
ChatChannel* CreateChannel(const std::string& name, const std::string& owner, const std::string& password, bool permanent, int minimum_status, bool save_to_database = false);
|
||||
ChatChannel* FindChannel(std::string name);
|
||||
ChatChannel* FindChannel(const std::string& name);
|
||||
ChatChannel* AddClientToChannel(std::string channel_name, Client* c, bool command_directed = false);
|
||||
ChatChannel* RemoveClientFromChannel(const std::string& in_channel_name, Client* c, bool command_directed = false);
|
||||
void RemoveChannel(ChatChannel *Channel);
|
||||
@@ -91,8 +91,8 @@ public:
|
||||
static void AddToFilteredNames(const std::string& name);
|
||||
static bool IsOnChannelBlockList(const std::string& channel_name);
|
||||
static bool IsOnFilteredNameList(const std::string& channel_name);
|
||||
static inline void SetChannelBlockList(std::vector<std::string> new_list) { m_blocked_channel_names = new_list; }
|
||||
static inline void SetFilteredNameList(std::vector<std::string> new_list) { m_filtered_names = new_list; }
|
||||
static inline void SetChannelBlockList(const std::vector<std::string>& new_list) { m_blocked_channel_names = new_list; }
|
||||
static inline void SetFilteredNameList(const std::vector<std::string>& new_list) { m_filtered_names = new_list; }
|
||||
private:
|
||||
|
||||
LinkedList<ChatChannel*> ChatChannels;
|
||||
@@ -101,6 +101,6 @@ private:
|
||||
|
||||
};
|
||||
|
||||
std::string CapitaliseName(std::string inString);
|
||||
std::string CapitaliseName(const std::string& inString);
|
||||
|
||||
#endif
|
||||
|
||||
+9
-9
@@ -348,7 +348,7 @@ static void ProcessMailTo(Client *c, std::string MailMessage) {
|
||||
}
|
||||
}
|
||||
|
||||
static void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message) {
|
||||
static void ProcessMailTo(Client *c, const std::string& from, const std::string& subject, const std::string& message) {
|
||||
}
|
||||
|
||||
static void ProcessSetMessageStatus(std::string SetMessageCommand) {
|
||||
@@ -983,7 +983,7 @@ void Client::SendMailBoxes() {
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
Client *Clientlist::FindCharacter(std::string CharacterName) {
|
||||
Client *Clientlist::FindCharacter(const std::string& CharacterName) {
|
||||
|
||||
std::list<Client*>::iterator Iterator;
|
||||
|
||||
@@ -1243,7 +1243,7 @@ void Client::LeaveAllChannels(bool send_updated_channel_list, bool command_direc
|
||||
}
|
||||
|
||||
|
||||
void Client::ProcessChannelList(std::string Input) {
|
||||
void Client::ProcessChannelList(const std::string& Input) {
|
||||
|
||||
if (Input.length() == 0) {
|
||||
|
||||
@@ -1521,7 +1521,7 @@ void Client::SendChannelMessageByNumber(std::string Message) {
|
||||
|
||||
}
|
||||
|
||||
void Client::SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender) {
|
||||
void Client::SendChannelMessage(const std::string& ChannelName, const std::string& Message, Client *Sender) {
|
||||
|
||||
if (!Sender) return;
|
||||
|
||||
@@ -1548,7 +1548,7 @@ void Client::SendChannelMessage(std::string ChannelName, std::string Message, Cl
|
||||
safe_delete(outapp);
|
||||
}
|
||||
|
||||
void Client::ToggleAnnounce(std::string State)
|
||||
void Client::ToggleAnnounce(const std::string& State)
|
||||
{
|
||||
if (State == "")
|
||||
Announce = !Announce;
|
||||
@@ -1615,7 +1615,7 @@ void Client::GeneralChannelMessage(const char *Characters) {
|
||||
|
||||
}
|
||||
|
||||
void Client::GeneralChannelMessage(std::string Message) {
|
||||
void Client::GeneralChannelMessage(const std::string& Message) {
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_ChannelMessage, Message.length() + 3);
|
||||
char *PacketBuffer = (char *)outapp->pBuffer;
|
||||
@@ -2279,7 +2279,7 @@ void Client::SetConnectionType(char c) {
|
||||
}
|
||||
}
|
||||
|
||||
Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
|
||||
Client *Clientlist::IsCharacterOnline(const std::string& CharacterName) {
|
||||
|
||||
// This method is used to determine if the character we are a sending an email to is connected to the mailserver,
|
||||
// so we can send them a new email notification.
|
||||
@@ -2307,7 +2307,7 @@ Client *Clientlist::IsCharacterOnline(std::string CharacterName) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int Client::GetMailBoxNumber(std::string CharacterName) {
|
||||
int Client::GetMailBoxNumber(const std::string& CharacterName) {
|
||||
|
||||
for (unsigned int i = 0; i < Characters.size(); i++)
|
||||
if (Characters[i].Name == CharacterName)
|
||||
@@ -2316,7 +2316,7 @@ int Client::GetMailBoxNumber(std::string CharacterName) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void Client::SendNotification(int MailBoxNumber, std::string Subject, std::string From, int MessageID) {
|
||||
void Client::SendNotification(int MailBoxNumber, const std::string& Subject, const std::string& From, int MessageID) {
|
||||
|
||||
char TimeStamp[100];
|
||||
|
||||
|
||||
+8
-8
@@ -98,18 +98,18 @@ public:
|
||||
void AddToChannelList(ChatChannel *JoinedChannel);
|
||||
void RemoveFromChannelList(ChatChannel *JoinedChannel);
|
||||
void SendChannelMessage(std::string Message);
|
||||
void SendChannelMessage(std::string ChannelName, std::string Message, Client *Sender);
|
||||
void SendChannelMessage(const std::string& ChannelName, const std::string& Message, Client *Sender);
|
||||
void SendChannelMessageByNumber(std::string Message);
|
||||
void SendChannelList();
|
||||
void CloseConnection();
|
||||
void ToggleAnnounce(std::string State);
|
||||
void ToggleAnnounce(const std::string& State);
|
||||
bool IsAnnounceOn() { return (Announce == true); }
|
||||
void AnnounceJoin(ChatChannel *Channel, Client *c);
|
||||
void AnnounceLeave(ChatChannel *Channel, Client *c);
|
||||
void GeneralChannelMessage(std::string Message);
|
||||
void GeneralChannelMessage(const std::string& Message);
|
||||
void GeneralChannelMessage(const char *Characters);
|
||||
void SetChannelPassword(std::string ChannelPassword);
|
||||
void ProcessChannelList(std::string CommandString);
|
||||
void ProcessChannelList(const std::string& Input);
|
||||
void AccountUpdate();
|
||||
int ChannelCount();
|
||||
std::string RemoveDuplicateChannels(std::string& in_channels);
|
||||
@@ -139,14 +139,14 @@ public:
|
||||
inline bool GetForceDisconnect() { return ForceDisconnect; }
|
||||
std::string MailBoxName();
|
||||
int GetMailBoxNumber() { return CurrentMailBox; }
|
||||
int GetMailBoxNumber(std::string CharacterName);
|
||||
int GetMailBoxNumber(const std::string& CharacterName);
|
||||
|
||||
void SetConnectionType(char c);
|
||||
ConnectionType GetConnectionType() { return TypeOfConnection; }
|
||||
EQ::versions::ClientVersion GetClientVersion() { return ClientVersion_; }
|
||||
|
||||
inline bool IsMailConnection() { return (TypeOfConnection == ConnectionTypeMail) || (TypeOfConnection == ConnectionTypeCombined); }
|
||||
void SendNotification(int MailBoxNumber, std::string From, std::string Subject, int MessageID);
|
||||
void SendNotification(int MailBoxNumber, const std::string& Subject, const std::string& From, int MessageID);
|
||||
void ChangeMailBox(int NewMailBox);
|
||||
inline void SetMailBox(int NewMailBox) { CurrentMailBox = NewMailBox; }
|
||||
void SendFriends();
|
||||
@@ -184,10 +184,10 @@ public:
|
||||
Clientlist(int MailPort);
|
||||
void Process();
|
||||
void CloseAllConnections();
|
||||
Client *FindCharacter(std::string CharacterName);
|
||||
Client *FindCharacter(const std::string& CharacterName);
|
||||
void CheckForStaleConnectionsAll();
|
||||
void CheckForStaleConnections(Client *c);
|
||||
Client *IsCharacterOnline(std::string CharacterName);
|
||||
Client *IsCharacterOnline(const std::string& CharacterName);
|
||||
void ProcessOPMailCommand(Client* c, std::string command_string, bool command_directed = false);
|
||||
|
||||
private:
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ int UCSDatabase::FindAccount(const char *characterName, Client *client)
|
||||
return accountID;
|
||||
}
|
||||
|
||||
bool UCSDatabase::VerifyMailKey(std::string characterName, int IPAddress, std::string MailKey)
|
||||
bool UCSDatabase::VerifyMailKey(const std::string& characterName, int IPAddress, const std::string& MailKey)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class UCSDatabase : public Database {
|
||||
public:
|
||||
int FindAccount(const char *CharacterName, Client *c);
|
||||
int FindCharacter(const char *CharacterName);
|
||||
bool VerifyMailKey(std::string CharacterName, int IPAddress, std::string MailKey);
|
||||
bool VerifyMailKey(const std::string& characterName, int IPAddress, const std::string& MailKey);
|
||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||
bool LoadChatChannels();
|
||||
void LoadReservedNamesFromDB();
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ extern const ucsconfig *Config;
|
||||
extern UCSDatabase database;
|
||||
extern DiscordManager discord_manager;
|
||||
|
||||
void ProcessMailTo(Client *c, std::string from, std::string subject, std::string message);
|
||||
void ProcessMailTo(Client *c, const std::string& from, const std::string& subject, const std::string& message);
|
||||
|
||||
void Client45ToServerSayLink(std::string& serverSayLink, const std::string& clientSayLink);
|
||||
void Client50ToServerSayLink(std::string& serverSayLink, const std::string& clientSayLink);
|
||||
|
||||
Reference in New Issue
Block a user