From b3f70d8d46199524edc590269a73c262899763c7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Sep 2011 00:07:56 +0300 Subject: Replace most iterator to const_iterator. Some other minor changes. --- src/resources/image.cpp | 4 ++-- src/resources/itemdb.cpp | 2 +- src/resources/iteminfo.cpp | 6 ++++-- src/resources/mapreader.cpp | 2 +- src/resources/specialdb.cpp | 2 +- src/resources/spritedef.cpp | 2 +- src/resources/wallpaper.cpp | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/resources') diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 802f2ee12..e28cb2bc5 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -336,7 +336,7 @@ bool Image::hasAlphaChannel() SDL_Surface *Image::getByAlpha(float alpha) { - std::map::iterator it = mAlphaCache.find(alpha); + std::map::const_iterator it = mAlphaCache.find(alpha); if (it != mAlphaCache.end()) return (*it).second; return 0; @@ -361,7 +361,7 @@ void Image::setAlpha(float alpha) { #ifdef DEBUG_ALPHA_CACHE logger->log("cleanCache"); - for (std::map::iterator + for (std::map::const_iterator i = mAlphaCache.begin(), i_end = mAlphaCache.end(); i != i_end; ++i) { diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 733c12958..89df407a6 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -308,7 +308,7 @@ void ItemDB::load() effect += " / "; effect += strprintf(gettext(fields[i][1]), value); } - for (std::vector::iterator it = extraStats.begin(); + for (std::vector::const_iterator it = extraStats.begin(); it != extraStats.end(); ++it) { int value = XML::getProperty(node, it->tag.c_str(), 0); diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index fb4b8ed5e..75e6e1d8c 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -185,7 +185,8 @@ std::string ItemInfo::getDyeColorsString(int color) const if (!mColors || mColorList.empty()) return ""; - std::map ::iterator it = mColors->find(color); + std::map ::const_iterator + it = mColors->find(color); if (it == mColors->end()) return ""; @@ -208,7 +209,8 @@ const std::string ItemInfo::replaceColors(std::string str, std::string name; if (mColors && !mColorList.empty()) { - std::map ::iterator it = mColors->find(color); + std::map ::const_iterator + it = mColors->find(color); if (it == mColors->end()) name = "unknown"; else diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 685d415ff..f702864ea 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -734,7 +734,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, const std::string &path, Animation *ani = new Animation; for (int i = 0; ; i++) { - std::map::iterator iFrame, iDelay; + std::map::const_iterator iFrame, iDelay; iFrame = tileProperties.find( "animation-frame" + toString(i)); iDelay = tileProperties.find( diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp index 573ffb2a3..2463da06a 100644 --- a/src/resources/specialdb.cpp +++ b/src/resources/specialdb.cpp @@ -123,7 +123,7 @@ void SpecialDB::unload() SpecialInfo *SpecialDB::get(int id) { - SpecialInfos::iterator i = mSpecialInfos.find(id); + SpecialInfos::const_iterator i = mSpecialInfos.find(id); if (i == mSpecialInfos.end()) return NULL; diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index dee93e1e7..2e32f6c5f 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -86,7 +86,7 @@ void SpriteDef::substituteAction(std::string complete, std::string with) { if (mActions.find(complete) == mActions.end()) { - Actions::iterator i = mActions.find(with); + Actions::const_iterator i = mActions.find(with); if (i != mActions.end()) mActions[complete] = i->second; } diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 09c9f2a04..5cfec3b84 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -137,7 +137,7 @@ void Wallpaper::loadWallpapers() std::string Wallpaper::getWallpaper(int width, int height) { - std::vector::iterator iter; + std::vector::const_iterator iter; WallpaperData wp; // Wallpaper filename container -- cgit v1.2.3-70-g09d2