diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/updatewindow.cpp | 4 | ||||
-rw-r--r-- | src/gui/whoisonline.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/worldselectdialog.cpp | 6 | ||||
-rw-r--r-- | src/localplayer.cpp | 2 | ||||
-rw-r--r-- | src/map.cpp | 14 | ||||
-rw-r--r-- | src/net/tmwa/messageout.cpp | 3 | ||||
-rw-r--r-- | src/playerrelations.cpp | 2 | ||||
-rw-r--r-- | src/resources/dye.cpp | 2 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 6 | ||||
-rw-r--r-- | src/resources/wallpaper.cpp | 2 |
11 files changed, 27 insertions, 20 deletions
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 542d665d5..9a2b4d75a 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -450,7 +450,7 @@ void UpdaterWindow::loadUpdates() if (mUpdateFiles.empty()) { // updates not downloaded mUpdateFiles = loadXMLFile(mUpdatesDir + "/" + xmlUpdateFile); - if (!mUpdateFiles.size()) + if (mUpdateFiles.empty()) { logger->log("Warning this server does not have a" " %s file falling back to %s", xmlUpdateFile.c_str(), @@ -579,7 +579,7 @@ void UpdaterWindow::logic() mUpdateFiles = loadXMLFile( mUpdatesDir + "/" + xmlUpdateFile); - if (mUpdateFiles.size() == 0) + if (mUpdateFiles.empty()) { logger->log("Warning this server does not have a %s" " file falling back to %s", diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index f64bf383e..c4d9e92a3 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -480,7 +480,7 @@ void WhoIsOnline::logic() mUpdateButton->setEnabled(true); mUpdateTimer = 0; updateSize(); - if (mOnlinePlayers.size() > 0 && chatWindow) + if (!mOnlinePlayers.empty() && chatWindow) chatWindow->updateOnline(mOnlinePlayers); } break; diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 683b02fe6..6e15d4bf9 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -131,8 +131,8 @@ void EmoteShortcutContainer::draw(gcn::Graphics *graphics) mEmoteImg[i]->sprite->draw(g, emoteX + 2, emoteY + 10); } - if (mEmoteMoved && mEmoteMoved < static_cast<unsigned>(mEmoteImg.size()) + 1 - && mEmoteMoved > 0) + if (mEmoteMoved && mEmoteMoved < static_cast<unsigned>( + mEmoteImg.size()) + 1 && mEmoteMoved > 0) { // Draw the emote image being dragged by the cursor. const EmoteSprite* sprite = mEmoteImg[mEmoteMoved - 1]; diff --git a/src/gui/worldselectdialog.cpp b/src/gui/worldselectdialog.cpp index 2bb76e306..3a35e3396 100644 --- a/src/gui/worldselectdialog.cpp +++ b/src/gui/worldselectdialog.cpp @@ -91,12 +91,16 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds): reflowLayout(0, 0); - if (worlds.size() == 0) + if (worlds.empty()) + { // Disable Ok button mChooseWorld->setEnabled(false); + } else + { // Select first server mWorldList->setSelected(0); + } addKeyListener(this); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index a08eb1265..4d085eae4 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1586,7 +1586,7 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event) int change = exp.first - event.getInt("oldValue1"); if (change != 0 && mMessages.size() < 20) { - if (mMessages.size() > 0) + if (!mMessages.empty()) { MessagePair pair = mMessages.back(); if (pair.first.find(" xp") == pair.first.size() - 3) diff --git a/src/map.cpp b/src/map.cpp index 9557d7b79..a33a87f67 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -516,7 +516,7 @@ void Map::update(int ticks) // Update animated tiles for (std::map<int, TileAnimation*>::iterator iAni = mTileAnimations.begin(); - iAni != mTileAnimations.end(); iAni++) + iAni != mTileAnimations.end(); ++iAni) { iAni->second->update(ticks); } @@ -704,10 +704,10 @@ void Map::updateAmbientLayers(float scrollX, float scrollY) int timePassed = get_elapsed_time(lastTick); std::list<AmbientLayer*>::iterator i; - for (i = mBackgrounds.begin(); i != mBackgrounds.end(); i++) + for (i = mBackgrounds.begin(); i != mBackgrounds.end(); ++i) (*i)->update(timePassed, dx, dy); - for (i = mForegrounds.begin(); i != mForegrounds.end(); i++) + for (i = mForegrounds.begin(); i != mForegrounds.end(); ++i) (*i)->update(timePassed, dx, dy); mLastScrollX = scrollX; @@ -741,7 +741,7 @@ void Map::drawAmbientLayers(Graphics *graphics, LayerType type, // Draw overlays for (std::list<AmbientLayer*>::iterator i = layers->begin(); - i != layers->end(); i++) + i != layers->end(); ++i) { (*i)->draw(graphics, graphics->getWidth(), graphics->getHeight()); @@ -968,7 +968,7 @@ Path Map::findPixelPath(int startPixelX, int startPixelY, int endPixelX, it->x * 32 + startOffsetX + static_cast<float>(changeX * i), it->y * 32 + startOffsetY + static_cast<float>(changeY * i)); i++; - it++; + ++it; } // Remove the last path node, as it's more clever to go to the destination. @@ -1207,7 +1207,7 @@ void Map::initializeParticleEffects(Particle *particleEngine) { for (std::list<ParticleEffectData>::iterator i = particleEffects.begin(); - i != particleEffects.end(); i++) + i != particleEffects.end(); ++i) { p = particleEngine->addEffect(i->file, i->x, i->y); if (p && i->w > 0 && i->h > 0) @@ -1382,7 +1382,7 @@ MapItem *Map::findPortalXY(int x, int y) std::list<MapItem*>::iterator it_end; for (it = mMapPortals.begin(), it_end = mMapPortals.end(); - it != it_end; it++) + it != it_end; ++it) { MapItem *item = *it; if (item->mX == x && item->mY == y) diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index 17314937d..b6fcc09a1 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -82,7 +82,8 @@ void MessageOut::writeInt32(Sint32 value) } #define LOBYTE(w) (static_cast<unsigned char>(w)) -#define HIBYTE(w) (static_cast<unsigned char>((static_cast<unsigned short>(w)) >> 8)) +#define HIBYTE(w) (static_cast<unsigned char>(( \ +static_cast<unsigned short>(w)) >> 8)) void MessageOut::writeCoordinates(unsigned short x, unsigned short y, unsigned char direction) diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 9259ae034..91fec9947 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -477,7 +477,7 @@ public: std::vector<PlayerIgnoreStrategy *> * PlayerRelationsManager::getPlayerIgnoreStrategies() { - if (mIgnoreStrategies.size() == 0) + if (mIgnoreStrategies.empty()) { // not initialised yet? mIgnoreStrategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE, diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index 7d92e12ce..2d621127b 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -161,7 +161,7 @@ void DyePalette::getColor(int intensity, int color[3]) const void DyePalette::getColor(double intensity, int color[3]) const { // Nothing to do here - if (mColors.size() == 0) + if (mColors.empty()) return; // Force range diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index d66e2dbe3..d930bf083 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -197,7 +197,8 @@ Map *MapReader::readMap(const std::string &filename, unsigned char *inflated; unsigned int inflatedSize; - if (realFilename.find(".gz", realFilename.length() - 3) != std::string::npos) + if (realFilename.find(".gz", realFilename.length() - 3) + != std::string::npos) { // Inflate the gzipped map data inflatedSize = inflateMemory(static_cast<unsigned char*>(buffer), @@ -232,7 +233,8 @@ Map *MapReader::readMap(const std::string &filename, } else { - logger->log("Error while parsing map file (%s)!", realFilename.c_str()); + logger->log("Error while parsing map file (%s)!", + realFilename.c_str()); } if (map) diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 936e72ca0..a2e3861e9 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -154,7 +154,7 @@ std::string Wallpaper::getWallpaper(int width, int height) if (!wallPaperVector.empty()) { // If we've got more than one occurence of a valid wallpaper... - if (wallPaperVector.size() > 0) + if (!wallPaperVector.empty()) { // Return randomly a wallpaper between vector[0] and // vector[vector.size() - 1] |