summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-02-10 23:35:30 +0100
committerIra Rice <irarice@gmail.com>2009-02-10 20:26:01 -0700
commitff1205d2b89f7f2273a32176c746f36836d7bfa9 (patch)
tree9174cd93bbc3445b027a04637f76b67948a85eab /src/gui
parentd99b00a149e7828adb3c4651069483e51b0b458b (diff)
downloadMana-ff1205d2b89f7f2273a32176c746f36836d7bfa9.tar.gz
Mana-ff1205d2b89f7f2273a32176c746f36836d7bfa9.tar.bz2
Mana-ff1205d2b89f7f2273a32176c746f36836d7bfa9.tar.xz
Mana-ff1205d2b89f7f2273a32176c746f36836d7bfa9.zip
Use string::empty() instead of comparing to ""
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/browserbox.cpp2
-rw-r--r--src/gui/chat.cpp18
-rw-r--r--src/gui/itempopup.cpp2
-rw-r--r--src/gui/login.cpp10
-rw-r--r--src/gui/recorder.cpp2
-rw-r--r--src/gui/register.cpp2
6 files changed, 18 insertions, 18 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index f0c77e46..37480415 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -104,7 +104,7 @@ void BrowserBox::addRow(const std::string &row)
newRow += "##<" + bLink.caption;
tmp.erase(0, idx3 + 2);
- if (tmp != "")
+ if (!tmp.empty())
{
newRow += "##>";
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 49df0f9d..953a9a37 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -92,7 +92,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);
@@ -193,7 +193,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();
}
@@ -447,7 +447,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);
}
@@ -475,7 +475,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);
@@ -506,7 +506,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);
@@ -517,7 +517,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);
@@ -564,7 +564,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
{
if ((*bi)->getType() == Being::PLAYER)
{
- if (response != "")
+ if (!response.empty())
{
response += ", ";
}
@@ -757,7 +757,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;
@@ -788,7 +788,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);
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 9c0bd65c..f589286b 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -137,7 +137,7 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
numRowsWeight * getFont()->getHeight()));
- if (item.getEffect() == "")
+ if (item.getEffect().empty())
{
setContentSize(minWidth, (numRowsDesc * getFont()->getHeight() +
(3 * getFont()->getHeight())));
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 14370485..1d864a96 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -194,7 +194,7 @@ bool LoginDialog::canSubmit()
bool LoginDialog::isUShort(const std::string &str)
{
- if (str == "")
+ if (str.empty())
{
return false;
}
@@ -233,7 +233,7 @@ unsigned short LoginDialog::getUShort(const std::string &str)
void LoginDialog::DropDownList::saveEntry(const std::string &server,
const std::string &port, int &saved)
{
- if (saved < MAX_SERVER_LIST_SIZE && server != "")
+ if (saved < MAX_SERVER_LIST_SIZE && !server.empty())
{
config.setValue(mConfigPrefix + "Server" + toString(saved), server);
config.setValue(mConfigPrefix + "Port" + toString(saved), port);
@@ -252,7 +252,7 @@ LoginDialog::DropDownList::DropDownList(std::string prefix,
{
std::string server = config.getValue(mConfigPrefix + "Server" +
toString(i), "");
- if (server == "") // Just in case had original config entries
+ if (server.empty()) // Just in case had original config entries
{
server = config.getValue(mConfigPrefix + "ServerList" +
toString(i), "");
@@ -260,13 +260,13 @@ LoginDialog::DropDownList::DropDownList(std::string prefix,
std::string port = config.getValue(mConfigPrefix + "Port" +
toString(i), dfltPort.front());
- if (server != "")
+ if (!server.empty())
{
mServers.push_back(server);
mPorts.push_back(port);
}
}
- if (mServers.size() == 0)
+ if (mServers.empty())
{
mServers.assign(dflt.begin(), dflt.end());
mPorts.assign(dfltPort.begin(), dfltPort.end());
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index c7989495..032b9790 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -69,7 +69,7 @@ void Recorder::changeRecordingStatus(const std::string &msg)
std::string msgCopy = msg;
trim(msgCopy);
- if (msgCopy == "")
+ if (msgCopy.empty())
{
if (mStream.is_open())
{
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 9be44f43..50182de1 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -250,7 +250,7 @@ bool RegisterDialog::canSubmit() const
bool RegisterDialog::isUShort(const std::string &str)
{
- if (str == "")
+ if (str.empty())
{
return false;
}