summaryrefslogtreecommitdiff
path: root/src/gui/storagewindow.cpp
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-03-26 09:55:21 -0600
committerIra Rice <irarice@gmail.com>2009-03-26 09:55:21 -0600
commitf883ad28b77a499fa66497158db425ce1db50f78 (patch)
tree47156bc38c68130d1fb83f8d83b2543375d17d1a /src/gui/storagewindow.cpp
parent58eb615a589cd6444092f9c928f26210087aa78b (diff)
downloadmana-client-f883ad28b77a499fa66497158db425ce1db50f78.tar.gz
mana-client-f883ad28b77a499fa66497158db425ce1db50f78.tar.bz2
mana-client-f883ad28b77a499fa66497158db425ce1db50f78.tar.xz
mana-client-f883ad28b77a499fa66497158db425ce1db50f78.zip
Some code cleanups (mostly reducing how many calculations need to be
done in certain statements, rearranging arguements to make them look cleaner, or overall making the code slightly more flexible) Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/storagewindow.cpp')
-rw-r--r--src/gui/storagewindow.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
index 5036fc15..eb0cbc12 100644
--- a/src/gui/storagewindow.cpp
+++ b/src/gui/storagewindow.cpp
@@ -48,7 +48,6 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "../utils/stringutils.h"
StorageWindow::StorageWindow(Network *network, int invSize):
Window(_("Storage")),
@@ -72,7 +71,7 @@ StorageWindow::StorageWindow(Network *network, int invSize):
mInvenScroll = new ScrollArea(mItems);
mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mUsedSlots = toString(player_node->getStorage()->getNumberOfSlotsUsed());
+ mUsedSlots = player_node->getStorage()->getNumberOfSlotsUsed();
mSlotsLabel = new Label(_("Slots: "));
@@ -105,14 +104,15 @@ void StorageWindow::logic()
Window::logic();
- if (mUsedSlots != toString(player_node->getStorage()->getNumberOfSlotsUsed()))
+ const int usedSlots = player_node->getInventory()->getNumberOfSlotsUsed();
+
+ if (mUsedSlots != usedSlots)
{
- mUsedSlots = toString(player_node->getStorage()->getNumberOfSlotsUsed());
+ mUsedSlots = usedSlots;
- mSlotsBar->setProgress((float)
- player_node->getStorage()->getNumberOfSlotsUsed() / mMaxSlots);
+ mSlotsBar->setProgress((float) mUsedSlots / mMaxSlots);
- mSlotsBar->setText(strprintf("%s/%d", mUsedSlots.c_str(), mMaxSlots));
+ mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots));
}
}
@@ -164,7 +164,8 @@ void StorageWindow::mouseClicked(gcn::MouseEvent &event)
{
Item *item = mItems->getSelectedItem();
- if (!item) {
+ if (!item)
+ {
mRetrieveButton->setEnabled(false);
return;
}