summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-23 02:46:01 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-23 02:48:43 +0300
commita69a87c5a81ddbf25a25c5549259da550d207bda (patch)
tree59f1a919b327912395ab84bab1684118bf0379be
parente646f2fae3f323b7faa26aa9540524d1765211ee (diff)
downloadmv-a69a87c5a81ddbf25a25c5549259da550d207bda.tar.gz
mv-a69a87c5a81ddbf25a25c5549259da550d207bda.tar.bz2
mv-a69a87c5a81ddbf25a25c5549259da550d207bda.tar.xz
mv-a69a87c5a81ddbf25a25c5549259da550d207bda.zip
Improve a bit iterators again.
-rw-r--r--src/actorspritemanager.cpp10
-rw-r--r--src/compoundsprite.cpp4
-rw-r--r--src/gui/chatwindow.cpp5
-rw-r--r--src/gui/outfitwindow.cpp2
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/gui/whoisonline.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp5
-rw-r--r--src/gui/windowmenu.cpp4
-rw-r--r--src/guichan/basiccontainer.cpp39
-rw-r--r--src/guichan/defaultfont.cpp4
-rw-r--r--src/guichan/focushandler.cpp8
-rw-r--r--src/guichan/font.cpp9
-rw-r--r--src/guichan/gui.cpp9
-rw-r--r--src/guichan/widget.cpp30
-rw-r--r--src/guichan/widgets/dropdown.cpp4
-rw-r--r--src/guichan/widgets/listbox.cpp4
-rw-r--r--src/guichan/widgets/radiobutton.cpp12
-rw-r--r--src/guichan/widgets/scrollarea.cpp28
-rw-r--r--src/guichan/widgets/tabbedarea.cpp3
-rw-r--r--src/guichan/widgets/textbox.cpp7
-rw-r--r--src/guichan/widgets/window.cpp5
-rw-r--r--src/map.cpp11
-rw-r--r--src/net/manaserv/attributes.cpp15
-rw-r--r--src/net/manaserv/charhandler.cpp6
-rw-r--r--src/statuseffect.cpp7
25 files changed, 99 insertions, 138 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index ecadc4b67..a85d2cd49 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -51,8 +51,8 @@
#include "debug.h"
-#define for_actors ActorSpritesConstIterator it, it_end; \
-for (it = mActors.begin(), it_end = mActors.end() ; it != it_end; ++it)
+#define for_actors for (ActorSpritesConstIterator it = mActors.begin(), \
+ it_end = mActors.end() ; it != it_end; ++it)
class FindBeingFunctor
{
@@ -749,7 +749,8 @@ void ActorSpriteManager::logic()
if (mDeleteActors.empty())
return;
- for (it = mDeleteActors.begin(), it_end = mDeleteActors.end();
+ for (ActorSpritesConstIterator it = mDeleteActors.begin(),
+ it_end = mDeleteActors.end();
it != it_end; ++it)
{
if (!*it)
@@ -773,7 +774,8 @@ void ActorSpriteManager::logic()
viewport->clearHover(*it);
}
- for (it = mDeleteActors.begin(), it_end = mDeleteActors.end();
+ for (ActorSpritesConstIterator it = mDeleteActors.begin(),
+ it_end = mDeleteActors.end();
it != it_end; ++it)
{
mActors.erase(*it);
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index c6243c00c..fa5b4b202 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -548,8 +548,8 @@ void CompoundSprite::initCurrentCacheItem() const
mCacheItem->alphaImage = mAlphaImage;
// mCacheItem->alpha = mAlpha;
- SpriteConstIterator it, it_end;
- for (it = mSprites.begin(), it_end = mSprites.end(); it != it_end; ++ it)
+ for (SpriteConstIterator it = mSprites.begin(), it_end = mSprites.end();
+ it != it_end; ++ it)
{
if (*it)
mCacheItem->data.push_back((*it)->getHash());
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 75a9b5fbc..966223685 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -607,8 +607,9 @@ void ChatWindow::removeAllWhispers()
void ChatWindow::ignoreAllWhispers()
{
- TabMap::iterator iter;
- for (iter = mWhispers.begin(); iter != mWhispers.end(); ++iter)
+ for (TabMap::iterator iter = mWhispers.begin();
+ iter != mWhispers.end();
+ ++ iter)
{
WhisperTab *tab = dynamic_cast<WhisperTab*>(iter->second);
if (tab && player_relations.getRelation(tab->getNick())
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 2a46cf2ce..f01d74984 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -296,9 +296,7 @@ void OutfitWindow::copyOutfit(int src, int dst)
}
for (int i = 0; i < OUTFIT_ITEM_COUNT; i++)
- {
mItems[dst][i] = mItems[src][i];
- }
}
void OutfitWindow::draw(gcn::Graphics *graphics)
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index c2429c550..319476591 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -337,9 +337,9 @@ void Viewport::_drawDebugPath(Graphics *graphics)
// We draw the path proposed by mouse
// Draw the path debug information for every beings.
- ActorSpritesConstIterator it, it_end;
const ActorSprites &actors = actorSpriteManager->getAll();
- for (it = actors.begin(), it_end = actors.end() ; it != it_end; ++ it)
+ for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end();
+ it != it_end; ++ it)
{
Being *being = dynamic_cast<Being*>(*it);
if (being && being != player_node)
diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp
index d3f316021..438318fdc 100644
--- a/src/gui/whoisonline.cpp
+++ b/src/gui/whoisonline.cpp
@@ -232,9 +232,7 @@ void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &friends,
// addedFromSection = false;
}
for (int i = 0; i < static_cast<int>(disregard.size()); i++)
- {
mBrowserBox->addRow(disregard.at(i)->getText());
- }
if (mScrollArea->getVerticalMaxScroll() <
mScrollArea->getVerticalScrollAmount())
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 3f3bbe937..70f2c47fb 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -316,9 +316,8 @@ Item *ItemContainer::getSelectedItem() const
void ItemContainer::distributeValueChangedEvent()
{
- SelectionListenerIterator i, i_end;
-
- for (i = mSelectionListeners.begin(), i_end = mSelectionListeners.end();
+ for (SelectionListenerIterator i = mSelectionListeners.begin(),
+ i_end = mSelectionListeners.end();
i != i_end; ++i)
{
if (*i)
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index 2bebc69a7..7ecb8e2fa 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -393,9 +393,9 @@ void WindowMenu::loadButtons()
void WindowMenu::saveButtons()
{
- std::vector <gcn::Button*>::iterator it, it_end;
int i = 0;
- for (it = mButtons.begin(), it_end = mButtons.end();
+ for (std::vector <gcn::Button*>::iterator it = mButtons.begin(),
+ it_end = mButtons.end();
it != it_end; ++it)
{
Button *btn = dynamic_cast<Button*>(*it);
diff --git a/src/guichan/basiccontainer.cpp b/src/guichan/basiccontainer.cpp
index 76b671cfb..c74748622 100644
--- a/src/guichan/basiccontainer.cpp
+++ b/src/guichan/basiccontainer.cpp
@@ -66,8 +66,8 @@ namespace gcn
void BasicContainer::moveToTop(Widget* widget)
{
- WidgetListIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
if (*iter == widget)
{
@@ -179,8 +179,8 @@ namespace gcn
x -= r.x;
y -= r.y;
- WidgetListCReverseIterator it;
- for (it = mWidgets.rbegin(); it != mWidgets.rend(); ++ it)
+ for (WidgetListCReverseIterator it = mWidgets.rbegin();
+ it != mWidgets.rend(); ++ it)
{
if ((*it)->isVisible() && (*it)->getDimension()
.isPointInRect(x, y))
@@ -204,8 +204,8 @@ namespace gcn
if (mInternalFocusHandler)
return;
- WidgetListConstIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListConstIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
(*iter)->_setFocusHandler(focusHandler);
}
@@ -226,8 +226,8 @@ namespace gcn
void BasicContainer::remove(Widget* widget)
{
- WidgetListIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
if (*iter == widget)
{
@@ -244,9 +244,8 @@ namespace gcn
void BasicContainer::clear()
{
- WidgetListConstIterator iter;
-
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListConstIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
(*iter)->_setFocusHandler(nullptr);
(*iter)->_setParent(nullptr);
@@ -260,8 +259,8 @@ namespace gcn
{
graphics->pushClipArea(getChildrenArea());
- WidgetListConstIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListConstIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
if ((*iter)->isVisible())
{
@@ -290,9 +289,11 @@ namespace gcn
void BasicContainer::logicChildren()
{
- WidgetListConstIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListConstIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
+ {
(*iter)->logic();
+ }
}
void BasicContainer::showWidgetPart(Widget* widget, Rectangle area)
@@ -325,8 +326,8 @@ namespace gcn
{
Widget::setInternalFocusHandler(focusHandler);
- WidgetListConstIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListConstIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
if (!mInternalFocusHandler)
(*iter)->_setFocusHandler(_getFocusHandler());
@@ -337,8 +338,8 @@ namespace gcn
Widget* BasicContainer::findWidgetById(const std::string& id)
{
- WidgetListConstIterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++ iter)
+ for (WidgetListConstIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++ iter)
{
if ((*iter)->getId() == id)
return (*iter);
diff --git a/src/guichan/defaultfont.cpp b/src/guichan/defaultfont.cpp
index 70901bc8e..feeb91001 100644
--- a/src/guichan/defaultfont.cpp
+++ b/src/guichan/defaultfont.cpp
@@ -78,9 +78,7 @@ namespace gcn
void DefaultFont::drawString(Graphics* graphics, const std::string& text,
int x, int y)
{
- unsigned int i;
-
- for (i = 0; i< text.size(); ++i)
+ for (unsigned int i = 0; i< text.size(); ++i)
{
drawGlyph(graphics, text.at(i), x, y);
x += getWidth(text);
diff --git a/src/guichan/focushandler.cpp b/src/guichan/focushandler.cpp
index e3610fb1e..839c35cc1 100644
--- a/src/guichan/focushandler.cpp
+++ b/src/guichan/focushandler.cpp
@@ -73,9 +73,8 @@ namespace gcn
if (!widget || widget == mFocusedWidget)
return;
- unsigned int i = 0;
int toBeFocusedIndex = -1;
- for (i = 0; i < mWidgets.size(); ++i)
+ for (unsigned int i = 0; i < mWidgets.size(); ++i)
{
if (mWidgets[i] == widget)
{
@@ -272,9 +271,8 @@ namespace gcn
if (isFocused(widget))
mFocusedWidget = nullptr;
- WidgetIterator iter;
-
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
+ for (WidgetIterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++iter)
{
if ((*iter) == widget)
{
diff --git a/src/guichan/font.cpp b/src/guichan/font.cpp
index e2485eb0d..598b1610b 100644
--- a/src/guichan/font.cpp
+++ b/src/guichan/font.cpp
@@ -56,14 +56,9 @@ namespace gcn
{
int Font::getStringIndexAt(const std::string& text, int x) const
{
- unsigned int i;
- int size = 0;
-
- for (i = 0; i < text.size(); ++i)
+ for (unsigned int i = 0; i < text.size(); ++i)
{
- size = getWidth(text.substr(0, i));
-
- if (size > x)
+ if (getWidth(text.substr(0, i)) > x)
return i;
}
diff --git a/src/guichan/gui.cpp b/src/guichan/gui.cpp
index 0a24d8b17..68cb83190 100644
--- a/src/guichan/gui.cpp
+++ b/src/guichan/gui.cpp
@@ -263,8 +263,8 @@ namespace gcn
while (!widgetWithMouseQueueCheckDone)
{
unsigned int iterations = 0;
- std::deque<Widget*>::iterator iter;
- for (iter = mWidgetWithMouseQueue.begin();
+ for (std::deque<Widget*>::iterator
+ iter = mWidgetWithMouseQueue.begin();
iter != mWidgetWithMouseQueue.end();
++ iter)
{
@@ -755,9 +755,8 @@ namespace gcn
void Gui::distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEvent)
{
- KeyListenerListIterator it;
-
- for (it = mKeyListeners.begin(); it != mKeyListeners.end(); ++ it)
+ for (KeyListenerListIterator it = mKeyListeners.begin();
+ it != mKeyListeners.end(); ++ it)
{
switch (keyEvent.getType())
{
diff --git a/src/guichan/widget.cpp b/src/guichan/widget.cpp
index da221b8d5..8bae81141 100644
--- a/src/guichan/widget.cpp
+++ b/src/guichan/widget.cpp
@@ -94,9 +94,7 @@ namespace gcn
Widget::~Widget()
{
- DeathListenerIterator iter;
-
- for (iter = mDeathListeners.begin();
+ for (DeathListenerIterator iter = mDeathListeners.begin();
iter != mDeathListeners.end();
++iter)
{
@@ -122,8 +120,7 @@ namespace gcn
shadowColor = faceColor - 0x303030;
shadowColor.a = alpha;
- unsigned int i;
- for (i = 0; i < getFrameSize(); ++i)
+ for (unsigned int i = 0; i < getFrameSize(); ++i)
{
graphics->setColor(shadowColor);
graphics->drawLine(i, i, width - i, i);
@@ -471,8 +468,8 @@ namespace gcn
{
mGlobalFont = font;
- std::list<Widget*>::const_iterator iter;
- for (iter = mWidgets.begin(); iter != mWidgets.end(); ++iter)
+ for (std::list<Widget*>::const_iterator iter = mWidgets.begin();
+ iter != mWidgets.end(); ++iter)
{
if (!(*iter)->mCurrentFont)
(*iter)->fontChanged();
@@ -649,9 +646,7 @@ namespace gcn
void Widget::distributeResizedEvent()
{
- WidgetListenerIterator iter;
-
- for (iter = mWidgetListeners.begin();
+ for (WidgetListenerIterator iter = mWidgetListeners.begin();
iter != mWidgetListeners.end();
++ iter)
{
@@ -662,9 +657,7 @@ namespace gcn
void Widget::distributeMovedEvent()
{
- WidgetListenerIterator iter;
-
- for (iter = mWidgetListeners.begin();
+ for (WidgetListenerIterator iter = mWidgetListeners.begin();
iter != mWidgetListeners.end();
++ iter)
{
@@ -675,9 +668,7 @@ namespace gcn
void Widget::distributeHiddenEvent()
{
- WidgetListenerIterator iter;
-
- for (iter = mWidgetListeners.begin();
+ for (WidgetListenerIterator iter = mWidgetListeners.begin();
iter != mWidgetListeners.end();
++ iter)
{
@@ -688,8 +679,7 @@ namespace gcn
void Widget::distributeActionEvent()
{
- ActionListenerIterator iter;
- for (iter = mActionListeners.begin();
+ for (ActionListenerIterator iter = mActionListeners.begin();
iter != mActionListeners.end();
++iter)
{
@@ -700,9 +690,7 @@ namespace gcn
void Widget::distributeShownEvent()
{
- WidgetListenerIterator iter;
-
- for (iter = mWidgetListeners.begin();
+ for (WidgetListenerIterator iter = mWidgetListeners.begin();
iter != mWidgetListeners.end();
++iter)
{
diff --git a/src/guichan/widgets/dropdown.cpp b/src/guichan/widgets/dropdown.cpp
index ead4e7815..9f2180a72 100644
--- a/src/guichan/widgets/dropdown.cpp
+++ b/src/guichan/widgets/dropdown.cpp
@@ -411,9 +411,7 @@ namespace gcn
void DropDown::distributeValueChangedEvent()
{
- SelectionListenerIterator iter;
-
- for (iter = mSelectionListeners.begin();
+ for (SelectionListenerIterator iter = mSelectionListeners.begin();
iter != mSelectionListeners.end();
++iter)
{
diff --git a/src/guichan/widgets/listbox.cpp b/src/guichan/widgets/listbox.cpp
index 3152890bc..ac71852e1 100644
--- a/src/guichan/widgets/listbox.cpp
+++ b/src/guichan/widgets/listbox.cpp
@@ -268,9 +268,7 @@ namespace gcn
void ListBox::distributeValueChangedEvent()
{
- SelectionListenerIterator iter;
-
- for (iter = mSelectionListeners.begin();
+ for (SelectionListenerIterator iter = mSelectionListeners.begin();
iter != mSelectionListeners.end();
++ iter)
{
diff --git a/src/guichan/widgets/radiobutton.cpp b/src/guichan/widgets/radiobutton.cpp
index c5c0b1ebd..26bd7e44c 100644
--- a/src/guichan/widgets/radiobutton.cpp
+++ b/src/guichan/widgets/radiobutton.cpp
@@ -103,10 +103,8 @@ namespace gcn
{
if (selected && mGroup != "")
{
- GroupIterator iter, iterEnd;
- iterEnd = mGroupMap.upper_bound(mGroup);
-
- for (iter = mGroupMap.lower_bound(mGroup);
+ for (GroupIterator iter = mGroupMap.lower_bound(mGroup),
+ iterEnd = mGroupMap.upper_bound(mGroup);
iter != iterEnd;
++ iter)
{
@@ -150,10 +148,8 @@ namespace gcn
{
if (mGroup != "")
{
- GroupIterator iter, iterEnd;
- iterEnd = mGroupMap.upper_bound(mGroup);
-
- for (iter = mGroupMap.lower_bound(mGroup);
+ for (GroupIterator iter = mGroupMap.lower_bound(mGroup),
+ iterEnd = mGroupMap.upper_bound(mGroup);
iter != iterEnd;
++ iter)
{
diff --git a/src/guichan/widgets/scrollarea.cpp b/src/guichan/widgets/scrollarea.cpp
index a9d84dd98..c0734a926 100644
--- a/src/guichan/widgets/scrollarea.cpp
+++ b/src/guichan/widgets/scrollarea.cpp
@@ -536,10 +536,9 @@ namespace gcn
graphics->setColor(getForegroundColor());
- int i;
- int w = dim.height / 2;
- int h = w / 2 + 2;
- for (i = 0; i < w / 2; ++i)
+ const int w = dim.height / 2;
+ const int h = w / 2 + 2;
+ for (int i = 0; i < w / 2; ++i)
{
graphics->drawLine(w - i + offset, i + h + offset,
w + i + offset, i + h + offset);
@@ -595,10 +594,9 @@ namespace gcn
graphics->setColor(getForegroundColor());
- int i;
- int w = dim.height / 2;
- int h = w + 1;
- for (i = 0; i < w / 2; ++i)
+ const int w = dim.height / 2;
+ const int h = w + 1;
+ for (int i = 0; i < w / 2; ++i)
{
graphics->drawLine(w - i + offset, -i + h + offset,
w + i + offset, -i + h + offset);
@@ -654,10 +652,9 @@ namespace gcn
graphics->setColor(getForegroundColor());
- int i;
- int w = dim.width / 2;
- int h = w - 2;
- for (i = 0; i < w / 2; ++i)
+ const int w = dim.width / 2;
+ const int h = w - 2;
+ for (int i = 0; i < w / 2; ++i)
{
graphics->drawLine(i + h + offset, w - i + offset,
i + h + offset, w + i + offset);
@@ -713,10 +710,9 @@ namespace gcn
graphics->setColor(getForegroundColor());
- int i;
- int w = dim.width / 2;
- int h = w + 1;
- for (i = 0; i < w / 2; ++i)
+ const int w = dim.width / 2;
+ const int h = w + 1;
+ for (int i = 0; i < w / 2; ++i)
{
graphics->drawLine(-i + h + offset, w - i + offset,
-i + h + offset, w + i + offset);
diff --git a/src/guichan/widgets/tabbedarea.cpp b/src/guichan/widgets/tabbedarea.cpp
index fb6619bed..a4179db5e 100644
--- a/src/guichan/widgets/tabbedarea.cpp
+++ b/src/guichan/widgets/tabbedarea.cpp
@@ -160,8 +160,7 @@ namespace gcn
int TabbedArea::getSelectedTabIndex() const
{
- unsigned int i;
- for (i = 0; i < mTabs.size(); i++)
+ for (unsigned int i = 0; i < mTabs.size(); i++)
{
if (mTabs[i].first == mSelectedTab)
return i;
diff --git a/src/guichan/widgets/textbox.cpp b/src/guichan/widgets/textbox.cpp
index 2c6066976..0103cdb99 100644
--- a/src/guichan/widgets/textbox.cpp
+++ b/src/guichan/widgets/textbox.cpp
@@ -114,8 +114,6 @@ namespace gcn
void TextBox::draw(Graphics* graphics)
{
- unsigned int i;
-
if (mOpaque)
{
graphics->setColor(getBackgroundColor());
@@ -132,7 +130,7 @@ namespace gcn
graphics->setColor(getForegroundColor());
graphics->setFont(getFont());
- for (i = 0; i < mTextRows.size(); i++)
+ for (size_t i = 0; i < mTextRows.size(); i++)
{
// Move the text one pixel so we can have a caret before a letter.
graphics->drawText(mTextRows[i], 1, i * getFont()->getHeight());
@@ -170,9 +168,8 @@ namespace gcn
void TextBox::adjustSize()
{
- unsigned int i;
int width = 0;
- for (i = 0; i < mTextRows.size(); ++i)
+ for (size_t i = 0; i < mTextRows.size(); ++i)
{
int w = getFont()->getWidth(mTextRows[i]);
if (width < w)
diff --git a/src/guichan/widgets/window.cpp b/src/guichan/widgets/window.cpp
index c7ed8a69e..1a2279811 100644
--- a/src/guichan/widgets/window.cpp
+++ b/src/guichan/widgets/window.cpp
@@ -189,10 +189,9 @@ namespace gcn
void Window::resizeToContent()
{
- WidgetListConstIterator it;
-
int w = 0, h = 0;
- for (it = mWidgets.begin(); it != mWidgets.end(); ++ it)
+ for (WidgetListConstIterator it = mWidgets.begin();
+ it != mWidgets.end(); ++ it)
{
if ((*it)->getX() + (*it)->getWidth() > w)
w = (*it)->getX() + (*it)->getWidth();
diff --git a/src/map.cpp b/src/map.cpp
index bb35a53f1..0530b2702 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -662,8 +662,8 @@ bool Map::getWalk(int x, int y, unsigned char walkmask) const
bool Map::occupied(int x, int y) const
{
const ActorSprites &actors = actorSpriteManager->getAll();
- ActorSpritesConstIterator it, it_end;
- for (it = actors.begin(), it_end = actors.end(); it != it_end; ++it)
+ for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end();
+ it != it_end; ++it)
{
const ActorSprite *actor = *it;
@@ -1259,11 +1259,8 @@ void Map::updatePortalTile(const std::string &name, int type,
MapItem *Map::findPortalXY(int x, int y)
{
- 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)
+ for (std::vector<MapItem*>::const_iterator it = mMapPortals.begin(),
+ it_end = mMapPortals.end(); it != it_end; ++it)
{
if (!*it)
continue;
diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp
index 47eb5b253..a03e510fb 100644
--- a/src/net/manaserv/attributes.cpp
+++ b/src/net/manaserv/attributes.cpp
@@ -92,8 +92,8 @@ namespace Attributes
{
// Fill up the modifiable attribute label list.
attributeLabels.clear();
- AttributeMap::const_iterator it, it_end;
- for (it = attributes.begin(), it_end = attributes.end();
+ for (AttributeMap::const_iterator it = attributes.begin(),
+ it_end = attributes.end();
it != it_end; ++it)
{
if (it->second.modifiable && (it->second.scope == "character"
@@ -383,10 +383,11 @@ namespace Attributes
{
std::vector<ItemDB::Stat> dbStats;
- TagMap::const_iterator it, it_end;
- for (it = tags.begin(), it_end = tags.end(); it != it_end; ++it)
+ for (TagMap::const_iterator it = tags.begin(), it_end = tags.end();
+ it != it_end; ++it)
+ {
dbStats.push_back(ItemDB::Stat(it->first, it->second));
-
+ }
ItemDB::setStatsList(dbStats);
}
@@ -395,8 +396,8 @@ namespace Attributes
if (!statusWindow)
return;
- AttributeMap::const_iterator it, it_end;
- for (it = attributes.begin(), it_end = attributes.end();
+ for (AttributeMap::const_iterator it = attributes.begin(),
+ it_end = attributes.end();
it != it_end; ++it)
{
if (it->second.playerInfoId == -1
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index f1af32354..7878e5d88 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -323,9 +323,11 @@ void CharHandler::newCharacter(const std::string &name,
msg.writeInt8(gender);
msg.writeInt8(slot);
- std::vector<int>::const_iterator it, it_end;
- for (it = stats.begin(), it_end = stats.end(); it != it_end; ++it)
+ for (std::vector<int>::const_iterator it = stats.begin(),
+ it_end = stats.end(); it != it_end; ++it)
+ {
msg.writeInt16((*it));
+ }
accountServerConnection->send(msg);
}
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index a7e06a2f4..e8d4b6b5d 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -191,10 +191,11 @@ void StatusEffect::load()
void unloadMap(std::map<int, StatusEffect *> &map)
{
- std::map<int, StatusEffect *>::iterator it;
-
- for (it = map.begin(); it != map.end(); ++it)
+ for (std::map<int, StatusEffect *>::iterator it = map.begin();
+ it != map.end(); ++it)
+ {
delete (*it).second;
+ }
map.clear();
}