git repos / blockattack-game

commit a1e83d35

sago007 · 2016-10-08 17:29
a1e83d355cbb73b5bb01dc18e19fcadc5ee561dd patch · browse files
parent f7573b5973cf946906715561e567063d10665d17

Replaced the ugly old C++03 iterator

Changed files

M source/code/MenuSystem.cpp before
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index ccc216a..6fda7c3 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp
@@ -106,7 +106,7 @@ int Button::getWidth() const {
return standardButton.xsize;
}
-static void drawToScreen(Button &b) {
+static void drawToScreen(const Button &b) {
if (b.marked) {
spriteHolder->GetSprite(menu_marked).Draw(screen, SDL_GetTicks(), b.x, b.y);
}
@@ -119,9 +119,8 @@ static void drawToScreen(Button &b) {
void Menu::drawSelf() {
DrawBackground(screen);
- vector<Button*>::iterator it;
- for (it = buttons.begin(); it < buttons.end(); it++) {
- drawToScreen(**it);
+ for (const Button* b : buttons) {
+ drawToScreen(*b);
}
drawToScreen(exit);
standardButton.thefont->draw(screen, 50, 50, "%s", title.c_str());