summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp8
-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
-rw-r--r--src/localplayer.cpp3
-rw-r--r--src/main.cpp3
-rw-r--r--src/monster.cpp2
-rw-r--r--src/particleemitter.cpp4
-rw-r--r--src/party.cpp8
-rw-r--r--src/player.cpp7
-rw-r--r--src/player_relations.cpp2
-rw-r--r--src/resources/spritedef.cpp4
-rw-r--r--src/statuseffect.cpp10
16 files changed, 45 insertions, 42 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 521947e3..565eb35f 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -221,7 +221,7 @@ void Being::setSpeech(const std::string &text, Uint32 time)
end = mSpeech.find(']', start);
}
- if (mSpeech != "")
+ if (!mSpeech.empty())
mSpeechTime = time <= SPEECH_MAX_TIME ? time : SPEECH_MAX_TIME;
}
@@ -756,14 +756,14 @@ void Being::internalTriggerEffect(int effectId, bool sfx, bool gfx)
return;
}
- if (gfx && ed->mGFXEffect != "") {
+ if (gfx && !ed->mGFXEffect.empty()) {
Particle *selfFX;
selfFX = particleEngine->addEffect(ed->mGFXEffect, 0, 0);
controlParticle(selfFX);
}
- if (sfx && ed->mSFXEffect != "") {
+ if (sfx && !ed->mSFXEffect.empty()) {
sound.playSfx(ed->mSFXEffect);
}
}
@@ -831,7 +831,7 @@ static void initializeHair()
int index = atoi(XML::getProperty(node, "id", "-1").c_str());
std::string value = XML::getProperty(node, "value", "");
- if (index >= 0 && value != "") {
+ if (index >= 0 && !value.empty()) {
if (index >= hairColorsNr) {
hairColorsNr = index + 1;
hairColors.resize(hairColorsNr, "#000000");
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 48b1cda4..a06b9a6e 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -103,7 +103,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 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);
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 200679d1..4c117f0a 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -136,7 +136,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 47d5a99e..90ceab1a 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -189,7 +189,7 @@ bool LoginDialog::canSubmit()
bool LoginDialog::isUShort(const std::string &str)
{
- if (str == "")
+ if (str.empty())
{
return false;
}
@@ -228,7 +228,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);
@@ -247,7 +247,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), "");
@@ -255,13 +255,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 022054cc..40ef974b 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 7e0be5b1..e17f5902 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -249,7 +249,7 @@ bool RegisterDialog::canSubmit() const
bool RegisterDialog::isUShort(const std::string &str)
{
- if (str == "")
+ if (str.empty())
{
return false;
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index b450c0ba..bb43f24f 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -538,7 +538,8 @@ void LocalPlayer::attack(Being *target, bool keep)
if (mEquippedWeapon)
{
std::string soundFile = mEquippedWeapon->getSound(EQUIP_EVENT_STRIKE);
- if (soundFile != "") sound.playSfx(soundFile);
+ if (!soundFile.empty())
+ sound.playSfx(soundFile);
}
else {
sound.playSfx("sfx/fist-swish.ogg");
diff --git a/src/main.cpp b/src/main.cpp
index 4a5c1880..aa8e2805 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -974,7 +974,8 @@ int main(int argc, char *argv[])
nextState);
positionDialog(currentDialog, screenWidth,
screenHeight);
- if (options.chooseDefault || options.playername != "")
+ if (options.chooseDefault
+ || !options.playername.empty())
{
((ServerSelectDialog*) currentDialog)->action(
gcn::ActionEvent(NULL, "ok"));
diff --git a/src/monster.cpp b/src/monster.cpp
index 3b1e4c80..8f56560b 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -124,7 +124,7 @@ void Monster::setAction(Action action)
//attack particle effect
particleEffect = getInfo().getAttackParticleEffect();
- if (particleEffect != "" && mParticleEffects)
+ if (!particleEffect.empty() && mParticleEffects)
{
switch (mDirection)
{
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index fa5dcde4..25e6ade5 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -41,7 +41,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
mMap = map;
mParticleTarget = target;
- //initializing default values
+ // Initializing default values
mParticlePosX.set(0.0f);
mParticlePosY.set(0.0f);
mParticlePosZ.set(0.0f);
@@ -91,7 +91,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
{
std::string image = XML::getProperty(propertyNode, "value", "");
// Don't leak when multiple images are defined
- if (image != "" && !mParticleImage)
+ if (!image.empty() && !mParticleImage)
{
ResourceManager *resman = ResourceManager::getInstance();
mParticleImage = resman->getImage(image);
diff --git a/src/party.cpp b/src/party.cpp
index fe575a37..589aa9b1 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -67,7 +67,7 @@ void Party::respond(const std::string &command, const std::string &args)
void Party::create(const std::string &party)
{
- if (party == "")
+ if (party.empty())
{
mChat->chatLog(_("Party name is missing."), BY_SERVER);
return;
@@ -122,7 +122,7 @@ void Party::invitedAsk(const std::string &nick, int gender,
const std::string &partyName)
{
mPartyName = partyName; /* Quick and nasty - needs redoing */
- if (nick == "")
+ if (nick.empty())
{
mChat->chatLog(_("You can\'t have a blank party name!"), BY_SERVER);
return;
@@ -153,7 +153,7 @@ void Party::leftResponse(const std::string &nick)
void Party::receiveChat(Being *being, const std::string &msg)
{
- if (being == NULL)
+ if (!being)
{
return;
}
@@ -169,7 +169,7 @@ void Party::receiveChat(Being *being, const std::string &msg)
void Party::help(const std::string &msg)
{
- if (msg == "")
+ if (msg.empty())
{
mChat->chatLog(_("Command: /party <command> <args>"), BY_SERVER);
mChat->chatLog(_("where <command> can be one of:"), BY_SERVER);
diff --git a/src/player.cpp b/src/player.cpp
index 610dfeb1..a2a263b3 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -169,11 +169,12 @@ void Player::setSprite(int slot, int id, std::string color)
std::string filename = ItemDB::get(id).getSprite(mGender);
AnimatedSprite *equipmentSprite = NULL;
- if (filename != "")
+ if (!filename.empty())
{
- if (color!="") filename += "|" + color;
+ if (!color.empty())
+ filename += "|" + color;
equipmentSprite = AnimatedSprite::load(
- "graphics/sprites/" + filename);
+ "graphics/sprites/" + filename);
}
if (equipmentSprite)
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index aa83115c..c82876e1 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -58,7 +58,7 @@ class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::stri
std::map<std::string, PlayerRelation *> *container)
{
std::string name = cobj->getValue(NAME, "");
- if (name == "")
+ if (name.empty())
return container;
if (!(*container)[name]) {
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index af3281be..20c79e73 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -321,7 +321,7 @@ SpriteDef::~SpriteDef()
SpriteAction SpriteDef::makeSpriteAction(const std::string &action)
{
- if (action == "" || action == "default") {
+ if (action.empty() || action == "default") {
return ACTION_DEFAULT;
}
if (action == "stand") {
@@ -373,7 +373,7 @@ SpriteAction SpriteDef::makeSpriteAction(const std::string &action)
SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction)
{
- if (direction == "" || direction == "default") {
+ if (direction.empty() || direction == "default") {
return DIRECTION_DEFAULT;
}
else if (direction == "up") {
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 8872fd7b..7a50e794 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -39,19 +39,19 @@ StatusEffect::~StatusEffect()
void StatusEffect::playSFX()
{
- if (mSFXEffect != "")
+ if (!mSFXEffect.empty())
sound.playSfx(mSFXEffect);
}
void StatusEffect::deliverMessage()
{
- if (mMessage != "")
+ if (!mMessage.empty())
chatWindow->chatLog(mMessage, BY_SERVER);
}
Particle *StatusEffect::getParticle()
{
- if (mParticleEffect == "")
+ if (mParticleEffect.empty())
return NULL;
else
return particleEngine->addEffect(mParticleEffect, 0, 0);
@@ -59,7 +59,7 @@ Particle *StatusEffect::getParticle()
AnimatedSprite *StatusEffect::getIcon()
{
- if (mIcon == "")
+ if (mIcon.empty())
return NULL;
else {
AnimatedSprite *sprite = AnimatedSprite::load(
@@ -74,7 +74,7 @@ AnimatedSprite *StatusEffect::getIcon()
SpriteAction StatusEffect::getAction()
{
- if (mAction == "")
+ if (mAction.empty())
return ACTION_INVALID;
else
return SpriteDef::makeSpriteAction(mAction);