diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-09-14 15:36:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-09-14 15:36:47 +0300 |
commit | 0abd36c63a6ffd16e998fe1552f822ca351ef2b2 (patch) | |
tree | ef2ee4fd8d9fb0383074ddace03eb76e47f0feb4 | |
parent | 2c73f0e2300c00ec2e1c26ecb7a6c7a500381f0f (diff) | |
download | manaverse-0abd36c63a6ffd16e998fe1552f822ca351ef2b2.tar.gz manaverse-0abd36c63a6ffd16e998fe1552f822ca351ef2b2.tar.bz2 manaverse-0abd36c63a6ffd16e998fe1552f822ca351ef2b2.tar.xz manaverse-0abd36c63a6ffd16e998fe1552f822ca351ef2b2.zip |
Replace some size() calls to empty().
-rw-r--r-- | src/actorsprite.cpp | 2 | ||||
-rw-r--r-- | src/compoundsprite.h | 3 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 2 | ||||
-rw-r--r-- | src/resources/iteminfo.cpp | 4 |
4 files changed, 7 insertions, 4 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index e90536b2d..6155bb7af 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -331,7 +331,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, } // Ensure that something is shown, if desired - if (size() == 0 && forceDisplay) + if (empty() && forceDisplay) { if (display.image.empty()) { diff --git a/src/compoundsprite.h b/src/compoundsprite.h index 2211cb80c..d1b019057 100644 --- a/src/compoundsprite.h +++ b/src/compoundsprite.h @@ -85,6 +85,9 @@ public: size_t size() const { return std::vector<Sprite*>::size(); } + bool empty() const + { return std::vector<Sprite*>::empty(); } + void addSprite(Sprite* sprite); void setSprite(int layer, Sprite* sprite); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 1b0dd22aa..5a00d4a76 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -367,7 +367,7 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): loadServers(false); - if (mServers.size() == 0) + if (mServers.empty()) downloadServerList(); } diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index a5b81081c..5b07724a1 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -139,7 +139,7 @@ const std::string &ItemInfo::getSound(EquipmentSoundEvent event) const if (i == mSounds.end()) return empty; - return i->second.size() > 0 ? i->second[rand() % i->second.size()] : empty; + return (!i->second.empty()) ? i->second[rand() % i->second.size()] : empty; } std::map<int, int> *ItemInfo::addReplaceSprite(int sprite, int direction) @@ -222,7 +222,7 @@ const std::string ItemInfo::replaceColors(std::string str, } str = replaceAll(str, "%color%", name); - if (name.size() > 0) + if (!name.empty()) name[0] = static_cast<char>(toupper(name[0])); return replaceAll(str, "%Color%", name); |