summaryrefslogtreecommitdiff
path: root/src/gui/specialswindow.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/specialswindow.cpp
parente1a7c1d0ca30c2c4a293ffbff6b9c51c881d23e3 (diff)
downloadmana-client-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.gz
mana-client-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.bz2
mana-client-e7c285e3423ddd660447f6a6fc6bbae25f99f386.tar.xz
mana-client-e7c285e3423ddd660447f6a6fc6bbae25f99f386.zip
Apply C++11 fixits
modernize-loop-convert modernize-deprecated-headers
Diffstat (limited to 'src/gui/specialswindow.cpp')
-rw-r--r--src/gui/specialswindow.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp
index d114d6e3..194e6afe 100644
--- a/src/gui/specialswindow.cpp
+++ b/src/gui/specialswindow.cpp
@@ -49,9 +49,6 @@
#define SPECIALS_WIDTH 200
#define SPECIALS_HEIGHT 32
-class SpecialEntry;
-
-
class SpecialEntry : public Container
{
public:
@@ -127,10 +124,9 @@ void SpecialsWindow::draw(gcn::Graphics *graphics)
bool foundNew = false;
unsigned int found = 0; // number of entries in specialData which match mEntries
- for (auto it = specialData.begin();
- it != specialData.end(); ++it)
+ for (auto &special : specialData)
{
- auto e = mEntries.find(it->first);
+ auto e = mEntries.find(special.first);
if (e == mEntries.end())
{
// found a new special - abort update and rebuild from scratch
@@ -140,7 +136,7 @@ void SpecialsWindow::draw(gcn::Graphics *graphics)
else
{
// update progress bar of special
- e->second->update(it->second.currentMana, it->second.neededMana);
+ e->second->update(special.second.currentMana, special.second.neededMana);
found++;
}
}
@@ -158,25 +154,24 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData)
mEntries.clear();
int vPos = 0; //vertical position of next placed element
- for (auto it = specialData.begin();
- it != specialData.end(); ++it)
+ for (auto special : specialData)
{
- logger->log("Updating special GUI for %d", it->first);
+ logger->log("Updating special GUI for %d", special.first);
- SpecialInfo *info = SpecialDB::get(it->first);
+ SpecialInfo *info = SpecialDB::get(special.first);
if (info)
{
- info->rechargeCurrent = it->second.currentMana;
- info->rechargeNeeded = it->second.neededMana;
+ info->rechargeCurrent = special.second.currentMana;
+ info->rechargeNeeded = special.second.neededMana;
auto* entry = new SpecialEntry(info);
entry->setPosition(0, vPos);
vPos += entry->getHeight() + 3;
add(entry);
- mEntries[it->first] = entry;
+ mEntries[special.first] = entry;
}
else
{
- logger->log("Warning: No info available of special %d", it->first);
+ logger->log("Warning: No info available of special %d", special.first);
}
}
}