diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-02-28 15:23:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-02-28 15:23:03 +0300 |
commit | 5ae7168e1f30efa4fd61c155eaecd55ce83bea14 (patch) | |
tree | 617af9417f6b4175fdf4ba0691dd5c4ac28e427e /src/guildmanager.cpp | |
parent | 096de2a656c036a241dd5f10c2bf28ae4d4dbe5a (diff) | |
download | manaplus-5ae7168e1f30efa4fd61c155eaecd55ce83bea14.tar.gz manaplus-5ae7168e1f30efa4fd61c155eaecd55ce83bea14.tar.bz2 manaplus-5ae7168e1f30efa4fd61c155eaecd55ce83bea14.tar.xz manaplus-5ae7168e1f30efa4fd61c155eaecd55ce83bea14.zip |
improve guild related files.
Diffstat (limited to 'src/guildmanager.cpp')
-rw-r--r-- | src/guildmanager.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index 4359d2659..eb56c2fc0 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -108,12 +108,12 @@ void GuildManager::reload() mTab = nullptr; } -void GuildManager::send(std::string msg) const +void GuildManager::send(const std::string &msg) { Net::getChatHandler()->privateMessage("guild", msg); } -void GuildManager::chat(std::string msg) +void GuildManager::chat(const std::string &msg) { if (!player_node || !mTab) return; @@ -238,7 +238,7 @@ Guild *GuildManager::createGuild() const return guild; } -bool GuildManager::processGuildMessage(std::string msg) +bool GuildManager::processGuildMessage(const std::string &msg) { const bool res = process(msg); @@ -354,7 +354,7 @@ bool GuildManager::process(std::string msg) // logger->log("OL"); mTempList.clear(); splitToStringVector(mTempList, msg, '#'); - if (msg.size() < 1 || msg[msg.size() - 1] != '#') + if (msg.empty() || msg[msg.size() - 1] != '#') updateList(); mRequest = false; mGotOnlineInfo = true; @@ -364,7 +364,7 @@ bool GuildManager::process(std::string msg) { // logger->log("oL"); splitToStringVector(mTempList, msg, '#'); - if (msg.size() < 1 || msg[msg.size() - 1] != '#') + if (msg.empty() || msg[msg.size() - 1] != '#') updateList(); mRequest = false; mGotOnlineInfo = true; @@ -431,7 +431,7 @@ bool GuildManager::process(std::string msg) const size_t pos = msg.find(": ", 0); if (pos != std::string::npos) { - std::string sender_name = ((pos == std::string::npos) + const std::string sender_name = ((pos == std::string::npos) ? "" : msg.substr(0, pos)); if (!guild->getMember(sender_name)) { @@ -456,22 +456,22 @@ bool GuildManager::process(std::string msg) return false; } -void GuildManager::kick(std::string msg) const +void GuildManager::kick(const std::string &msg) { send("!remove " + msg); } -void GuildManager::invite(std::string msg) const +void GuildManager::invite(const std::string &msg) { send("!invite " + msg); } -void GuildManager::leave() const +void GuildManager::leave() { send("!leave"); } -void GuildManager::notice(std::string msg) const +void GuildManager::notice(const std::string &msg) { if (msg.empty()) send("!removemotd"); @@ -479,7 +479,7 @@ void GuildManager::notice(std::string msg) const send("!setmotd " + msg); } -void GuildManager::clear() const +void GuildManager::clear() { if (socialWindow) { @@ -489,7 +489,7 @@ void GuildManager::clear() const } } -void GuildManager::inviteResponse(const bool response) const +void GuildManager::inviteResponse(const bool response) { if (response) send("yes"); |