summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charcreatedialog.cpp7
-rw-r--r--src/gui/charcreatedialog.h4
-rw-r--r--src/gui/inventorywindow.cpp31
-rw-r--r--src/gui/inventorywindow.h4
-rw-r--r--src/gui/itempopup.cpp23
-rw-r--r--src/gui/outfitwindow.cpp3
-rw-r--r--src/gui/popupmenu.cpp17
-rw-r--r--src/gui/trade.cpp12
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp9
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
11 files changed, 62 insertions, 52 deletions
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index a2cb2efb..2db25a35 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -65,10 +65,10 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
mNameField = new TextField("");
mNameLabel = new Label(_("Name:"));
- // TRANSLATORS: This is a narrow symbol used to denote 'next'.
+ // TRANSLATORS: This is an arrow symbol used to denote 'next'.
// You may change this symbol if your language uses another.
mNextHairColorButton = new Button(_(">"), "nextcolor", this);
- // TRANSLATORS: This is a narrow symbol used to denote 'previous'.
+ // TRANSLATORS: This is an arrow symbol used to denote 'previous'.
// You may change this symbol if your language uses another.
mPrevHairColorButton = new Button(_("<"), "prevcolor", this);
mHairColorLabel = new Label(_("Hair color:"));
@@ -277,7 +277,8 @@ int CharCreateDialog::getDistributedPoints() const
}
void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
- int available, int min, int max)
+ unsigned int available, unsigned int min,
+ unsigned int max)
{
mMaxPoints = available;
diff --git a/src/gui/charcreatedialog.h b/src/gui/charcreatedialog.h
index 018de3f5..d6b6d390 100644
--- a/src/gui/charcreatedialog.h
+++ b/src/gui/charcreatedialog.h
@@ -63,8 +63,8 @@ class CharCreateDialog : public Window, public gcn::ActionListener
void unlock();
void setAttributes(const std::vector<std::string> &labels,
- int available,
- int min, int max);
+ unsigned int available,
+ unsigned int min, unsigned int max);
void setFixedGender(bool fixed, Gender gender = GENDER_FEMALE);
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 5df1d4ba..6ad1b05f 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -97,7 +97,8 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
longestUseString = unequip;
}
- mUseButton = new Button(longestUseString, "use", this);
+ mEquipButton = new Button(_("Equip"), "equip", this);
+ mUseButton = new Button(_("Activate"), "activate", this);
mDropButton = new Button(_("Drop..."), "drop", this);
mSplitButton = new Button(_("Split"), "split", this);
mOutfitButton = new Button(_("Outfits"), "outfit", this);
@@ -111,8 +112,9 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
place(5, 0, mSlotsBar, 2);
place(0, 1, invenScroll, 7).setPadding(3);
place(0, 2, mUseButton);
- place(1, 2, mDropButton);
- place(2, 2, mSplitButton);
+ place(1, 2, mEquipButton);
+ place(2, 2, mDropButton);
+ place(3, 2, mSplitButton);
place(6, 2, mOutfitButton);
updateWeight();
@@ -183,9 +185,11 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
if (!item)
return;
- if (event.getId() == "use")
+ if (event.getId() == "activate")
+ item->doEvent("doUse");
+ else if (event.getId() == "equip")
{
- if (item->isEquipment())
+ if (item->isEquippable())
{
if (item->isEquipped())
item->doEvent("doUnequip");
@@ -193,7 +197,9 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
item->doEvent("doEquip");
}
else
+ {
item->doEvent("doUse");
+ }
}
else if (event.getId() == "drop")
{
@@ -309,25 +315,26 @@ void InventoryWindow::valueChanged(const gcn::SelectionEvent &event)
if (!item || item->getQuantity() == 0)
{
mUseButton->setEnabled(false);
+ mEquipButton->setEnabled(false);
mDropButton->setEnabled(false);
return;
}
- mUseButton->setEnabled(true);
mDropButton->setEnabled(true);
- if (item->isEquipment())
+ if (item->getInfo().getEquippable())
{
if (item->isEquipped())
- mUseButton->setCaption(_("Unequip"));
+ mEquipButton->setCaption(_("Unequip"));
else
- mUseButton->setCaption(_("Equip"));
+ mEquipButton->setCaption(_("Equip"));
+ mEquipButton->setEnabled(true);
}
else
- {
- mUseButton->setCaption(_("Use"));
- }
+ mEquipButton->setEnabled(false);
+
+ mUseButton->setEnabled(item->getInfo().getActivatable());
if (item->getQuantity() > 1)
mDropButton->setCaption(_("Drop..."));
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index af72106b..1b68b897 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -124,8 +124,8 @@ class InventoryWindow : public Window,
std::string mWeight, mSlots;
- gcn::Button *mUseButton, *mDropButton, *mSplitButton, *mOutfitButton,
- *mStoreButton, *mRetrieveButton;
+ gcn::Button *mUseButton, *mEquipButton, *mDropButton, *mSplitButton,
+ *mOutfitButton, *mStoreButton, *mRetrieveButton;
gcn::Label *mWeightLabel, *mSlotsLabel;
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index c926670a..ea33fda3 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -61,12 +61,12 @@ ItemPopup::ItemPopup():
// Item Effect
mItemEffect = new TextBox;
mItemEffect->setEditable(false);
- mItemEffect->setPosition(getPadding(), 2 * fontHeight + 2 * getPadding());
+ mItemEffect->setPosition(getPadding(), (fontHeight << 1) + (getPadding() << 1));
// Item Weight
mItemWeight = new TextBox;
mItemWeight->setEditable(false);
- mItemWeight->setPosition(getPadding(), 3 * fontHeight + 4 * getPadding());
+ mItemWeight->setPosition(getPadding(), fontHeight * 3 + (getPadding() << 2));
mIcon = new Icon(0);
@@ -121,18 +121,27 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage)
mIcon->setImage(0);
}
- mItemType = item.getType();
+ //mItemType = item.getType();
mItemName->setCaption(item.getName());
mItemName->adjustSize();
- mItemName->setForegroundColor(getColor(mItemType));
+ mItemName->setForegroundColor(Theme::UNKNOWN_ITEM); // TODO
mItemName->setPosition(getPadding() + space, getPadding());
- mItemDesc->setTextWrapped(item.getDescription(), 196);
- mItemEffect->setTextWrapped(item.getEffect(), 196);
+#define ITEMPOPUP_WRAP_WIDTH 196
+
+ mItemDesc->setTextWrapped(item.getDescription(), ITEMPOPUP_WRAP_WIDTH);
+ {
+ const std::vector<std::string> &effect = item.getEffect();
+ std::string temp = "";
+ for (std::vector<std::string>::const_iterator it = effect.begin(),
+ it_end = effect.end(); it != it_end; ++it)
+ temp += temp.empty() ? *it : "\n" + *it;
+ mItemEffect->setTextWrapped(temp, ITEMPOPUP_WRAP_WIDTH);
+ }
mItemWeight->setTextWrapped(strprintf(_("Weight: %s"),
Units::formatWeight(item.getWeight()).c_str()),
- 196);
+ ITEMPOPUP_WRAP_WIDTH);
int minWidth = mItemName->getWidth() + space;
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index f16ebd39..7e126dc8 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -40,6 +40,7 @@
#include "net/net.h"
#include "resources/image.h"
+#include "resources/iteminfo.h"
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -170,7 +171,7 @@ void OutfitWindow::wearOutfit(int outfit)
item = PlayerInfo::getInventory()->findItem(mItems[outfit][i]);
if (item && !item->isEquipped() && item->getQuantity())
{
- if (item->isEquipment())
+ if (item->isEquippable())
item->doEvent("doEquip");
}
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 41ecafc9..7a702cc2 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -271,10 +271,10 @@ void PopupMenu::handleLink(const std::string &link)
{
}
- else if (link == "use")
+ else if (link == "activate")
{
assert(mItem);
- if (mItem->isEquipment())
+ if (mItem->isEquippable())
{
if (mItem->isEquipped())
mItem->doEvent("doUnequip");
@@ -282,9 +282,10 @@ void PopupMenu::handleLink(const std::string &link)
mItem->doEvent("doEquip");
}
else
+ {
mItem->doEvent("doUse");
+ }
}
-
else if (link == "chat")
{
if (mItem)
@@ -360,15 +361,15 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
if (isInventory)
{
- if (item->isEquipment())
+ if (item->getInfo().getEquippable())
{
if (item->isEquipped())
- mBrowserBox->addRow(strprintf("@@use|%s@@", _("Unequip")));
+ mBrowserBox->addRow(strprintf("@@equip|%s@@", _("Unequip")));
else
- mBrowserBox->addRow(strprintf("@@use|%s@@", _("Equip")));
+ mBrowserBox->addRow(strprintf("@@equip|%s@@", _("Equip")));
}
- else
- mBrowserBox->addRow(strprintf("@@use|%s@@", _("Use")));
+ if (item->getInfo().getActivatable())
+ mBrowserBox->addRow(strprintf("@@activate|%s@@", _("Activate")));
if (item->getQuantity() > 1)
mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop...")));
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index bfb61c33..37662bef 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -141,18 +141,6 @@ void TradeWindow::addItem(int id, bool own, int quantity)
(own ? mMyInventory : mPartnerInventory)->addItem(id, quantity);
}
-void TradeWindow::addItem(int id, bool own, int quantity, bool equipment)
-{
- if (own)
- {
- mMyInventory->addItem(id, quantity, equipment);
- }
- else
- {
- mPartnerInventory->addItem(id, quantity, equipment);
- }
-}
-
void TradeWindow::changeQuantity(int index, bool own, int quantity)
{
if (own)
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index fbde2c9c..05f34760 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -236,7 +236,7 @@ void ChatTab::chatInput(const std::string &message)
std::string temp = msg.substr(start + 1, end - start - 1);
- const ItemInfo itemInfo = ItemDB::get(temp);
+ const ItemInfo itemInfo = itemDb->get(temp);
if (itemInfo.getId() != 0)
{
msg.insert(end, "@@");
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index a9df95a6..c8c98d0a 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -257,7 +257,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
{
if(event.getClickCount() == 2)
{
- if (item->isEquipment())
+ if (item->getInfo().getEquippable())
{
if (item->isEquipped())
item->doEvent("doUnequip");
@@ -277,7 +277,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
{
if(event.getClickCount() == 2)
{
- if (item->isEquipment())
+ if (item->getInfo().getEquippable())
{
if (item->isEquipped())
item->doEvent("doUnequip");
@@ -285,7 +285,9 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
item->doEvent("doEquip");
}
else
+ {
item->doEvent("doUse");
+ }
}
else
{
@@ -294,7 +296,8 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
itemShortcut->setItemSelected(item->getId());
}
- if (item->isEquipment())
+
+ if (item->getInfo().getEquippable())
outfitWindow->setItemSelected(item->getId());
}
else
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index b7341084..8477225f 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -49,7 +49,7 @@ void ItemLinkHandler::handleLink(const std::string &link)
if (id > 0)
{
- const ItemInfo &itemInfo = ItemDB::get(id);
+ const ItemInfo &itemInfo = itemDb->get(id);
mItemPopup->setItem(itemInfo, true);
if (mItemPopup->isVisible())