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/equipmentwindow.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/equipmentwindow.cpp')
-rw-r--r-- | src/gui/equipmentwindow.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 7b77c8de0..c3610ea0b 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -143,10 +143,8 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) int i = 0; const int fontHeight = getFont()->getHeight(); - std::vector<EquipmentBox*>::const_iterator it; - std::vector<EquipmentBox*>::const_iterator it_end = mBoxes.end(); - - for (it = mBoxes.begin(); it != it_end; ++ it, ++ i) + for (std::vector<EquipmentBox*>::const_iterator it = mBoxes.begin(), + it_end = mBoxes.end(); it != it_end; ++ it, ++ i) { EquipmentBox *box = *it; if (!box) @@ -214,11 +212,10 @@ Item *EquipmentWindow::getItem(int x, int y) const if (!mEquipment) return nullptr; - std::vector<EquipmentBox*>::const_iterator it; - std::vector<EquipmentBox*>::const_iterator it_end = mBoxes.end(); int i = 0; - for (it = mBoxes.begin(); it != it_end; ++ it, ++ i) + for (std::vector<EquipmentBox*>::const_iterator it = mBoxes.begin(), + it_end = mBoxes.end(); it != it_end; ++ it, ++ i) { EquipmentBox *box = *it; if (!box) @@ -247,11 +244,10 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) if (mForing) return; // Checks if any of the presses were in the equip boxes. - std::vector<EquipmentBox*>::const_iterator it; - std::vector<EquipmentBox*>::const_iterator it_end = mBoxes.end(); int i = 0; - for (it = mBoxes.begin(); it != it_end; ++ it, ++ i) + for (std::vector<EquipmentBox*>::const_iterator it = mBoxes.begin(), + it_end = mBoxes.end(); it != it_end; ++ it, ++ i) { EquipmentBox *box = *it; if (!box) |