diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-25 02:26:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-25 02:26:22 +0300 |
commit | 8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf (patch) | |
tree | 2c95704e2de3418227faf7a52357a6fe03d5b735 /src/gui/shopwindow.cpp | |
parent | e73f7da4d65e7dc61a952894cc6f0843c4da3170 (diff) | |
download | manaverse-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.gz manaverse-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.bz2 manaverse-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.xz manaverse-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.zip |
Improve iterators part 1.
Diffstat (limited to 'src/gui/shopwindow.cpp')
-rw-r--r-- | src/gui/shopwindow.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index fccb953b6..615bbc18b 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -408,8 +408,8 @@ void ShopWindow::saveList() } std::vector<ShopItem*> items = mBuyShopItems->items(); - std::vector<ShopItem*>::const_iterator it; - for (it = items.begin(); it != items.end(); ++it) + for (std::vector<ShopItem*>::const_iterator it = items.begin(), + it_end = items.end(); it != it_end; ++it) { ShopItem *item = *(it); if (item) @@ -417,7 +417,8 @@ void ShopWindow::saveList() } items = mSellShopItems->items(); - for (it = items.begin(); it != items.end(); ++it) + for (std::vector<ShopItem*>::const_iterator it = items.begin(), + it_end = items.end(); it != it_end; ++it) { if (!(*it)) continue; @@ -440,8 +441,8 @@ void ShopWindow::saveList() sellItem->getPrice()) << std::endl; } - std::map<int, ShopItem*>::const_iterator mapIt; - for (mapIt = mapItems.begin(); mapIt != mapItems.end(); ++mapIt) + for (std::map<int, ShopItem*>::const_iterator mapIt = mapItems.begin(), + mapIt_end = mapItems.end(); mapIt != mapIt_end; ++mapIt) { ShopItem *buyItem = (*mapIt).second; if (buyItem) @@ -480,9 +481,9 @@ void ShopWindow::announce(ShopItems *list, int mode) mSellAnnounceButton->setEnabled(false); std::vector<ShopItem*> items = list->items(); - std::vector<ShopItem*>::const_iterator it; - for (it = items.begin(); it != items.end(); ++it) + for (std::vector<ShopItem*>::const_iterator it = items.begin(), + it_end = items.end(); it != it_end; ++it) { ShopItem *item = *(it); if (item->getQuantity() > 1) @@ -546,9 +547,9 @@ void ShopWindow::giveList(const std::string &nick, int mode) return; std::vector<ShopItem*> items = list->items(); - std::vector<ShopItem*>::const_iterator it; - for (it = items.begin(); it != items.end(); ++it) + for (std::vector<ShopItem*>::const_iterator it = items.begin(), + it_end = items.end(); it != it_end; ++it) { ShopItem *item = *(it); if (!item) @@ -792,7 +793,6 @@ bool ShopWindow::findShopItem(ShopItem *shopItem, int mode) return false; std::vector<ShopItem*> items; - std::vector<ShopItem*>::const_iterator it; if (mode == SELL) { if (!mSellShopItems) @@ -806,7 +806,8 @@ bool ShopWindow::findShopItem(ShopItem *shopItem, int mode) items = mBuyShopItems->items(); } - for (it = items.begin(); it != items.end(); ++it) + for (std::vector<ShopItem*>::const_iterator it = items.begin(), + it_end = items.end(); it != it_end; ++ it) { ShopItem *item = *(it); if (!item) |