diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-01-20 19:01:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-01-20 19:29:26 +0300 |
commit | 531433248fbad49e2b8e9d90de9855f3ea9b2257 (patch) | |
tree | 33937a65d8b18934879824fa4c2a6183d53d5e73 /src | |
parent | 48071e171de41a23197c7328ba038331a936e0eb (diff) | |
download | mv-531433248fbad49e2b8e9d90de9855f3ea9b2257.tar.gz mv-531433248fbad49e2b8e9d90de9855f3ea9b2257.tar.bz2 mv-531433248fbad49e2b8e9d90de9855f3ea9b2257.tar.xz mv-531433248fbad49e2b8e9d90de9855f3ea9b2257.zip |
Another part with FOR_EACH changes.
Diffstat (limited to 'src')
33 files changed, 75 insertions, 166 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index 3164ca7c5..5e2841879 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -110,8 +110,7 @@ public: && botCheckerWindow->mEnabled) { std::set<ActorSprite*> beings = actorSpriteManager->getAll(); - for (ActorSprites::const_iterator i = beings.begin(), - i_end = beings.end(); i != i_end; ++i) + FOR_EACH (ActorSprites::const_iterator, i, beings) { Being *const being = dynamic_cast<Being*>(*i); @@ -396,8 +395,7 @@ void BotCheckerWindow::reset() if (actorSpriteManager) { std::set<ActorSprite*> beings = actorSpriteManager->getAll(); - for (ActorSprites::const_iterator i = beings.begin(), - i_end = beings.end(); i != i_end; ++i) + FOR_EACH (ActorSprites::const_iterator, i, beings) { Being *const being = dynamic_cast<Being*>(*i); diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 24ac63a00..e18b0965d 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -346,8 +346,7 @@ void BuyDialog::setVisible(bool visible) void BuyDialog::closeAll() { - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) + FOR_EACH (DialogList::const_iterator, it, instances) { if (*it) (*it)->close(); diff --git a/src/gui/buyselldialog.cpp b/src/gui/buyselldialog.cpp index c1d1207df..973df6182 100644 --- a/src/gui/buyselldialog.cpp +++ b/src/gui/buyselldialog.cpp @@ -132,8 +132,7 @@ void BuySellDialog::action(const gcn::ActionEvent &event) void BuySellDialog::closeAll() { - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) + FOR_EACH (DialogList::const_iterator, it, instances) { if (*it) (*it)->close(); diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 82daaeced..a912b9198 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -461,15 +461,13 @@ void CharSelectDialog::attemptCharacterSelect(const int index) void CharSelectDialog::setCharacters(const Net::Characters &characters) { // Reset previous characters - for (std::vector<CharacterDisplay*>::const_iterator - iter = mCharacterEntries.begin(), iter_end = mCharacterEntries.end(); - iter != iter_end; ++iter) + FOR_EACH (std::vector<CharacterDisplay*>::const_iterator, + iter, mCharacterEntries) { (*iter)->setCharacter(nullptr); } - for (Net::Characters::const_iterator i = characters.begin(), - i_end = characters.end(); i != i_end; ++i) + FOR_EACH (Net::Characters::const_iterator, i, characters) { if (!*i) continue; diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 4a80a5df0..302c0c72b 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -613,11 +613,8 @@ void ChatWindow::removeAllWhispers() { std::list<ChatTab*> tabs; - for (TabMap::iterator iter = mWhispers.begin(), - iter_end = mWhispers.end(); iter != iter_end; ++ iter) - { + FOR_EACH (TabMap::iterator, iter, mWhispers) tabs.push_back(iter->second); - } for (std::list<ChatTab*>::iterator it = tabs.begin(); it != tabs.end(); ++it) @@ -687,8 +684,7 @@ void ChatWindow::doPresent() const std::string response; int playercount = 0; - for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; ++it) + FOR_EACH (ActorSpritesConstIterator, it, actors) { if ((*it)->getType() == ActorSprite::PLAYER) { @@ -1504,8 +1500,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers) party = player_node->getParty(); guild = player_node->getGuild(); } - for (TabMap::const_iterator iter = mWhispers.begin(), - iter_end = mWhispers.end(); iter != iter_end; ++iter) + FOR_EACH (TabMap::const_iterator, iter, mWhispers) { if (!iter->second) return; diff --git a/src/gui/editdialog.cpp b/src/gui/editdialog.cpp index 94546becb..938bccaad 100644 --- a/src/gui/editdialog.cpp +++ b/src/gui/editdialog.cpp @@ -66,11 +66,8 @@ EditDialog::EditDialog(const std::string &title, const std::string &msg, void EditDialog::action(const gcn::ActionEvent &event) { // Proxy button events to our listeners - for (ActionListenerIterator i = mActionListeners.begin(), - i_end = mActionListeners.end(); i != i_end; ++i) - { + FOR_EACH (ActionListenerIterator, i, mActionListeners) (*i)->action(event); - } if (event.getId() == mEventOk) scheduleDelete(); diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index f2fe34a31..af2c8f083 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -159,9 +159,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) if (mLastRedraw) { mVertexes->clear(); - for (std::vector<EquipmentBox*>::const_iterator - it = mBoxes.begin(), it_end = mBoxes.end(); - it != it_end; ++ it, ++ i) + FOR_EACH (std::vector<EquipmentBox*>::const_iterator, it, mBoxes) { const EquipmentBox *const box = *it; if (!box) diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index a9aead461..3dcc19dbb 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -132,8 +132,7 @@ void HelpWindow::loadTags() helpPath = paths.getStringValue("help"); StringVect lines; ResourceManager::loadTextFile(helpPath + "tags.idx", lines); - for (StringVectCIter it = lines.begin(), it_end = lines.end(); - it != it_end; ++ it) + FOR_EACH (StringVectCIter, it, lines) { const std::string &str = *it; const size_t idx = str.find('|'); @@ -164,8 +163,7 @@ void HelpWindow::search(const std::string &text0) mBrowserBox->clearRows(); loadFile("header"); loadFile("searchmany"); - for (HelpNamesCIter it = names.begin(), it_end = names.end(); - it != it_end; ++ it) + FOR_EACH (HelpNamesCIter, it, names) { const char *const str = (*it).c_str(); mBrowserBox->addRow(strprintf(" -> @@%s|%s@@", str, diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 8d142328c..4b6256a8d 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -708,8 +708,7 @@ bool InventoryWindow::isInputFocused() const bool InventoryWindow::isAnyInputFocused() { - for (WindowList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) + FOR_EACH (WindowList::const_iterator, it, instances) { if ((*it) && (*it)->isInputFocused()) return true; diff --git a/src/gui/itemamountwindow.cpp b/src/gui/itemamountwindow.cpp index 454460984..3ebc899c7 100644 --- a/src/gui/itemamountwindow.cpp +++ b/src/gui/itemamountwindow.cpp @@ -71,11 +71,8 @@ public: } } tempStrings.sort(); - for (std::list<std::string>::const_iterator i = tempStrings.begin(), - i_end = tempStrings.end(); i != i_end; ++i) - { + FOR_EACH (std::list<std::string>::const_iterator, i, tempStrings) mStrings.push_back(*i); - } } A_DELETE_COPY(ItemsModal) diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 995667cd7..b30703a7e 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -266,9 +266,7 @@ void Minimap::draw(gcn::Graphics *graphics) } const ActorSprites &actors = actorSpriteManager->getAll(); - - for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; ++it) + FOR_EACH (ActorSpritesConstIterator, it, actors) { if (!(*it) || (*it)->getType() == ActorSprite::FLOOR_ITEM) continue; diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index b1c6eba24..5e4559c9c 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -48,6 +48,8 @@ extern volatile int tick_time; +typedef std::vector <ProgressBar*>::const_iterator ProgressBarVectorCIter; + MiniStatusWindow::MiniStatusWindow() : Popup("MiniStatus", "ministatus.xml"), InventoryListener(), @@ -124,8 +126,7 @@ MiniStatusWindow::~MiniStatusWindow() if (inv) inv->removeInventoyListener(this); - for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), - it_end = mBars.end(); it != it_end; ++it) + FOR_EACH (ProgressBarVectorCIter, it, mBars) { ProgressBar *bar = *it; if (!bar) @@ -154,13 +155,10 @@ void MiniStatusWindow::updateBars() { int x = 0; const ProgressBar *lastBar = nullptr; - for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), - it_end = mBars.end(); it != it_end; ++it) - { + FOR_EACH (ProgressBarVectorCIter, it, mBars) safeRemove(*it); - } - for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), - it_end = mBars.end(); it != it_end; ++it) + + FOR_EACH (ProgressBarVectorCIter, it, mBars) { ProgressBar *const bar = *it; if (!bar) @@ -456,8 +454,7 @@ void MiniStatusWindow::loadBars() void MiniStatusWindow::saveBars() { int i = 0; - for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), - it_end = mBars.end(); it != it_end; ++it) + FOR_EACH (ProgressBarVectorCIter, it, mBars) { const ProgressBar *const bar = *it; if (!bar->isVisible()) diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index f2067d847..31b13e91f 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -60,6 +60,8 @@ NpcDialog::DialogList NpcDialog::instances; +typedef std::vector<Image *>::iterator ImageVectorIter; + NpcDialog::NpcDialog(const int npcId) : Window(_("NPC"), false, nullptr, "npc.xml"), gcn::ActionListener(), @@ -209,8 +211,7 @@ NpcDialog::~NpcDialog() delete mListScrollArea; mListScrollArea = nullptr; - for (std::vector<Image *>::iterator it = mImages.begin(), - it_end = mImages.end(); it != it_end; ++ it) + FOR_EACH (ImageVectorIter, it, mImages) { if (*it) (*it)->decRef(); @@ -378,8 +379,7 @@ const Image *NpcDialog::getImageAt(int i) void NpcDialog::choiceRequest() { mItems.clear(); - for (std::vector<Image *>::iterator it = mImages.begin(), - it_end = mImages.end(); it != it_end; ++ it) + FOR_EACH (ImageVectorIter, it, mImages) { if (*it) (*it)->decRef(); @@ -459,8 +459,7 @@ bool NpcDialog::isInputFocused() const bool NpcDialog::isAnyInputFocused() { - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) + FOR_EACH (DialogList::const_iterator, it, instances) { if ((*it) && (*it)->isInputFocused()) return true; @@ -519,8 +518,7 @@ NpcDialog *NpcDialog::getActive() if (instances.size() == 1) return instances.front(); - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) + FOR_EACH (DialogList::const_iterator, it, instances) { if ((*it) && (*it)->isFocused()) return (*it); @@ -531,8 +529,7 @@ NpcDialog *NpcDialog::getActive() void NpcDialog::closeAll() { - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) + FOR_EACH (DialogList::const_iterator, it, instances) { if (*it) (*it)->close(); diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index b5e85938e..5135e56bd 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -125,9 +125,6 @@ void NpcPostDialog::setVisible(bool visible) void NpcPostDialog::closeAll() { - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) - { + FOR_EACH (DialogList::const_iterator, it, instances) (*it)->close(); - } } diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index 26494fe43..c41fdfcd2 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -92,11 +92,8 @@ int Palette::getIdByChar(const signed char c, bool &valid) void Palette::advanceGradients() { - for (Palettes::const_iterator it = mInstances.begin(), - it_end = mInstances.end(); it != it_end; ++it) - { + FOR_EACH (Palettes::const_iterator, it, mInstances) (*it)->advanceGradient(); - } } void Palette::advanceGradient() diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 09389f3ea..b71676b15 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -267,8 +267,7 @@ void PopupMenu::showPopup(const int x, const int y, mY = y; mBrowserBox->clearRows(); mBrowserBox->addRow(_("Players")); - for (std::vector<ActorSprite*>::const_iterator it = beings.begin(), - it_end = beings.end(); it != it_end; ++it) + FOR_EACH (std::vector<ActorSprite*>::const_iterator, it, beings) { const Being *const being = dynamic_cast<Being*>(*it); const ActorSprite *const actor = *it; @@ -650,8 +649,7 @@ void PopupMenu::showChangePos(const int x, const int y) if (guild) { PositionsMap map = guild->getPositions(); - for (PositionsMap::const_iterator itr = map.begin(), - itr_end = map.end(); itr != itr_end; ++itr) + FOR_EACH (PositionsMap::const_iterator, itr, map) { mBrowserBox->addRow(strprintf("@@guild-pos-%u|%s@@", itr->first, itr->second.c_str())); @@ -1905,8 +1903,8 @@ void PopupMenu::showPopup(const int x, const int y, Button *const button) mY = y; mBrowserBox->clearRows(); - std::vector <Button*> names = windowMenu->getButtons(); - for (std::vector <Button*>::const_iterator it = names.begin(), + std::vector<Button *> names = windowMenu->getButtons(); + for (std::vector<Button *>::const_iterator it = names.begin(), it_end = names.end(); it != it_end; ++ it) { const Button *const btn = dynamic_cast<Button*>(*it); diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index cb03904a9..911394a56 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -277,8 +277,7 @@ void QuestsWindow::rebuild(const bool playSound) const int var = (*it).first; const int val = (*it).second; const std::vector<QuestItem*> &quests = mQuests[var]; - for (std::vector<QuestItem*>::const_iterator it2 = quests.begin(), - it2_end = quests.end(); it2 != it2_end; ++ it2) + FOR_EACH (std::vector<QuestItem*>::const_iterator, it2, quests) { if (!*it2) continue; @@ -372,8 +371,7 @@ void QuestsWindow::showQuest(const QuestItem *const quest) const std::vector<QuestItemText> &texts = quest->texts; mText->clearRows(); - for (std::vector<QuestItemText>::const_iterator it = texts.begin(), - it_end = texts.end(); it != it_end; ++ it) + FOR_EACH (std::vector<QuestItemText>::const_iterator, it, texts) { const QuestItemText &data = *it; switch (data.type) diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 8cf0a4ffe..0f4629ef8 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -280,8 +280,7 @@ void SDLFont::drawString(gcn::Graphics *const graphics, int cnt = 0; #endif - for (CacheIterator i = cache->begin(), i_end = cache->end(); - i != i_end; ++ i) + FOR_EACH (CacheIterator, i, cache) { if (chunk == (*i)) { @@ -364,8 +363,7 @@ int SDLFont::getWidth(const std::string &text) const int cnt = 0; #endif - for (CacheIterator i = cache->begin(), i_end = cache->end(); - i != i_end; ++ i) + FOR_EACHP (CacheIterator, i, cache) { if (i->text == text) { diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp index 50757369d..9afd3a554 100644 --- a/src/gui/selldialog.cpp +++ b/src/gui/selldialog.cpp @@ -358,9 +358,6 @@ void SellDialog::setVisible(bool visible) void SellDialog::closeAll() { - for (DialogList::const_iterator it = instances.begin(), - it_end = instances.end(); it != it_end; ++it) - { + FOR_EACH (DialogList::const_iterator, it, instances) (*it)->close(); - } } diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 1c4ad195b..e2ef3fb01 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -708,8 +708,7 @@ void ServerDialog::saveCustomServers(const ServerInfo ¤tServer, } else { - for (ServerInfos::iterator i = mServers.begin(), - i_end = mServers.end(); i != i_end; ++i) + FOR_EACH (ServerInfos::iterator, i, mServers) { if (*i == currentServer) { diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 7eef2d856..777bdc752 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -109,9 +109,7 @@ Setup::Setup(): mTabs.push_back(new Setup_Theme(this)); mTabs.push_back(new Setup_Other(this)); - for (std::list<SetupTab*>::const_iterator i = mTabs.begin(), - i_end = mTabs.end(); - i != i_end; ++i) + FOR_EACH (std::list<SetupTab*>::const_iterator, i, mTabs) { SetupTab *const tab = *i; mPanel->addTab(tab->getName(), tab); @@ -170,9 +168,7 @@ void Setup::action(const gcn::ActionEvent &event) if (!statusWindow) return; - for (std::list<Window*>::const_iterator it = mWindowsToReset.begin(), - it_end = mWindowsToReset.end(); - it != it_end; ++it) + FOR_EACH (std::list<Window*>::const_iterator, it, mWindowsToReset) { if (*it) (*it)->resetToDefaultSize(); @@ -187,8 +183,7 @@ void Setup::setInGame(const bool inGame) void Setup::externalUpdate() { - for (std::list<SetupTab*>::const_iterator it = mTabs.begin(), - it_end = mTabs.end(); it != it_end; ++ it) + FOR_EACH (std::list<SetupTab*>::const_iterator, it, mTabs) { if (*it) (*it)->externalUpdated(); diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 548c99628..c2bc4d336 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -413,8 +413,7 @@ void ShopWindow::saveList() } std::vector<ShopItem*> items = mBuyShopItems->items(); - for (std::vector<ShopItem*>::const_iterator it = items.begin(), - it_end = items.end(); it != it_end; ++it) + FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items) { ShopItem *const item = *(it); if (item) @@ -422,8 +421,7 @@ void ShopWindow::saveList() } items = mSellShopItems->items(); - for (std::vector<ShopItem*>::const_iterator it = items.begin(), - it_end = items.end(); it != it_end; ++it) + FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items) { if (!(*it)) continue; @@ -487,8 +485,7 @@ void ShopWindow::announce(ShopItems *const list, const int mode) std::vector<ShopItem*> items = list->items(); - for (std::vector<ShopItem*>::const_iterator it = items.begin(), - it_end = items.end(); it != it_end; ++it) + FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items) { const ShopItem *const item = *(it); if (item->getQuantity() > 1) @@ -553,8 +550,7 @@ void ShopWindow::giveList(const std::string &nick, const int mode) std::vector<ShopItem*> items = list->items(); - for (std::vector<ShopItem*>::const_iterator it = items.begin(), - it_end = items.end(); it != it_end; ++it) + FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items) { const ShopItem *const item = *(it); if (!item) @@ -816,8 +812,7 @@ bool ShopWindow::findShopItem(const ShopItem *const shopItem, const int mode) items = mBuyShopItems->items(); } - for (std::vector<ShopItem*>::const_iterator it = items.begin(), - it_end = items.end(); it != it_end; ++ it) + FOR_EACH (std::vector<ShopItem*>::const_iterator, it, items) { const ShopItem *const item = *(it); if (!item) diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index aa16c0210..06127c8b2 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -223,9 +223,6 @@ void ShortcutWindow::widgetMoved(const gcn::Event& event) Window::widgetMoved(event); if (mItems) mItems->setRedraw(true); - for (std::vector<ShortcutContainer*>::iterator it = mPages.begin(), - it_end = mPages.end(); it != it_end; ++ it) - { + FOR_EACH (std::vector<ShortcutContainer*>::iterator, it, mPages) (*it)->setRedraw(true); - } } diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 2f741d283..6a47a425d 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -377,8 +377,7 @@ void SkillDialog::update() PlayerInfo::getAttribute(PlayerInfo::SKILL_POINTS))); mPointsLabel->adjustSize(); - for (SkillMap::const_iterator it = mSkills.begin(), it_end = mSkills.end(); - it != it_end; ++ it) + FOR_EACH (SkillMap::const_iterator, it, mSkills) { if ((*it).second && (*it).second->modifiable) (*it).second->update(); @@ -582,9 +581,7 @@ void SkillModel::updateVisibilities() { mVisibleSkills.clear(); - for (SkillList::const_iterator it = mSkills.begin(), - it_end = mSkills.end(); - it != it_end; ++ it) + FOR_EACH (SkillList::const_iterator, it, mSkills) { if ((*it)->visible) mVisibleSkills.push_back((*it)); @@ -642,11 +639,8 @@ SkillInfo::SkillInfo() : SkillInfo::~SkillInfo() { - for (SkillDataMapIter it = dataMap.begin(), it_end = dataMap.end(); - it != it_end; ++ it) - { + FOR_EACH (SkillDataMapIter, it, dataMap) delete (*it).second; - } dataMap.clear(); } diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 9d9b11471..f3b907cb2 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -1143,8 +1143,7 @@ public: if (!players) return; - for (StringVectCIter it = players->begin(), it_end = players->end(); - it != it_end; ++ it) + FOR_EACHP (StringVectCIter, it, players) { Avatar *const ava = new Avatar(*it); if (actorSpriteManager->findBeingByName(*it, Being::PLAYER) diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 188ff5d66..63c2d9331 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -466,11 +466,8 @@ void StatusWindow::clearAttributes() { mAttrCont->clear(); mDAttrCont->clear(); - for (Attrs::iterator it = mAttrs.begin(), it_end = mAttrs.end(); - it != it_end; ++ it) - { + FOR_EACH (Attrs::iterator, it, mAttrs) delete (*it).second; - } mAttrs.clear(); } diff --git a/src/gui/textcommandeditor.cpp b/src/gui/textcommandeditor.cpp index 156c6c60d..d6540dca2 100644 --- a/src/gui/textcommandeditor.cpp +++ b/src/gui/textcommandeditor.cpp @@ -76,11 +76,8 @@ public: } tempStrings.sort(); mStrings.push_back(""); - for (std::list<std::string>::const_iterator i = tempStrings.begin(), - i_end = tempStrings.end(); i != i_end; ++i) - { + FOR_EACH (std::list<std::string>::const_iterator, i, tempStrings) mStrings.push_back(*i); - } } A_DELETE_COPY(IconsModal) diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index f2ce534a7..4ff1f8ea4 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -341,9 +341,7 @@ void Theme::setMinimumOpacity(const float minimumOpacity) void Theme::updateAlpha() { - for (SkinIterator iter = mSkins.begin(), iter_end = mSkins.end(); - iter != iter_end; - ++ iter) + FOR_EACH (SkinIterator, iter, mSkins) { if (iter->second) iter->second->updateAlpha(mMinimumOpacity); diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 7f2a2ca41..c42a7aa27 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -173,8 +173,7 @@ UserPalette::UserPalette(): UserPalette::~UserPalette() { - for (Colors::const_iterator col = mColors.begin(), - colEnd = mColors.end(); col != colEnd; ++col) + FOR_EACH (Colors::const_iterator, col, mColors) { const std::string &configName = ColorTypeNames[col->type]; config.setValue(configName + "Gradient", @@ -233,8 +232,7 @@ std::string UserPalette::getElementAt(int i) void UserPalette::commit(const bool commitNonStatic) { - for (Colors::iterator i = mColors.begin(), iEnd = mColors.end(); - i != iEnd; ++i) + FOR_EACH (Colors::iterator, i, mColors) { i->committedGrad = i->grad; i->committedDelay = i->delay; @@ -247,8 +245,7 @@ void UserPalette::commit(const bool commitNonStatic) void UserPalette::rollback() { - for (Colors::iterator i = mColors.begin(), iEnd = mColors.end(); - i != iEnd; ++i) + FOR_EACH (Colors::iterator, i, mColors) { if (i->grad != i->committedGrad) setGradient(i->type, i->committedGrad); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index b0d41edd3..318641011 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -256,8 +256,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) // Draw player names, speech, and emotion sprite as needed const ActorSprites &actors = actorSpriteManager->getAll(); - for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; ++it) + FOR_EACH (ActorSpritesConstIterator, it, actors) { if ((*it)->getType() == ActorSprite::FLOOR_ITEM) continue; @@ -342,8 +341,7 @@ void Viewport::_drawDebugPath(Graphics *const graphics) // Draw the path debug information for every beings. const ActorSprites &actors = actorSpriteManager->getAll(); - for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; ++ it) + FOR_EACH (ActorSpritesConstIterator, it, actors) { const Being *const being = dynamic_cast<Being*>(*it); if (being && being != player_node) @@ -368,8 +366,7 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, #endif { int cnt = 1; - for (Path::const_iterator i = path.begin(), i_end = path.end(); - i != i_end; ++i) + FOR_EACH (Path::const_iterator, i, path) { const int squareX = i->x * 32 - mPixelViewX + 12; const int squareY = i->y * 32 - mPixelViewY + 12; @@ -387,8 +384,7 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, #ifdef MANASERV_SUPPORT else if (Net::getNetworkType() == ServerInfo::MANASERV) { - for (Path::const_iterator i = path.begin(), i_end = path.end(); - i != i_end; ++i) + FOR_EACH (Path::const_iterator, i, path) { int squareX = i->x - mPixelViewX; int squareY = i->y - mPixelViewY; diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index f0b0ab538..d7d67fbc2 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -139,11 +139,8 @@ WhoIsOnline::~WhoIsOnline() // Remove possibly leftover temporary download delete []mCurlError; - for (std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(), - itd_end = mOnlinePlayers.end(); itd != itd_end; ++ itd) - { + FOR_EACH (std::set<OnlinePlayer*>::iterator, itd, mOnlinePlayers) delete *itd; - } mOnlinePlayers.clear(); mOnlineNicks.clear(); } @@ -247,18 +244,14 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list) std::vector<OnlinePlayer*> disregard; std::vector<OnlinePlayer*> enemy; - for (std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(), - itd_end = mOnlinePlayers.end(); itd != itd_end; ++ itd) - { + FOR_EACH (std::set<OnlinePlayer*>::iterator, itd, mOnlinePlayers) delete *itd; - } mOnlinePlayers.clear(); mOnlineNicks.clear(); mShowLevel = config.getBoolValue("showlevel"); - for (std::vector<OnlinePlayer*>::const_iterator it = list.begin(), - it_end = list.end(); it != it_end; ++ it) + FOR_EACH (std::vector<OnlinePlayer*>::const_iterator, it, list) { OnlinePlayer *player = *it; std::string nick = player->getNick(); @@ -335,11 +328,8 @@ void WhoIsOnline::loadWebList() char *line = strtok(mMemoryBuffer, "\n"); const std::string gmText = "(GM)"; - for (std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(), - itd_end = mOnlinePlayers.end(); itd != itd_end; ++ itd) - { + FOR_EACH (std::set<OnlinePlayer*>::iterator, itd, mOnlinePlayers) delete *itd; - } mOnlinePlayers.clear(); mOnlineNicks.clear(); diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 2d8ec7f7a..f9944312b 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -345,11 +345,10 @@ void WindowMenu::showButton(const std::string &name, const bool visible) void WindowMenu::updateButtons() { int x = mPadding, h = 0; - std::vector <Button*>::const_iterator it, it_end; - for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it) + FOR_EACH (std::vector <Button*>::const_iterator, it, mButtons) safeRemove(*it); const int pad2 = 2 * mPadding; - for (it = mButtons.begin(), it_end = mButtons.end(); it != it_end; ++it) + FOR_EACH (std::vector <Button*>::const_iterator, it, mButtons) { Button *const btn = dynamic_cast<Button *const>(*it); if (!btn) diff --git a/src/map.cpp b/src/map.cpp index ec9c42e65..1d4e0535c 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1095,8 +1095,9 @@ void Map::initializeParticleEffects(Particle *const engine) if (config.getBoolValue("particleeffects")) { - FOR_EACH (std::vector<ParticleEffectData>::const_iterator, - i, particleEffects) + for (std::vector<ParticleEffectData>::const_iterator + i = particleEffects.begin(); + i != particleEffects.end(); ++i) { Particle *const p = engine->addEffect(i->file, i->x, i->y); if (p && i->w > 0 && i->h > 0) |