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/ministatuswindow.cpp | |
parent | e73f7da4d65e7dc61a952894cc6f0843c4da3170 (diff) | |
download | manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.gz manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.bz2 manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.tar.xz manaplus-8e19f9b9d792cf4d3d3b022fd26a258c3d3d97bf.zip |
Improve iterators part 1.
Diffstat (limited to 'src/gui/ministatuswindow.cpp')
-rw-r--r-- | src/gui/ministatuswindow.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index 219c319a5..9ac37a413 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -134,8 +134,8 @@ MiniStatusWindow::~MiniStatusWindow() if (inv) inv->removeInventoyListener(this); - std::vector <ProgressBar*>::const_iterator it, it_end; - for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) + for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), + it_end = mBars.end(); it != it_end; ++it) { ProgressBar *bar = *it; if (!bar) @@ -160,11 +160,14 @@ ProgressBar *MiniStatusWindow::createBar(float progress, int width, int height, void MiniStatusWindow::updateBars() { int x = 0; - std::vector <ProgressBar*>::const_iterator it, it_end; ProgressBar* lastBar = nullptr; - for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) + for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), + it_end = mBars.end(); it != it_end; ++it) + { safeRemove(*it); - for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) + } + for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), + it_end = mBars.end(); it != it_end; ++it) { ProgressBar *bar = *it; if (!bar) @@ -439,10 +442,9 @@ void MiniStatusWindow::loadBars() void MiniStatusWindow::saveBars() { - std::vector <ProgressBar*>::const_iterator it, it_end; int i = 0; - for (it = mBars.begin(), it_end = mBars.end(); - it != it_end; ++it) + for (std::vector <ProgressBar*>::const_iterator it = mBars.begin(), + it_end = mBars.end(); it != it_end; ++it) { ProgressBar *bar = *it; if (!bar->isVisible()) |