summaryrefslogtreecommitdiff
path: root/src/gui
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 /src/gui
parent3f84fc198131ff706e18c56f612e38ff147b0005 (diff)
downloadmv-b3f70d8d46199524edc590269a73c262899763c7.tar.gz
mv-b3f70d8d46199524edc590269a73c262899763c7.tar.bz2
mv-b3f70d8d46199524edc590269a73c262899763c7.tar.xz
mv-b3f70d8d46199524edc590269a73c262899763c7.zip
Replace most iterator to const_iterator.
Some other minor changes.
Diffstat (limited to 'src/gui')
-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
28 files changed, 104 insertions, 85 deletions
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)