summaryrefslogtreecommitdiff
path: root/src/gui/outfitwindow.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-04 10:57:16 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-10-08 21:15:04 +0200
commite2a8586decf73849300cd3427a30f966360220c7 (patch)
tree6e9e98797b7d8d57a8fec52309d2bc61bae5f6bb /src/gui/outfitwindow.cpp
parente4a44416226eba6f5e594e68a028672c8b8e600b (diff)
downloadmana-e2a8586decf73849300cd3427a30f966360220c7.tar.gz
mana-e2a8586decf73849300cd3427a30f966360220c7.tar.bz2
mana-e2a8586decf73849300cd3427a30f966360220c7.tar.xz
mana-e2a8586decf73849300cd3427a30f966360220c7.zip
Small cleanup in OutfitWindow::load
Based on MV commit db452921bafb2dd322b52c1e5d03e5e713849dd0.
Diffstat (limited to 'src/gui/outfitwindow.cpp')
-rw-r--r--src/gui/outfitwindow.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 5dc05790..77de4b3a 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -38,8 +38,6 @@
#include "utils/gettext.h"
#include "utils/stringutils.h"
-#include <vector>
-
OutfitWindow::OutfitWindow():
Window(_("Outfits"))
{
@@ -86,15 +84,11 @@ void OutfitWindow::load()
std::string buf;
std::stringstream ss(outfit);
- std::vector<int> tokens;
-
- while (ss >> buf)
- tokens.push_back(atoi(buf.c_str()));
-
- for (int i = 0; i < (int)tokens.size(); i++)
+ for (size_t i = 0; (ss >> buf) && i < OUTFIT_ITEM_COUNT; i++)
{
- mItems[o][i] = tokens[i];
+ mItems[o][i] = atoi(buf.c_str());
}
+
mItemsUnequip[o] = config.getValue("OutfitUnequip" + toString(o), true);
}
}
@@ -199,8 +193,7 @@ void OutfitWindow::draw(gcn::Graphics *graphics)
if (item)
{
// Draw item icon.
- Image* image = item->getImage();
- if (image)
+ if (Image *image = item->getImage())
{
g->drawImage(image, itemX, itemY);
}
@@ -209,8 +202,7 @@ void OutfitWindow::draw(gcn::Graphics *graphics)
if (mItemMoved)
{
// Draw the item image being dragged by the cursor.
- Image* image = mItemMoved->getImage();
- if (image)
+ if (Image *image = mItemMoved->getImage())
{
const int tPosX = mCursorPosX - (image->getWidth() / 2);
const int tPosY = mCursorPosY - (image->getHeight() / 2);