diff options
-rw-r--r-- | src/being.cpp | 2 | ||||
-rw-r--r-- | src/gui/browserbox.cpp | 2 | ||||
-rw-r--r-- | src/gui/chat.cpp | 18 | ||||
-rw-r--r-- | src/gui/itempopup.cpp | 2 | ||||
-rw-r--r-- | src/gui/login.cpp | 10 | ||||
-rw-r--r-- | src/gui/recorder.cpp | 2 | ||||
-rw-r--r-- | src/gui/register.cpp | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/main.cpp | 3 | ||||
-rw-r--r-- | src/monster.cpp | 2 | ||||
-rw-r--r-- | src/particleemitter.cpp | 4 | ||||
-rw-r--r-- | src/party.cpp | 8 | ||||
-rw-r--r-- | src/player.cpp | 7 | ||||
-rw-r--r-- | src/player_relations.cpp | 2 | ||||
-rw-r--r-- | src/resources/spritedef.cpp | 4 |
15 files changed, 37 insertions, 34 deletions
diff --git a/src/being.cpp b/src/being.cpp index 7a7f3df7..d847b032 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -214,7 +214,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; } 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; } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index fb539a46..b8703b70 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -537,7 +537,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 { diff --git a/src/main.cpp b/src/main.cpp index 7f2012c9..c68c02d8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -975,7 +975,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 9f12ebf4..cc529196 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -125,7 +125,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 2c239fb9..84c4c1ec 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -42,7 +42,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); @@ -92,7 +92,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 75569bc5..a4f1b940 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 0eea8a6a..5256831b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -170,11 +170,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 d9ff4b8d..1c1ba669 100644 --- a/src/player_relations.cpp +++ b/src/player_relations.cpp @@ -59,7 +59,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 989741dc..d6cc8960 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -322,7 +322,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") { @@ -374,7 +374,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") { |