From 8712ce09e8f3a86dcf2f6c8ee7d030e3b41a4618 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Tue, 10 Feb 2009 23:35:30 +0100 Subject: Use string::empty() instead of comparing to "" --- src/gui/chat.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/gui/chat.cpp') diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 1c0cea13..2845691a 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -91,7 +91,7 @@ Window(""), mNetwork(network), mTmpVisible(false) // Read the party prefix std::string partyPrefix = config.getValue("PartyPrefix", "$"); - mPartyPrefix = (partyPrefix == "" ? '$' : partyPrefix.at(0)); + mPartyPrefix = (partyPrefix.empty() ? '$' : partyPrefix.at(0)); mReturnToggles = config.getValue("ReturnToggles", "0") == "1"; mRecorder = new Recorder(this); mParty = new Party(this, mNetwork); @@ -195,7 +195,7 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##S"; } - if (tmp.nick == "" && tmp.text.substr(0, 17) == "Visible GM status") + if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status") { player_node->setGM(); } @@ -449,7 +449,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) msg = msg.substr(0, space); } - if (msg != "" && msg.at(0) == '/') + if (!msg.empty() && msg.at(0) == '/') { msg.erase(0, 1); } @@ -477,7 +477,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) mRecorder->changeRecordingStatus(msg); else if (command == "toggle") { - if (msg == "") + if (msg.empty()) { chatLog(mReturnToggles ? _("Return toggles chat.") : _("Message closes chat."), BY_SERVER); @@ -508,7 +508,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) } else if (command == "party") { - if (msg == "") + if (msg.empty()) { chatLog(_("Unknown party command... Type \"/help\" party for more " "information."), BY_SERVER); @@ -519,7 +519,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) std::string rest = (space == std::string::npos ? "" : msg.substr(space + 1, msg.length())); - if (rest != "") + if (!rest.empty()) { msg = msg.substr(0, space); trim(msg); @@ -566,7 +566,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg) { if ((*bi)->getType() == Being::PLAYER) { - if (response != "") + if (!response.empty()) { response += ", "; } @@ -758,7 +758,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest) { if (command == "prefix") { - if (rest == "") + if (rest.empty()) { char temp[2] = "."; *temp = mPartyPrefix; @@ -789,7 +789,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest) void ChatWindow::help(const std::string & msg1, const std::string & msg2) { chatLog(_("-- Help --"), BY_SERVER); - if (msg1 == "") + if (msg1.empty()) { chatLog(_("/announce: Global announcement (GM only)"), BY_SERVER); chatLog(_("/clear: Clears this window"), BY_SERVER); -- cgit v1.2.3-60-g2f50