summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-09-08 00:07:56 +0300
committerAndrei Karas <akaras@inbox.ru>2011-09-08 00:07:56 +0300
commitb3f70d8d46199524edc590269a73c262899763c7 (patch)
treeaf8e20371f2cc825c0b2dbe0c0e5c392a926c46d
parent3f84fc198131ff706e18c56f612e38ff147b0005 (diff)
downloadmanaplus-b3f70d8d46199524edc590269a73c262899763c7.tar.gz
manaplus-b3f70d8d46199524edc590269a73c262899763c7.tar.bz2
manaplus-b3f70d8d46199524edc590269a73c262899763c7.tar.xz
manaplus-b3f70d8d46199524edc590269a73c262899763c7.zip
Replace most iterator to const_iterator.
Some other minor changes.
-rw-r--r--src/actorsprite.cpp2
-rw-r--r--src/actorspritemanager.cpp34
-rw-r--r--src/being.cpp12
-rw-r--r--src/compoundsprite.cpp6
-rw-r--r--src/effectmanager.cpp4
-rw-r--r--src/event.cpp7
-rw-r--r--src/graphics.cpp6
-rw-r--r--src/gui/buydialog.cpp4
-rw-r--r--src/gui/buyselldialog.cpp4
-rw-r--r--src/gui/charselectdialog.cpp4
-rw-r--r--src/gui/chatwindow.cpp14
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/ministatuswindow.cpp6
-rw-r--r--src/gui/npcdialog.cpp16
-rw-r--r--src/gui/npcpostdialog.cpp4
-rw-r--r--src/gui/palette.cpp4
-rw-r--r--src/gui/popupmenu.cpp10
-rw-r--r--src/gui/quitdialog.cpp2
-rw-r--r--src/gui/selldialog.cpp4
-rw-r--r--src/gui/setup.cpp13
-rw-r--r--src/gui/setup_video.cpp4
-rw-r--r--src/gui/shopwindow.cpp10
-rw-r--r--src/gui/skilldialog.cpp12
-rw-r--r--src/gui/socialwindow.cpp14
-rw-r--r--src/gui/specialswindow.cpp5
-rw-r--r--src/gui/statuswindow.cpp12
-rw-r--r--src/gui/userpalette.cpp2
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/flowcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/layout.cpp10
-rw-r--r--src/gui/widgets/setuptabscroll.cpp18
-rw-r--r--src/gui/widgets/vertcontainer.cpp5
-rw-r--r--src/gui/widgets/window.cpp2
-rw-r--r--src/gui/windowmenu.cpp2
-rw-r--r--src/guichan/focushandler.cpp6
-rw-r--r--src/guichan/gui.cpp8
-rw-r--r--src/guichan/widget.cpp2
-rw-r--r--src/guichan/widgets/window.cpp2
-rw-r--r--src/guild.cpp6
-rw-r--r--src/guildmanager.cpp4
-rw-r--r--src/localplayer.cpp14
-rw-r--r--src/map.cpp41
-rw-r--r--src/net/ea/inventoryhandler.cpp4
-rw-r--r--src/net/manaserv/network.cpp6
-rw-r--r--src/net/manaserv/npchandler.cpp4
-rw-r--r--src/net/tmwa/npchandler.cpp2
-rw-r--r--src/openglgraphics.cpp8
-rw-r--r--src/particlecontainer.cpp2
-rw-r--r--src/particleemitter.cpp6
-rw-r--r--src/party.cpp7
-rw-r--r--src/playerinfo.cpp5
-rw-r--r--src/resources/image.cpp4
-rw-r--r--src/resources/itemdb.cpp2
-rw-r--r--src/resources/iteminfo.cpp6
-rw-r--r--src/resources/mapreader.cpp2
-rw-r--r--src/resources/specialdb.cpp2
-rw-r--r--src/resources/spritedef.cpp2
-rw-r--r--src/resources/wallpaper.cpp2
-rw-r--r--src/spellmanager.cpp4
-rw-r--r--src/textmanager.cpp7
-rw-r--r--src/utils/stringutils.cpp11
62 files changed, 228 insertions, 201 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 2b133eca5..2cc138047 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -113,7 +113,7 @@ void ActorSprite::logic()
if (mMustResetParticles)
{
mMustResetParticles = false;
- for (std::set<int>::iterator it = mStatusEffects.begin();
+ for (std::set<int>::const_iterator it = mStatusEffects.begin();
it != mStatusEffects.end(); ++it)
{
const StatusEffect *effect
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 5f28f237c..edd1db2aa 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -105,9 +105,9 @@ class SortBeingFunctor
{
int w1 = defaultPriorityIndex;
int w2 = defaultPriorityIndex;
- std::map<std::string, int>::iterator it1
+ std::map<std::string, int>::const_iterator it1
= priorityBeings->find(being1->getName());
- std::map<std::string, int>::iterator it2
+ std::map<std::string, int>::const_iterator it2
= priorityBeings->find(being2->getName());
if (it1 != priorityBeings->end())
w1 = (*it1).second;
@@ -144,9 +144,9 @@ class SortBeingFunctor
{
int w1 = defaultAttackIndex;
int w2 = defaultAttackIndex;
- std::map<std::string, int>::iterator it1
+ std::map<std::string, int>::const_iterator it1
= attackBeings->find(being1->getName());
- std::map<std::string, int>::iterator it2
+ std::map<std::string, int>::const_iterator it2
= attackBeings->find(being2->getName());
if (it1 != attackBeings->end())
w1 = (*it1).second;
@@ -327,9 +327,9 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y,
return being;
}
else if (!noBeing && (being->getPixelX() - 32 <= x) &&
- (being->getPixelX() + 32 > x) &&
- (being->getPixelY() - 64 <= y) &&
- (being->getPixelY() + 16 > y))
+ (being->getPixelX() + 32 > x) &&
+ (being->getPixelY() - 64 <= y) &&
+ (being->getPixelY() + 16 > y))
{
if (tempBeing)
noBeing = true;
@@ -705,7 +705,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
beingSorter.priorityBeings = &priorityMobsMap;
if (ignoreAttackMobs.find("") != ignoreAttackMobs.end())
ignoreDefault = true;
- std::map<std::string, int>::iterator itr = attackMobsMap.find("");
+ std::map<std::string, int>::const_iterator itr = attackMobsMap.find("");
if (itr != attackMobsMap.end())
defaultAttackIndex = (*itr).second;
itr = priorityMobsMap.find("");
@@ -855,7 +855,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
int w2 = defaultPriorityIndex;
if (closestBeing)
{
- std::map<std::string, int>::iterator it2
+ std::map<std::string, int>::const_iterator it2
= priorityMobsMap.find(being->getName());
if (it2 != priorityMobsMap.end())
w2 = (*it2).second;
@@ -880,7 +880,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
{
dist = d;
closestBeing = being;
- std::map<std::string, int>::iterator it1
+ std::map<std::string, int>::const_iterator it1
= priorityMobsMap.find(being->getName());
if (it1 != priorityMobsMap.end())
index = (*it1).second;
@@ -1054,7 +1054,7 @@ void ActorSpriteManager::printBeingsToChat(ActorSprites beings,
debugChatTab->chatLog("---------------------------------------");
debugChatTab->chatLog(header);
- std::set<ActorSprite*>::iterator it;
+ std::set<ActorSprite*>::const_iterator it;
for (it = beings.begin(); it != beings.end(); ++it)
{
if ((*it)->getType() == ActorSprite::FLOOR_ITEM)
@@ -1079,7 +1079,7 @@ void ActorSpriteManager::printBeingsToChat(std::vector<Being*> beings,
debugChatTab->chatLog("---------------------------------------");
debugChatTab->chatLog(header);
- std::vector<Being*>::iterator i;
+ std::vector<Being*>::const_iterator i;
for (i = beings.begin(); i != beings.end(); ++i)
{
const Being *being = *i;
@@ -1298,7 +1298,7 @@ void ActorSpriteManager::addIgnoreAttackMob(std::string name)
void ActorSpriteManager::rebuildPriorityAttackMobs()
{
mPriorityAttackMobsMap.clear();
- std::list<std::string>::iterator i = mPriorityAttackMobs.begin();
+ std::list<std::string>::const_iterator i = mPriorityAttackMobs.begin();
int cnt = 0;
while (i != mPriorityAttackMobs.end())
{
@@ -1311,7 +1311,7 @@ void ActorSpriteManager::rebuildPriorityAttackMobs()
void ActorSpriteManager::rebuildAttackMobs()
{
mAttackMobsMap.clear();
- std::list<std::string>::iterator i = mAttackMobs.begin();
+ std::list<std::string>::const_iterator i = mAttackMobs.begin();
int cnt = 0;
while (i != mAttackMobs.end())
{
@@ -1323,7 +1323,7 @@ void ActorSpriteManager::rebuildAttackMobs()
int ActorSpriteManager::getPriorityAttackMobIndex(std::string name)
{
- std::map<std::string, int>::iterator i = mPriorityAttackMobsMap.find(name);
+ std::map<std::string, int>::const_iterator i = mPriorityAttackMobsMap.find(name);
if (i == mPriorityAttackMobsMap.end())
return -1;
@@ -1332,7 +1332,7 @@ int ActorSpriteManager::getPriorityAttackMobIndex(std::string name)
int ActorSpriteManager::getAttackMobIndex(std::string name)
{
- std::map<std::string, int>::iterator i = mAttackMobsMap.find(name);
+ std::map<std::string, int>::const_iterator i = mAttackMobsMap.find(name);
if (i == mAttackMobsMap.end())
return -1;
@@ -1344,7 +1344,7 @@ void ActorSpriteManager::loadAttackList()
bool empty = false;
std::list<std::string> list = unpackList(
serverConfig.getValue("attackPriorityMobs", ""));
- std::list<std::string>::iterator i = list.begin();
+ std::list<std::string>::const_iterator i = list.begin();
while (i != list.end())
{
if (*i == "")
diff --git a/src/being.cpp b/src/being.cpp
index 5a4bcd737..090e7d10d 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -2155,20 +2155,20 @@ void Being::recalcSpritesOrder()
if (spriteToItems)
{
- SpriteToItemMap::iterator it;
+ SpriteToItemMap::const_iterator it;
for (it = spriteToItems->begin();
it != spriteToItems->end(); ++it)
{
int removeSprite = it->first;
- std::map<int, int> &itemReplacer = it->second;
+ const std::map<int, int> &itemReplacer = it->second;
if (itemReplacer.empty())
{
mSpriteHide[removeSprite] = 1;
}
else
{
- std::map<int, int>::iterator repIt
+ std::map<int, int>::const_iterator repIt
= itemReplacer.find(mSpriteIDs[removeSprite]);
if (repIt != itemReplacer.end())
{
@@ -2188,7 +2188,7 @@ void Being::recalcSpritesOrder()
if (info.mDrawBefore[dir] > 0)
{
int id2 = mSpriteIDs[info.mDrawBefore[dir]];
- std::map<int, int>::iterator orderIt = itemSlotRemap.find(id2);
+ std::map<int, int>::const_iterator orderIt = itemSlotRemap.find(id2);
if (orderIt != itemSlotRemap.end())
{
// logger->log("found duplicate (before)");
@@ -2211,7 +2211,7 @@ void Being::recalcSpritesOrder()
else if (info.mDrawAfter[dir] > 0)
{
int id2 = mSpriteIDs[info.mDrawAfter[dir]];
- std::map<int, int>::iterator orderIt = itemSlotRemap.find(id2);
+ std::map<int, int>::const_iterator orderIt = itemSlotRemap.find(id2);
if (orderIt != itemSlotRemap.end())
{
// logger->log("found duplicate (after)");
@@ -2256,7 +2256,7 @@ void Being::recalcSpritesOrder()
int idx1 = -1;
// logger->log("item %d, id=%d", slot, id);
int reorder = 0;
- std::map<int, int>::iterator orderIt = itemSlotRemap.find(id);
+ std::map<int, int>::const_iterator orderIt = itemSlotRemap.find(id);
if (orderIt != itemSlotRemap.end())
reorder = orderIt->second;
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index c6921b2e8..ceab9a149 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -461,7 +461,7 @@ void CompoundSprite::updateImages() const
bool CompoundSprite::updateFromCache() const
{
ImagesCache::iterator it = imagesCache.begin();
- ImagesCache::iterator it_end = imagesCache.end();
+ ImagesCache::const_iterator it_end = imagesCache.end();
// static int hits = 0;
// static int miss = 0;
@@ -491,8 +491,8 @@ bool CompoundSprite::updateFromCache() const
bool fail(false);
SpriteConstIterator it1 = begin();
SpriteConstIterator it1_end = end();
- VectorPointers::iterator it2 = ic->data.begin();
- VectorPointers::iterator it2_end = ic->data.end();
+ VectorPointers::const_iterator it2 = ic->data.begin();
+ VectorPointers::const_iterator it2_end = ic->data.end();
for (; it1 != it1_end && it2 != it2_end; ++ it1, ++ it2)
{
diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp
index 36e7aac16..55bf692cd 100644
--- a/src/effectmanager.cpp
+++ b/src/effectmanager.cpp
@@ -67,7 +67,7 @@ bool EffectManager::trigger(int id, Being* being)
return false;
bool rValue = false;
- for (std::vector<EffectDescription>::iterator i = mEffects.begin();
+ for (std::vector<EffectDescription>::const_iterator i = mEffects.begin();
i != mEffects.end(); ++i)
{
if ((*i).id == id)
@@ -92,7 +92,7 @@ bool EffectManager::trigger(int id, int x, int y)
return false;
bool rValue = false;
- for (std::vector<EffectDescription>::iterator i = mEffects.begin();
+ for (std::vector<EffectDescription>::const_iterator i = mEffects.begin();
i != mEffects.end(); ++i)
{
if ((*i).id == id)
diff --git a/src/event.cpp b/src/event.cpp
index 8660f6b94..8ac9be189 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -107,17 +107,18 @@ double Event::getFloat(const std::string &key) const throw (BadEvent)
void Event::trigger(Channels channel, const Event &event)
{
- ListenMap::iterator it = mBindings.find(channel);
+ ListenMap::const_iterator it = mBindings.find(channel);
// Make sure something is listening
if (it == mBindings.end())
return;
// Loop though all listeners
- ListenerSet::iterator lit = it->second.begin();
+ ListenerSet::const_iterator lit = it->second.begin();
while (lit != it->second.end())
{
- (*lit)->event(channel, event);
+ if (*lit)
+ (*lit)->event(channel, event);
++lit;
}
}
diff --git a/src/graphics.cpp b/src/graphics.cpp
index abd7341e2..0da8c1bd4 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -453,7 +453,7 @@ void Graphics::drawImagePattern2(GraphicsVertexes *vert, Image *img)
// here not checking input parameters
std::vector<DoubleRect*> *arr = vert->getRectsSDL();
- std::vector<DoubleRect*>::iterator it;
+ std::vector<DoubleRect*>::const_iterator it;
for (it = arr->begin(); it != arr->end(); ++it)
SDL_LowerBlit(img->mSDLSurface, &(*it)->src, mTarget, &(*it)->dst);
@@ -603,8 +603,8 @@ void Graphics::drawTile(ImageVertexes *vert)
{
Image *img = vert->image;
DoubleRects *rects = &vert->sdl;
- DoubleRects::iterator it = rects->begin();
- DoubleRects::iterator it_end = rects->end();
+ DoubleRects::const_iterator it = rects->begin();
+ DoubleRects::const_iterator it_end = rects->end();
while (it != it_end)
{
SDL_LowerBlit(img->mSDLSurface, &(*it)->src, mTarget, &(*it)->dst);
diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp
index 8c1ad62ce..4a03370a8 100644
--- a/src/gui/buydialog.cpp
+++ b/src/gui/buydialog.cpp
@@ -317,8 +317,8 @@ void BuyDialog::setVisible(bool visible)
void BuyDialog::closeAll()
{
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
{
diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp
index 14dcb0bc1..dfe7a422a 100644
--- a/src/gui/buyselldialog.cpp
+++ b/src/gui/buyselldialog.cpp
@@ -129,8 +129,8 @@ void BuySellDialog::action(const gcn::ActionEvent &event)
void BuySellDialog::closeAll()
{
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
{
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 1942ebaeb..75468d1ab 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -309,10 +309,12 @@ void CharSelectDialog::attemptCharacterSelect(int index)
void CharSelectDialog::setCharacters(const Net::Characters &characters)
{
// Reset previous characters
- std::vector<CharacterDisplay*>::iterator iter, iter_end;
+ std::vector<CharacterDisplay*>::const_iterator iter, iter_end;
for (iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end();
iter != iter_end; ++iter)
+ {
(*iter)->setCharacter(0);
+ }
Net::Characters::const_iterator i, i_end = characters.end();
for (i = characters.begin(); i != i_end; ++i)
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 784fb812a..0f42fb1b6 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -754,7 +754,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mChatHistoryIndex --;
}
- std::list<std::string>::iterator it;
+ std::list<std::string>::const_iterator it;
unsigned int f = 0;
for (it = tab->getRows().begin();
it != tab->getRows().end(); ++it, f++)
@@ -788,7 +788,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mChatHistoryIndex = 0;
}
- std::list<std::string>::iterator it;
+ std::list<std::string>::const_iterator it;
unsigned int f = 0;
for (it = tab->getRows().begin();
it != tab->getRows().end(); ++it, f++)
@@ -1179,7 +1179,7 @@ void ChatWindow::autoComplete()
std::string ChatWindow::autoComplete(std::vector<std::string> &names,
std::string partName) const
{
- std::vector<std::string>::iterator i = names.begin();
+ std::vector<std::string>::const_iterator i = names.begin();
toLower(partName);
std::string newName("");
@@ -1215,7 +1215,7 @@ std::string ChatWindow::autoComplete(std::string partName, History *words)
if (!words)
return "";
- Commands::iterator i = words->begin();
+ Commands::const_iterator i = words->begin();
std::vector<std::string> nameList;
while (i != words->end())
@@ -1243,7 +1243,7 @@ void ChatWindow::moveTabRight(ChatTab *tab)
std::string ChatWindow::autoCompleteHistory(std::string partName)
{
- History::iterator i = mHistory.begin();
+ History::const_iterator i = mHistory.begin();
std::vector<std::string> nameList;
while (i != mHistory.end())
@@ -1344,7 +1344,7 @@ void ChatWindow::initTradeFilter()
void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
{
- TabMap::iterator iter;
+ TabMap::const_iterator iter;
const Party *party = 0;
const Guild *guild = 0;
if (player_node)
@@ -1429,7 +1429,7 @@ void ChatWindow::loadState()
void ChatWindow::saveState()
{
int num = 0;
- TabMap::iterator iter;
+ TabMap::const_iterator iter;
for (iter = mWhispers.begin(); iter != mWhispers.end() && num < 50; ++iter)
{
if (!iter->second)
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 7d38b1025..658d65769 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -394,7 +394,7 @@ void Gui::distributeMouseEvent(gcn::Widget* source, int type, int button,
= widget->_getMouseListeners();
// Send the event to all mouse listeners of the widget.
- for (std::list<gcn::MouseListener*>::iterator
+ for (std::list<gcn::MouseListener*>::const_iterator
it = mouseListeners.begin();
it != mouseListeners.end(); ++ it)
{
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 08e3d0053..da39eb24c 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -134,7 +134,7 @@ MiniStatusWindow::~MiniStatusWindow()
if (inv)
inv->removeInventoyListener(this);
- std::vector <ProgressBar*>::iterator it, it_end;
+ std::vector <ProgressBar*>::const_iterator it, it_end;
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
{
ProgressBar *bar = *it;
@@ -160,7 +160,7 @@ ProgressBar *MiniStatusWindow::createBar(float progress, int width, int height,
void MiniStatusWindow::updateBars()
{
int x = 0;
- std::vector <ProgressBar*>::iterator it, it_end;
+ std::vector <ProgressBar*>::const_iterator it, it_end;
ProgressBar* lastBar = 0;
for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it)
safeRemove(*it);
@@ -439,7 +439,7 @@ void MiniStatusWindow::loadBars()
void MiniStatusWindow::saveBars()
{
- std::vector <ProgressBar*>::iterator it, it_end;
+ std::vector <ProgressBar*>::const_iterator it, it_end;
int i = 0;
for (it = mBars.begin(), it_end = mBars.end();
it != it_end; ++it)
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 0db618d69..d941153b7 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -362,12 +362,12 @@ bool NpcDialog::isInputFocused() const
bool NpcDialog::isAnyInputFocused()
{
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
{
- if ((*it)->isInputFocused())
+ if ((*it) && (*it)->isInputFocused())
return true;
}
@@ -430,12 +430,12 @@ NpcDialog *NpcDialog::getActive()
if (instances.size() == 1)
return instances.front();
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
{
- if ((*it)->isFocused())
+ if ((*it) && (*it)->isFocused())
return (*it);
}
@@ -444,8 +444,8 @@ NpcDialog *NpcDialog::getActive()
void NpcDialog::closeAll()
{
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
{
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 0ba4e44b6..72dd76aa3 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -123,8 +123,8 @@ void NpcPostDialog::setVisible(bool visible)
void NpcPostDialog::closeAll()
{
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
(*it)->close();
diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp
index f5c074f6c..f3046264f 100644
--- a/src/gui/palette.cpp
+++ b/src/gui/palette.cpp
@@ -80,8 +80,8 @@ const gcn::Color& Palette::getColor(char c, bool &valid)
void Palette::advanceGradients()
{
- Palettes::iterator it = mInstances.begin();
- Palettes::iterator it_end = mInstances.end();
+ Palettes::const_iterator it = mInstances.begin();
+ Palettes::const_iterator it_end = mInstances.end();
for (; it != it_end; ++it)
(*it)->advanceGradient();
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 0eac0a4f9..a329488ce 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -360,7 +360,7 @@ void PopupMenu::showPopup(int x, int y, std::vector<Being*> &beings)
{
mBrowserBox->clearRows();
mBrowserBox->addRow("Players");
- std::vector<Being*>::iterator it, it_end;
+ std::vector<Being*>::const_iterator it, it_end;
for (it = beings.begin(), it_end = beings.end(); it != it_end; ++it)
{
Being *being = *it;
@@ -804,8 +804,8 @@ void PopupMenu::showChangePos(int x, int y)
if (guild)
{
PositionsMap map = guild->getPositions();
- PositionsMap::iterator itr = map.begin();
- PositionsMap::iterator itr_end = map.end();
+ PositionsMap::const_iterator itr = map.begin();
+ PositionsMap::const_iterator itr_end = map.end();
for (; itr != itr_end; ++itr)
{
mBrowserBox->addRow(strprintf("@@guild-pos-%d|%s@@",
@@ -1872,7 +1872,7 @@ void PopupMenu::showPopup(int x, int y, Button *button)
mBrowserBox->clearRows();
std::vector <gcn::Button*> names = windowMenu->getButtons();
- std::vector <gcn::Button*>::iterator it, it_end;
+ std::vector <gcn::Button*>::const_iterator it, it_end;
for (it = names.begin(), it_end = names.end(); it != it_end; ++ it)
{
Button *btn = dynamic_cast<Button*>(*it);
@@ -1907,7 +1907,7 @@ void PopupMenu::showPopup(int x, int y, ProgressBar *b)
mBrowserBox->clearRows();
std::vector <ProgressBar*> bars = miniStatusWindow->getBars();
- std::vector <ProgressBar*>::iterator it, it_end;
+ std::vector <ProgressBar*>::const_iterator it, it_end;
for (it = bars.begin(), it_end = bars.end(); it != it_end; ++it)
{
ProgressBar *bar = *it;
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index 04f43fb88..96848f645 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -178,7 +178,7 @@ void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent)
if (dir != 0)
{
- std::vector<gcn::RadioButton*>::iterator it = mOptions.begin();
+ std::vector<gcn::RadioButton*>::const_iterator it = mOptions.begin();
for (; it < mOptions.end(); ++it)
{
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index d9030e3fb..5cbb4167e 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -346,8 +346,8 @@ void SellDialog::setVisible(bool visible)
void SellDialog::closeAll()
{
- DialogList::iterator it = instances.begin();
- DialogList::iterator it_end = instances.end();
+ DialogList::const_iterator it = instances.begin();
+ DialogList::const_iterator it_end = instances.end();
for (; it != it_end; ++it)
(*it)->close();
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 76e3936c2..113dd9081 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -103,7 +103,8 @@ Setup::Setup():
mTabs.push_back(new Setup_Theme);
mTabs.push_back(new Setup_Other);
- for (std::list<SetupTab*>::iterator i = mTabs.begin(), i_end = mTabs.end();
+ for (std::list<SetupTab*>::const_iterator i = mTabs.begin(),
+ i_end = mTabs.end();
i != i_end; ++i)
{
SetupTab *tab = *i;
@@ -162,10 +163,11 @@ void Setup::action(const gcn::ActionEvent &event)
if (!statusWindow)
return;
- for (std::list<Window*>::iterator it = mWindowsToReset.begin();
+ for (std::list<Window*>::const_iterator it = mWindowsToReset.begin();
it != mWindowsToReset.end(); ++it)
{
- (*it)->resetToDefaultSize();
+ if (*it)
+ (*it)->resetToDefaultSize();
}
}
}
@@ -177,10 +179,11 @@ void Setup::setInGame(bool inGame)
void Setup::externalUpdate()
{
- for (std::list<SetupTab*>::iterator it = mTabs.begin();
+ for (std::list<SetupTab*>::const_iterator it = mTabs.begin();
it != mTabs.end(); ++it)
{
- (*it)->externalUpdated();
+ if (*it)
+ (*it)->externalUpdated();
}
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index 03b485097..0bfab1438 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -166,8 +166,8 @@ ModeListModel::ModeListModel()
void ModeListModel::addCustomMode(std::string mode)
{
- std::vector<std::string>::iterator it = mVideoModes.begin();
- std::vector<std::string>::iterator it_end = mVideoModes.end();
+ std::vector<std::string>::const_iterator it = mVideoModes.begin();
+ std::vector<std::string>::const_iterator it_end = mVideoModes.end();
while (it != it_end)
{
if (*it == mode)
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp
index 9aaf88bf3..5cf1573bb 100644
--- a/src/gui/shopwindow.cpp
+++ b/src/gui/shopwindow.cpp
@@ -395,7 +395,7 @@ void ShopWindow::saveList()
}
std::vector<ShopItem*> items = mBuyShopItems->items();
- std::vector<ShopItem*>::iterator it;
+ std::vector<ShopItem*>::const_iterator it;
for (it = items.begin(); it != items.end(); ++it)
{
ShopItem *item = *(it);
@@ -428,7 +428,7 @@ void ShopWindow::saveList()
}
}
- std::map<int, ShopItem*>::iterator mapIt;
+ std::map<int, ShopItem*>::const_iterator mapIt;
for (mapIt = mapItems.begin(); mapIt != mapItems.end(); ++mapIt)
{
ShopItem *buyItem = (*mapIt).second;
@@ -468,7 +468,7 @@ void ShopWindow::announce(ShopItems *list, int mode)
mSellAnnounceButton->setEnabled(false);
std::vector<ShopItem*> items = list->items();
- std::vector<ShopItem*>::iterator it;
+ std::vector<ShopItem*>::const_iterator it;
for (it = items.begin(); it != items.end(); ++it)
{
@@ -534,7 +534,7 @@ void ShopWindow::giveList(const std::string &nick, int mode)
return;
std::vector<ShopItem*> items = list->items();
- std::vector<ShopItem*>::iterator it;
+ std::vector<ShopItem*>::const_iterator it;
for (it = items.begin(); it != items.end(); ++it)
{
@@ -780,7 +780,7 @@ bool ShopWindow::findShopItem(ShopItem *shopItem, int mode)
return false;
std::vector<ShopItem*> items;
- std::vector<ShopItem*>::iterator it;
+ std::vector<ShopItem*>::const_iterator it;
if (mode == SELL)
{
if (!mSellShopItems)
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index bf87e804d..c2685b476 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -321,7 +321,7 @@ void SkillDialog::action(const gcn::ActionEvent &event)
std::string SkillDialog::update(int id)
{
- SkillMap::iterator i = mSkills.find(id);
+ SkillMap::const_iterator i = mSkills.find(id);
if (i != mSkills.end())
{
@@ -342,7 +342,9 @@ void SkillDialog::update()
PlayerInfo::getAttribute(SKILL_POINTS)));
mPointsLabel->adjustSize();
- for (SkillMap::iterator it = mSkills.begin(); it != mSkills.end(); ++it)
+ for (SkillMap::const_iterator it = mSkills.begin();
+ it != mSkills.end();
+ ++ it)
{
if ((*it).second && (*it).second->modifiable)
(*it).second->update();
@@ -467,7 +469,7 @@ void SkillDialog::loadSkills(const std::string &file)
bool SkillDialog::setModifiable(int id, bool modifiable)
{
- SkillMap::iterator it = mSkills.find(id);
+ SkillMap::const_iterator it = mSkills.find(id);
if (it != mSkills.end())
{
@@ -508,7 +510,9 @@ void SkillModel::updateVisibilities()
{
mVisibleSkills.clear();
- for (SkillList::iterator it = mSkills.begin(); it != mSkills.end(); ++it)
+ for (SkillList::const_iterator it = mSkills.begin();
+ it != mSkills.end();
+ ++ it)
{
if ((*it)->visible)
mVisibleSkills.push_back((*it));
diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp
index 749f26f85..7feca8bf4 100644
--- a/src/gui/socialwindow.cpp
+++ b/src/gui/socialwindow.cpp
@@ -232,7 +232,7 @@ public:
mScroll = 0;
}
- void action(const gcn::ActionEvent &event)
+ void action(const gcn::ActionEvent &event A_UNUSED)
{
/*
if (event.getId() == "do invite")
@@ -528,7 +528,7 @@ public:
return 0;
Avatar *ava = 0;
- std::vector<Avatar*>::iterator i = avatars->begin();
+ std::vector<Avatar*>::const_iterator i = avatars->begin();
while (i != avatars->end())
{
ava = (*i);
@@ -562,7 +562,7 @@ public:
if (!ava)
break;
- std::vector<std::string>::iterator i = names.begin();
+ std::vector<std::string>::const_iterator i = names.begin();
while (i != names.end())
{
if (ava->getName() == (*i) && (*i) != "")
@@ -584,7 +584,7 @@ public:
}
}
- std::vector<std::string>::iterator i = names.begin();
+ std::vector<std::string>::const_iterator i = names.begin();
while (i != names.end())
{
@@ -659,7 +659,7 @@ public:
std::vector<Avatar*> *avatars = mBeings->getMembers();
std::vector<MapItem*> portals = map->getPortals();
- std::vector<MapItem*>::iterator i = portals.begin();
+ std::vector<MapItem*>::const_iterator i = portals.begin();
SpecialLayer *specialLayer = map->getSpecialLayer();
std::vector<Avatar*>::iterator ia = avatars->begin();
@@ -752,7 +752,7 @@ public:
return;
Avatar *ava = 0;
- std::vector<Avatar*>::iterator i = avatars->begin();
+ std::vector<Avatar*>::const_iterator i = avatars->begin();
while (i != avatars->end())
{
ava = (*i);
@@ -786,7 +786,7 @@ public:
return 01;
Avatar *ava = 0;
- std::vector<Avatar*>::iterator i = avatars->begin();
+ std::vector<Avatar*>::const_iterator i = avatars->begin();
unsigned num = 0;
while (i != avatars->end())
{
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index 702c31718..64f61e3c3 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -134,10 +134,11 @@ void SpecialsWindow::draw(gcn::Graphics *graphics)
unsigned int found = 0; // number of entries in specialData
// which match mEntries
- for (std::map<int, Special>::iterator i = specialData.begin();
+ for (std::map<int, Special>::const_iterator i = specialData.begin();
i != specialData.end(); ++i)
{
- std::map<int, SpecialEntry *>::iterator e = mEntries.find(i->first);
+ std::map<int, SpecialEntry *>::const_iterator
+ e = mEntries.find(i->first);
if (e == mEntries.end())
{
// found a new special - abort update and rebuild from scratch
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index d1fde2dd1..a85f60133 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -311,7 +311,7 @@ void StatusWindow::event(Mana::Channels channel A_UNUSED,
mCharacterPointsLabel->adjustSize();
// Update all attributes
- for (Attrs::iterator it = mAttrs.begin();
+ for (Attrs::const_iterator it = mAttrs.begin();
it != mAttrs.end(); ++it)
{
if (it->second)
@@ -324,7 +324,7 @@ void StatusWindow::event(Mana::Channels channel A_UNUSED,
_("Correction points: %d"), event.getInt("newValue")));
mCorrectionPointsLabel->adjustSize();
// Update all attributes
- for (Attrs::iterator it = mAttrs.begin();
+ for (Attrs::const_iterator it = mAttrs.begin();
it != mAttrs.end(); ++it)
{
if (it->second)
@@ -392,7 +392,7 @@ void StatusWindow::event(Mana::Channels channel A_UNUSED,
else
{
updateMPBar(mMpBar, true);
- Attrs::iterator it = mAttrs.find(id);
+ Attrs::const_iterator it = mAttrs.find(id);
if (it != mAttrs.end() && it->second)
{
if (it->second)
@@ -404,7 +404,7 @@ void StatusWindow::event(Mana::Channels channel A_UNUSED,
void StatusWindow::setPointsNeeded(int id, int needed)
{
- Attrs::iterator it = mAttrs.find(id);
+ Attrs::const_iterator it = mAttrs.find(id);
if (it != mAttrs.end())
{
@@ -909,8 +909,8 @@ void StatusWindow::action(const gcn::ActionEvent &event)
if (event.getId() == "copy")
{
- Attrs::iterator it = mAttrs.begin();
- Attrs::iterator it_end = mAttrs.end();
+ Attrs::const_iterator it = mAttrs.begin();
+ Attrs::const_iterator it_end = mAttrs.end();
std::string str;
while (it != it_end)
{
diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp
index eac9559ef..62fd03c70 100644
--- a/src/gui/userpalette.cpp
+++ b/src/gui/userpalette.cpp
@@ -172,7 +172,7 @@ UserPalette::UserPalette():
UserPalette::~UserPalette()
{
- for (Colors::iterator col = mColors.begin(),
+ for (Colors::const_iterator col = mColors.begin(),
colEnd = mColors.end(); col != colEnd; ++col)
{
const std::string &configName = ColorTypeNames[col->type];
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 81c0d277f..4f358c8e7 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -439,7 +439,7 @@ void ChatTab::loadFromLogFile(std::string name)
{
std::list<std::string> list;
chatLogger->loadLast(name, list, 5);
- std::list<std::string>::iterator i = list.begin();
+ std::list<std::string>::const_iterator i = list.begin();
while (i != list.end())
{
std::string line = "##9" + *i;
diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp
index 33e3790a0..0a64a7142 100644
--- a/src/gui/widgets/flowcontainer.cpp
+++ b/src/gui/widgets/flowcontainer.cpp
@@ -67,7 +67,7 @@ void FlowContainer::widgetResized(const gcn::Event &event A_UNUSED)
int i = 0;
height = 0;
- for (WidgetList::iterator it = mWidgets.begin();
+ for (WidgetList::const_iterator it = mWidgets.begin();
it != mWidgets.end(); ++it)
{
int x = i % mGridWidth * mBoxWidth;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 91b674018..3d6d24868 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -479,7 +479,7 @@ void ItemContainer::updateMatrix()
break;
}
- std::vector<ItemIdPair*>::iterator iter;
+ std::vector<ItemIdPair*>::const_iterator iter;
for (iter = sortedItems.begin(); iter != sortedItems.end(); ++iter)
{
if (j >= mGridRows)
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index a14b416ce..52b92d0bc 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -86,12 +86,12 @@ void LayoutCell::computeSizes()
if (mType != ARRAY)
return;
- std::vector< std::vector< LayoutCell * > >::iterator
+ std::vector <std::vector <LayoutCell *> >::const_iterator
i = mArray->mCells.begin();
while (i != mArray->mCells.end())
{
- std::vector< LayoutCell * >::iterator j = i->begin();
+ std::vector <LayoutCell *>::const_iterator j = i->begin();
while (j != i->end())
{
LayoutCell *cell = *j;
@@ -113,7 +113,8 @@ LayoutArray::LayoutArray(): mSpacing(4)
LayoutArray::~LayoutArray()
{
- std::vector< std::vector< LayoutCell * > >::iterator i = mCells.begin();
+ std::vector <std::vector <LayoutCell *> >::iterator
+ i = mCells.begin();
while (i != mCells.end())
{
std::vector< LayoutCell * >::iterator j = i->begin();
@@ -154,7 +155,8 @@ void LayoutArray::resizeGrid(int w, int h)
if (extW)
mSizes[0].resize(w, Layout::AUTO_DEF);
- std::vector< std::vector< LayoutCell * > >::iterator i = mCells.begin();
+ std::vector <std::vector <LayoutCell *> >::iterator
+ i = mCells.begin();
while (i != mCells.end())
{
i->resize(w, 0);
diff --git a/src/gui/widgets/setuptabscroll.cpp b/src/gui/widgets/setuptabscroll.cpp
index 30bb66469..e9917b090 100644
--- a/src/gui/widgets/setuptabscroll.cpp
+++ b/src/gui/widgets/setuptabscroll.cpp
@@ -90,25 +90,31 @@ void SetupTabScroll::addControl(SetupItem *widget, std::string event)
void SetupTabScroll::apply()
{
- std::map<std::string, SetupItem*>::iterator iter;
+ std::map<std::string, SetupItem*>::const_iterator iter;
for (iter = mItems.begin(); iter != mItems.end(); ++ iter)
- (*iter).second->apply((*iter).first);
+ {
+ if ((*iter).second)
+ (*iter).second->apply((*iter).first);
+ }
}
void SetupTabScroll::cancel()
{
- std::map<std::string, SetupItem*>::iterator iter;
+ std::map<std::string, SetupItem*>::const_iterator iter;
for (iter = mItems.begin(); iter != mItems.end(); ++ iter)
- (*iter).second->cancel((*iter).first);
+ {
+ if ((*iter).second)
+ (*iter).second->cancel((*iter).first);
+ }
}
void SetupTabScroll::externalUpdated()
{
- std::map<std::string, SetupItem*>::iterator iter;
+ std::map<std::string, SetupItem*>::const_iterator iter;
for (iter = mItems.begin(); iter != mItems.end(); ++ iter)
{
SetupItem *widget = (*iter).second;
- if (!widget->isMainConfig())
+ if (widget && !widget->isMainConfig())
(*iter).second->externalUpdated((*iter).first);
}
}
diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp
index ea6b4d520..5e79b7c19 100644
--- a/src/gui/widgets/vertcontainer.cpp
+++ b/src/gui/widgets/vertcontainer.cpp
@@ -73,8 +73,9 @@ void VertContainer::clear()
void VertContainer::widgetResized(const gcn::Event &event A_UNUSED)
{
- for (std::vector<gcn::Widget*>::iterator it = mResizableWidgets.begin();
- it != mResizableWidgets.end(); ++ it)
+ for (std::vector<gcn::Widget*>::const_iterator
+ it = mResizableWidgets.begin();
+ it != mResizableWidgets.end(); ++ it)
{
(*it)->setWidth(getWidth());
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 4435496a7..9709f4c8a 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -373,7 +373,7 @@ void Window::widgetHidden(const gcn::Event &event A_UNUSED)
if (!mFocusHandler)
return;
- for (it = mWidgets.begin(); it != mWidgets.end(); it++)
+ for (it = mWidgets.begin(); it != mWidgets.end(); ++ it)
{
if (mFocusHandler->isFocused(*it))
mFocusHandler->focusNone();
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 0d81ba3a9..8431cece1 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -329,7 +329,7 @@ void WindowMenu::showButton(std::string name, bool isVisible)
void WindowMenu::updateButtons()
{
int x = 0, h = 0;
- std::vector <gcn::Button*>::iterator it, it_end;
+ std::vector <gcn::Button*>::const_iterator it, it_end;
for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it)
safeRemove(*it);
for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it)
diff --git a/src/guichan/focushandler.cpp b/src/guichan/focushandler.cpp
index bb0378f59..367eed6b1 100644
--- a/src/guichan/focushandler.cpp
+++ b/src/guichan/focushandler.cpp
@@ -479,7 +479,8 @@ namespace gcn
= sourceWidget->_getFocusListeners();
// Send the event to all focus listeners of the widget.
- for (std::list<FocusListener*>::iterator it = focusListeners.begin();
+ for (std::list<FocusListener*>::const_iterator
+ it = focusListeners.begin();
it != focusListeners.end();
++ it)
{
@@ -495,7 +496,8 @@ namespace gcn
= sourceWidget->_getFocusListeners();
// Send the event to all focus listeners of the widget.
- for (std::list<FocusListener*>::iterator it = focusListeners.begin();
+ for (std::list<FocusListener*>::const_iterator
+ it = focusListeners.begin();
it != focusListeners.end();
++ it)
{
diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp
index bec4c875f..0c81182ea 100644
--- a/src/guichan/gui.cpp
+++ b/src/guichan/gui.cpp
@@ -421,7 +421,7 @@ namespace gcn
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
- std::deque<Widget*>::iterator iter;
+ std::deque<Widget*>::const_iterator iter;
for (iter = mWidgetWithMouseQueue.begin();
iter != mWidgetWithMouseQueue.end();
++ iter)
@@ -697,7 +697,7 @@ namespace gcn
= widget->_getMouseListeners();
// Send the event to all mouse listeners of the widget.
- for (std::list<MouseListener*>::iterator
+ for (std::list<MouseListener*>::const_iterator
it = mouseListeners.begin();
it != mouseListeners.end();
++it)
@@ -796,7 +796,7 @@ namespace gcn
= widget->_getKeyListeners();
// Send the event to all key listeners of the source widget.
- for (std::list<KeyListener*>::iterator
+ for (std::list<KeyListener*>::const_iterator
it = keyListeners.begin();
it != keyListeners.end();
++it)
@@ -936,7 +936,7 @@ namespace gcn
// Check if the widget is present in the "widget with mouse" queue.
bool widgetIsPresentInQueue = false;
- std::deque<Widget*>::iterator iter;
+ std::deque<Widget*>::const_iterator iter;
for (iter = mWidgetWithMouseQueue.begin();
iter != mWidgetWithMouseQueue.end();
++ iter)
diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp
index e2ed26508..1b2b3295b 100644
--- a/src/guichan/widget.cpp
+++ b/src/guichan/widget.cpp
@@ -470,7 +470,7 @@ namespace gcn
{
mGlobalFont = font;
- std::list<Widget*>::iterator iter;
+ std::list<Widget*>::const_iterator iter;
for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
{
if ((*iter)->mCurrentFont == NULL)
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index 7b04981c2..d0ba32f47 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -282,7 +282,7 @@ namespace gcn
WidgetListConstIterator it;
int w = 0, h = 0;
- for (it = mWidgets.begin(); it != mWidgets.end(); it++)
+ for (it = mWidgets.begin(); it != mWidgets.end(); ++ it)
{
if ((*it)->getX() + (*it)->getWidth() > w)
w = (*it)->getX() + (*it)->getWidth();
diff --git a/src/guild.cpp b/src/guild.cpp
index 98e5bb519..234c7d32f 100644
--- a/src/guild.cpp
+++ b/src/guild.cpp
@@ -230,8 +230,8 @@ void Guild::removeFromMembers()
if (!actorSpriteManager)
return;
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
+ MemberList::const_iterator itr = mMembers.begin();
+ MemberList::const_iterator itr_end = mMembers.end();
while (itr != itr_end)
{
Being *b = actorSpriteManager->findBeing((*itr)->getID());
@@ -321,7 +321,7 @@ void Guild::addPos(int id, std::string name)
Guild *Guild::getGuild(short id)
{
- GuildMap::iterator it = guilds.find(id);
+ GuildMap::const_iterator it = guilds.find(id);
if (it != guilds.end())
return it->second;
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 1a8d5b433..13a837dfb 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -135,8 +135,8 @@ void GuildManager::updateList()
if (guild)
{
guild->setServerGuild(false);
- std::vector<std::string>::iterator it = mTempList.begin();
- std::vector<std::string>::iterator it_end = mTempList.end();
+ std::vector<std::string>::const_iterator it = mTempList.begin();
+ std::vector<std::string>::const_iterator it_end = mTempList.end();
int i = 0;
while (it != it_end)
{
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index c91532227..a68cd5ee8 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -902,11 +902,11 @@ void LocalPlayer::inviteToGuild(Being *being)
// TODO: Allow user to choose which guild to invite being to
// For now, just invite to the first guild you have permissions to invite with
- std::map<int, Guild*>::iterator itr = mGuilds.begin();
- std::map<int, Guild*>::iterator itr_end = mGuilds.end();
+ std::map<int, Guild*>::const_iterator itr = mGuilds.begin();
+ std::map<int, Guild*>::const_iterator itr_end = mGuilds.end();
for (; itr != itr_end; ++itr)
{
- if (checkInviteRights(itr->second->getName()))
+ if (itr->second && checkInviteRights(itr->second->getName()))
{
Net::getGuildHandler()->invite(itr->second->getId(), being);
return;
@@ -1813,7 +1813,7 @@ void LocalPlayer::moveToHome()
}
else
{
- std::map<std::string, Vector>::iterator iter =
+ std::map<std::string, Vector>::const_iterator iter =
mHomes.find(mMap->getProperty("_realfilename"));
if (iter != mHomes.end())
@@ -2996,7 +2996,7 @@ void LocalPlayer::setHome()
if (mAction == SIT)
{
- std::map<std::string, Vector>::iterator iter = mHomes.find(key);
+ std::map<std::string, Vector>::const_iterator iter = mHomes.find(key);
if (iter != mHomes.end())
{
@@ -3102,7 +3102,7 @@ void LocalPlayer::saveHomes()
std::string homeStr;
std::stringstream ss(homeStr);
- for (std::map<std::string, Vector>::iterator iter = mHomes.begin();
+ for (std::map<std::string, Vector>::const_iterator iter = mHomes.begin();
iter != mHomes.end(); ++iter )
{
Vector pos = (*iter).second;
@@ -3802,7 +3802,7 @@ void LocalPlayer::updateNavigateList()
{
if (mMap)
{
- std::map<std::string, Vector>::iterator iter =
+ std::map<std::string, Vector>::const_iterator iter =
mHomes.find(mMap->getProperty("_realfilename"));
if (iter != mHomes.end())
diff --git a/src/map.cpp b/src/map.cpp
index 947bb8f09..e5b3632b6 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -104,10 +104,11 @@ void TileAnimation::update(int ticks)
Image *img = mAnimation->getCurrentImage();
if (img != mLastImage)
{
- for (std::vector<std::pair<MapLayer*, int> >::iterator i =
+ for (std::vector<std::pair<MapLayer*, int> >::const_iterator i =
mAffected.begin(); i != mAffected.end(); ++i)
{
- i->first->setTile(i->second, img);
+ if (i->first)
+ i->first->setTile(i->second, img);
}
mLastImage = img;
}
@@ -284,13 +285,13 @@ void MapLayer::updateSDL(Graphics *graphics, int startX, int startY,
void MapLayer::drawSDL(Graphics *graphics)
{
- MapRows::iterator rit = mTempRows.begin();
- MapRows::iterator rit_end = mTempRows.end();
+ MapRows::const_iterator rit = mTempRows.begin();
+ MapRows::const_iterator rit_end = mTempRows.end();
while (rit != rit_end)
{
MepRowImages *images = &(*rit)->images;
- MepRowImages::iterator iit = images->begin();
- MepRowImages::iterator iit_end = images->end();
+ MepRowImages::const_iterator iit = images->begin();
+ MepRowImages::const_iterator iit_end = images->end();
while (iit != iit_end)
{
graphics->drawTile(*iit);
@@ -375,13 +376,13 @@ void MapLayer::updateOGL(Graphics *graphics, int startX, int startY,
void MapLayer::drawOGL(Graphics *graphics)
{
- MapRows::iterator rit = mTempRows.begin();
- MapRows::iterator rit_end = mTempRows.end();
+ MapRows::const_iterator rit = mTempRows.begin();
+ MapRows::const_iterator rit_end = mTempRows.end();
while (rit != rit_end)
{
MepRowImages *images = &(*rit)->images;
- MepRowImages::iterator iit = images->begin();
- MepRowImages::iterator iit_end = images->end();
+ MepRowImages::const_iterator iit = images->begin();
+ MepRowImages::const_iterator iit_end = images->end();
while (iit != iit_end)
{
graphics->drawTile(*iit);
@@ -789,11 +790,12 @@ bool actorCompare(const Actor *a, const Actor *b)
void Map::update(int ticks)
{
// Update animated tiles
- for (std::map<int, TileAnimation*>::iterator
+ for (std::map<int, TileAnimation*>::const_iterator
iAni = mTileAnimations.begin();
iAni != mTileAnimations.end(); ++iAni)
{
- iAni->second->update(ticks);
+ if (iAni->second)
+ iAni->second->update(ticks);
}
}
@@ -1079,7 +1081,7 @@ void Map::updateAmbientLayers(float scrollX, float scrollY)
float dy = scrollY - mLastAScrollY;
int timePassed = get_elapsed_time(lastTick);
- std::vector<AmbientLayer*>::iterator i;
+ std::vector<AmbientLayer*>::const_iterator i;
for (i = mBackgrounds.begin(); i != mBackgrounds.end(); ++i)
(*i)->update(timePassed, dx, dy);
@@ -1116,10 +1118,11 @@ void Map::drawAmbientLayers(Graphics *graphics, LayerType type,
}
// Draw overlays
- for (std::vector<AmbientLayer*>::iterator i = layers->begin();
+ for (std::vector<AmbientLayer*>::const_iterator i = layers->begin();
i != layers->end(); ++i)
{
- (*i)->draw(graphics, graphics->mWidth, graphics->mHeight);
+ if (*i)
+ (*i)->draw(graphics, graphics->mWidth, graphics->mHeight);
// Detail 1: only one overlay, higher: all overlays
if (detail == 1)
@@ -1598,7 +1601,7 @@ void Map::initializeParticleEffects(Particle *particleEngine)
if (config.getBoolValue("particleeffects"))
{
- for (std::vector<ParticleEffectData>::iterator
+ for (std::vector<ParticleEffectData>::const_iterator
i = particleEffects.begin();
i != particleEffects.end(); ++i)
{
@@ -1785,8 +1788,8 @@ void Map::updatePortalTile(const std::string &name, int type,
MapItem *Map::findPortalXY(int x, int y)
{
- std::vector<MapItem*>::iterator it;
- std::vector<MapItem*>::iterator it_end;
+ std::vector<MapItem*>::const_iterator it;
+ std::vector<MapItem*>::const_iterator it_end;
for (it = mMapPortals.begin(), it_end = mMapPortals.end();
it != it_end; ++it)
@@ -1849,7 +1852,7 @@ std::string Map::getObjectData(unsigned x, unsigned y, int type)
if (!list)
return "";
- std::vector<MapObject>::iterator it = list->objects.begin();
+ std::vector<MapObject>::const_iterator it = list->objects.begin();
while (it != list->objects.end())
{
if ((*it).type == type)
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 01000f8f1..1de681007 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -434,8 +434,8 @@ void InventoryHandler::processPlayerStorageStatus(Net::MessageIn &msg)
if (!mStorage)
mStorage = new Inventory(Inventory::STORAGE, size);
- Ea::InventoryItems::iterator it = mInventoryItems.begin();
- Ea::InventoryItems::iterator it_end = mInventoryItems.end();
+ Ea::InventoryItems::const_iterator it = mInventoryItems.begin();
+ Ea::InventoryItems::const_iterator it_end = mInventoryItems.end();
for (; it != it_end; ++it)
{
mStorage->setItem((*it).slot, (*it).id, (*it).quantity,
diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp
index 53e83e4ec..b83bc5748 100644
--- a/src/net/manaserv/network.cpp
+++ b/src/net/manaserv/network.cpp
@@ -45,7 +45,7 @@ namespace ManaServ
{
typedef std::map<unsigned short, MessageHandler*> MessageHandlers;
-typedef MessageHandlers::iterator MessageHandlerIterator;
+typedef MessageHandlers::const_iterator MessageHandlerIterator;
static MessageHandlers mMessageHandlers;
void initialize()
@@ -96,17 +96,13 @@ Connection *getConnection()
void registerHandler(MessageHandler *handler)
{
for (const Uint16 *i = handler->handledMessages; *i; i++)
- {
mMessageHandlers[*i] = handler;
- }
}
void unregisterHandler(MessageHandler *handler)
{
for (const Uint16 *i = handler->handledMessages; *i; i++)
- {
mMessageHandlers.erase(*i);
- }
}
void clearNetworkHandlers()
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index efd2ab2bc..8c14f3dfc 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -60,12 +60,10 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
{
Being *being = actorSpriteManager->findBeing(msg.readInt16());
if (!being || being->getType() != ActorSprite::NPC)
- {
return;
- }
int npcId = being->getId();
- NpcDialogs::iterator diag = mNpcDialogs.find(npcId);
+ NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId);
NpcDialog *dialog;
if (diag == mNpcDialogs.end())
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 43271671e..f80dd6e69 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -194,7 +194,7 @@ int NpcHandler::getNpc(Net::MessageIn &msg, bool haveLength)
const int npcId = msg.readInt32();
- NpcDialogs::iterator diag = mNpcDialogs.find(npcId);
+ NpcDialogs::const_iterator diag = mNpcDialogs.find(npcId);
mDialog = 0;
if (diag == mNpcDialogs.end())
diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp
index f918a5c0d..046c5fd30 100644
--- a/src/openglgraphics.cpp
+++ b/src/openglgraphics.cpp
@@ -631,15 +631,15 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, Image *image)
setTexturingAndBlending(true);
std::vector<GLint*> *intVertPool = ogl->getIntVertPool();
- std::vector<GLint*>::iterator iv;
+ std::vector<GLint*>::const_iterator iv;
std::vector<int> *vp = ogl->getVp();
- std::vector<int>::iterator ivp;
+ std::vector<int>::const_iterator ivp;
// Draw a set of textured rectangles
if (image->mTextureType == GL_TEXTURE_2D)
{
std::vector<GLfloat*> *floatTexPool = ogl->getFloatTexPool();
- std::vector<GLfloat*>::iterator ft;
+ std::vector<GLfloat*>::const_iterator ft;
for (iv = intVertPool->begin(), ft = floatTexPool->begin(),
ivp = vp->begin();
@@ -653,7 +653,7 @@ void OpenGLGraphics::drawImagePattern2(GraphicsVertexes *vert, Image *image)
else
{
std::vector<GLint*> *intTexPool = ogl->getIntTexPool();
- std::vector<GLint*>::iterator it;
+ std::vector<GLint*>::const_iterator it;
for (iv = intVertPool->begin(), it = intTexPool->begin(),
ivp = vp->begin();
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index 70b1e2c84..686390474 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -93,7 +93,7 @@ void ParticleList::removeLocally(Particle *particle)
void ParticleList::clearLocally()
{
- for (std::list<Particle *>::iterator it = mElements.begin();
+ for (std::list<Particle *>::const_iterator it = mElements.begin();
it != mElements.end(); ++it)
{
(*it)->kill();
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index caa48a795..fd1f07e16 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -435,7 +435,7 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o)
mDeathEffect = o.mDeathEffect;
mTempSets = o.mTempSets;
- for (std::vector<ImageSet*>::iterator
+ for (std::vector<ImageSet*>::const_iterator
i = mTempSets.begin();
i != mTempSets.end(); ++i)
{
@@ -453,7 +453,7 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o)
ParticleEmitter::~ParticleEmitter()
{
- for (std::vector<ImageSet*>::iterator
+ for (std::vector<ImageSet*>::const_iterator
i = mTempSets.begin();
i != mTempSets.end(); ++i)
{
@@ -576,7 +576,7 @@ std::list<Particle *> ParticleEmitter::createParticles(int tick)
newParticle->setFadeIn(mParticleFadeIn.value(tick));
newParticle->setAlpha(mParticleAlpha.value(tick));
- for (std::list<ParticleEmitter>::iterator
+ for (std::list<ParticleEmitter>::const_iterator
i = mParticleChildEmitters.begin();
i != mParticleChildEmitters.end(); ++i)
{
diff --git a/src/party.cpp b/src/party.cpp
index f3f787807..9becee1cd 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -181,8 +181,9 @@ void Party::removeFromMembers()
if (!actorSpriteManager)
return;
- MemberList::iterator itr = mMembers.begin(),
- itr_end = mMembers.end();
+ MemberList::const_iterator itr = mMembers.begin();
+ MemberList::const_iterator itr_end = mMembers.end();
+
while (itr != itr_end)
{
Being *b = actorSpriteManager->findBeing((*itr)->getID());
@@ -281,7 +282,7 @@ void Party::getNamesSet(std::set<std::string> &names) const
Party *Party::getParty(short id)
{
- PartyMap::iterator it = parties.find(id);
+ PartyMap::const_iterator it = parties.find(id);
if (it != parties.end())
return it->second;
Party *party = new Party(id);
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 769d24a16..562795563 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -68,7 +68,10 @@ void triggerAttr(int id, int old)
void triggerStat(int id, const std::string &changed, int old1, int old2)
{
- StatMap::iterator it = mData.mStats.find(id);
+ StatMap::const_iterator it = mData.mStats.find(id);
+ if (it == mData.mStats.end())
+ return;
+
Mana::Event event(Mana::EVENT_UPDATESTAT);
event.setInt("id", id);
event.setInt("base", it->second.base);
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<float, SDL_Surface*>::iterator it = mAlphaCache.find(alpha);
+ std::map<float, SDL_Surface*>::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<float, SDL_Surface*>::iterator
+ for (std::map<float, SDL_Surface*>::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<Stat>::iterator it = extraStats.begin();
+ for (std::vector<Stat>::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 <int, ColorDB::ItemColor>::iterator it = mColors->find(color);
+ std::map <int, ColorDB::ItemColor>::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 <int, ColorDB::ItemColor>::iterator it = mColors->find(color);
+ std::map <int, ColorDB::ItemColor>::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<std::string, int>::iterator iFrame, iDelay;
+ std::map<std::string, int>::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<WallpaperData>::iterator iter;
+ std::vector<WallpaperData>::const_iterator iter;
WallpaperData wp;
// Wallpaper filename container
diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp
index a79388350..fcdf94039 100644
--- a/src/spellmanager.cpp
+++ b/src/spellmanager.cpp
@@ -104,7 +104,7 @@ bool SpellManager::addSpell(TextCommand *spell)
if (!spell)
return false;
- std::map<unsigned int, TextCommand*>::iterator
+ std::map<unsigned int, TextCommand*>::const_iterator
i = mSpells.find(spell->getId());
if (i == mSpells.end())
{
@@ -342,7 +342,7 @@ void SpellManager::save()
std::string SpellManager::autoComplete(std::string partName)
{
- std::vector<TextCommand*>::iterator i = mSpellsVector.begin();
+ std::vector<TextCommand*>::const_iterator i = mSpellsVector.begin();
std::string newName = "";
TextCommand *newCommand = NULL;
diff --git a/src/textmanager.cpp b/src/textmanager.cpp
index c9da12e92..7c1be58cf 100644
--- a/src/textmanager.cpp
+++ b/src/textmanager.cpp
@@ -48,7 +48,7 @@ void TextManager::moveText(Text *text, int x, int y)
void TextManager::removeText(const Text *text)
{
for (TextList::iterator ptr = mTextList.begin(),
- pEnd = mTextList.end(); ptr != pEnd; ++ptr)
+ pEnd = mTextList.end(); ptr != pEnd; ++ptr)
{
if (*ptr == text)
{
@@ -64,8 +64,9 @@ TextManager::~TextManager()
void TextManager::draw(gcn::Graphics *graphics, int xOff, int yOff)
{
- for (TextList::iterator bPtr = mTextList.begin(), ePtr = mTextList.end();
- bPtr != ePtr; ++bPtr)
+ for (TextList::const_iterator bPtr = mTextList.begin(),
+ ePtr = mTextList.end();
+ bPtr != ePtr; ++ bPtr)
{
(*bPtr)->draw(graphics, xOff, yOff);
}
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 176c5499c..f3aed5276 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -185,10 +185,11 @@ unsigned long findI(std::string text, std::vector<std::string> &list)
{
std::string str = toLower(text);
unsigned long idx;
- for (std::vector<std::string>::iterator i = list.begin();
+ for (std::vector<std::string>::const_iterator i = list.begin();
i != list.end(); ++i)
{
- std::string subStr = toLower(*i);
+ std::string subStr = *i;
+ subStr = toLower(subStr);
idx = str.find(subStr);
if (idx != std::string::npos)
return idx;
@@ -450,8 +451,8 @@ std::string combineDye2(std::string file, std::string dye)
file = file.substr(0, pos);
std::list<std::string> list1 = splitToStringList(dye1, ';');
std::list<std::string> list2 = splitToStringList(dye, ';');
- std::list<std::string>::iterator it1, it1_end = list1.end();
- std::list<std::string>::iterator it2, it2_end = list2.end();
+ std::list<std::string>::const_iterator it1, it1_end = list1.end();
+ std::list<std::string>::const_iterator it2, it2_end = list2.end();
for (it1 = list1.begin(), it2 = list2.begin();
it1 != it1_end && it2 != it2_end; ++it1, ++it2)
{
@@ -485,7 +486,7 @@ std::vector<std::string> getLang()
std::string packList(std::list<std::string> &list)
{
- std::list<std::string>::iterator i = list.begin();
+ std::list<std::string>::const_iterator i = list.begin();
std::string str = "";
while (i != list.end())
{