summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index a4042ae2..61cb18fb 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -1,10 +1,9 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Legend of Mazzeroth.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,6 +32,8 @@
#include "../graphics.h"
+#include "../units.h"
+
#include "../resources/iteminfo.h"
#include "../utils/gettext.h"
@@ -49,7 +50,7 @@ ItemPopup::ItemPopup():
mItemName->setPosition(2, 2);
// Item Description
- mItemDesc = new TextBox();
+ mItemDesc = new TextBox;
mItemDesc->setEditable(false);
mItemDescScroll = new ScrollArea(mItemDesc);
@@ -60,7 +61,7 @@ ItemPopup::ItemPopup():
mItemDescScroll->setPosition(2, getFont()->getHeight());
// Item Effect
- mItemEffect = new TextBox();
+ mItemEffect = new TextBox;
mItemEffect->setEditable(false);
mItemEffectScroll = new ScrollArea(mItemEffect);
@@ -71,7 +72,7 @@ ItemPopup::ItemPopup():
mItemEffectScroll->setPosition(2, (2 * getFont()->getHeight()) + 5);
// Item Weight
- mItemWeight = new TextBox();
+ mItemWeight = new TextBox;
mItemWeight->setEditable(false);
mItemWeightScroll = new ScrollArea(mItemWeight);
@@ -107,8 +108,8 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemName->setWidth(boldFont->getWidth(item.getName()));
mItemDesc->setTextWrapped(item.getDescription(), 196);
mItemEffect->setTextWrapped(item.getEffect(), 196);
- mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) +
- _(" grams"), 196);
+ mItemWeight->setTextWrapped(_("Weight: ") +
+ Units::formatWeight(item.getWeight()), 196);
mItemType = item.getType();
int minWidth = mItemName->getWidth();
@@ -216,9 +217,9 @@ unsigned int ItemPopup::getNumRows()
void ItemPopup::view(int x, int y)
{
if (graphics->getWidth() < (x + getWidth() + 5))
- x = graphics->getWidth() - getWidth();
+ x = graphics->getWidth() - getWidth();
if ((y - getHeight() - 10) < 0)
- y = 0;
+ y = 0;
else
y = y - getHeight() - 10;
setPosition(x, y);