summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-26 16:21:43 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-01-29 14:18:06 +0100
commite7c285e3423ddd660447f6a6fc6bbae25f99f386 (patch)
tree1d700f09a5e96a2a0d390af30581097bdec0bf77 /src/gui/viewport.cpp
parente1a7c1d0ca30c2c4a293ffbff6b9c51c881d23e3 (diff)
downloadmana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.gz
mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.bz2
mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.xz
mana-e7c285e3423ddd660447f6a6fc6bbae25f99f386.zip
Apply C++11 fixits
modernize-loop-convert modernize-deprecated-headers
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 3fb11d2c..456196ce 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -238,25 +238,21 @@ void Viewport::draw(gcn::Graphics *gcnGraphics)
}
// Draw player names, speech, and emotion sprite as needed
- const ActorSprites &actors = actorSpriteManager->getAll();
- for (auto it = actors.begin(), it_end = actors.end();
- it != it_end; it++)
+ for (auto actor : actorSpriteManager->getAll())
{
- if ((*it)->getType() == ActorSprite::FLOOR_ITEM)
+ if (actor->getType() == ActorSprite::FLOOR_ITEM)
continue;
- auto *b = static_cast<Being*>(*it);
- b->drawSpeech((int) mPixelViewX, (int) mPixelViewY);
+ auto *being = static_cast<Being*>(actor);
+ being->drawSpeech((int) mPixelViewX, (int) mPixelViewY);
}
if (mDebugFlags & Map::DEBUG_BEING_IDS)
{
graphics->setColor(gcn::Color(255, 0, 255, 255));
- ActorSpritesConstIterator it, it_end;
- const ActorSprites &actors = actorSpriteManager->getAll();
- for (it = actors.begin(), it_end = actors.end(); it != it_end; ++it)
+ for (auto actor : actorSpriteManager->getAll())
{
- auto *being = dynamic_cast<Being*>(*it);
+ auto *being = dynamic_cast<Being*>(actor);
if (!being)
continue;
@@ -382,11 +378,9 @@ void Viewport::_drawDebugPath(Graphics *graphics)
}
// Draw the path debug information for every beings.
- ActorSpritesConstIterator it, it_end;
- const ActorSprites &actors = actorSpriteManager->getAll();
- for (it = actors.begin(), it_end = actors.end(); it != it_end; it++)
+ for (auto actor : actorSpriteManager->getAll())
{
- auto *being = dynamic_cast<Being*>(*it);
+ auto *being = dynamic_cast<Being*>(actor);
if (!being)
continue;
@@ -428,16 +422,16 @@ void Viewport::_drawPath(Graphics *graphics, const Path &path,
{
graphics->setColor(color);
- for (auto i = path.begin(); i != path.end(); ++i)
+ for (auto pos : path)
{
- int squareX = i->x - (int) mPixelViewX;
- int squareY = i->y - (int) mPixelViewY;
+ int squareX = pos.x - (int) mPixelViewX;
+ int squareY = pos.y - (int) mPixelViewY;
graphics->fillRectangle(gcn::Rectangle(squareX - 4, squareY - 4,
8, 8));
graphics->drawText(
- toString(mMap->getMetaTile(i->x / mMap->getTileWidth(),
- i->y / mMap->getTileHeight())->Gcost),
+ toString(mMap->getMetaTile(pos.x / mMap->getTileWidth(),
+ pos.y / mMap->getTileHeight())->Gcost),
squareX + 4, squareY + 12, gcn::Graphics::CENTER);
}
}