summaryrefslogtreecommitdiff
path: root/src/gui/outfitwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-17 16:34:36 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-17 16:34:36 +0300
commitc6c4eef4e49bb4de90845408af9f642a1a4e224b (patch)
tree81d192e85b3c075cb2e52671bea4c3c0499dc3f2 /src/gui/outfitwindow.cpp
parent093e392dd84c920d26bca17d48ac6611393d087c (diff)
downloadmv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.gz
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.bz2
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.tar.xz
mv-c6c4eef4e49bb4de90845408af9f642a1a4e224b.zip
Improve size calculations.
Diffstat (limited to 'src/gui/outfitwindow.cpp')
-rw-r--r--src/gui/outfitwindow.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index fafb69896..2127bc6cf 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -149,13 +149,12 @@ void OutfitWindow::load(bool oldConfig)
while (ss >> buf)
tokens.push_back(atoi(buf.c_str()));
- for (int i = 0; i < static_cast<int>(tokens.size())
- && i < OUTFIT_ITEM_COUNT; i++)
+ for (size_t i = 0, sz = tokens.size();
+ i < sz && i < OUTFIT_ITEM_COUNT; i++)
{
mItems[o][i] = tokens[i];
}
-
outfit = cfg->getValue("OutfitColor" + toString(o), "1");
std::stringstream ss2(outfit);
@@ -165,8 +164,8 @@ void OutfitWindow::load(bool oldConfig)
while (ss2 >> buf)
tokens2.push_back(static_cast<unsigned char>(atoi(buf.c_str())));
- for (int i = 0; i < static_cast<int>(tokens2.size())
- && i < OUTFIT_ITEM_COUNT; i++)
+ for (size_t i = 0, sz = tokens2.size();
+ i < sz && i < OUTFIT_ITEM_COUNT; i++)
{
mItemColors[o][i] = tokens2[i];
}
@@ -497,19 +496,20 @@ void OutfitWindow::unequipNotInOutfit(int outfit)
for (unsigned i = 0; i < inventory->getSize(); i++)
{
- if (inventory->getItem(i) && inventory->getItem(i)->isEquipped())
+ Item *item = inventory->getItem(i);
+ if (item && item->isEquipped())
{
bool found = false;
for (unsigned f = 0; f < OUTFIT_ITEM_COUNT; f++)
{
- if (inventory->getItem(i)->getId() == mItems[outfit][f])
+ if (item->getId() == mItems[outfit][f])
{
found = true;
break;
}
}
if (!found)
- Net::getInventoryHandler()->unequipItem(inventory->getItem(i));
+ Net::getInventoryHandler()->unequipItem(item);
}
}
}
@@ -603,7 +603,7 @@ void OutfitWindow::copyFromEquiped(int dst)
int outfitCell = 0;
- for (unsigned i = 0; i < inventory->getSize(); i++)
+ for (unsigned i = 0, sz = inventory->getSize(); i < sz; i++)
{
const Item *item = inventory->getItem(i);
if (item && item->isEquipped())