summaryrefslogtreecommitdiff
path: root/src/gui/popupmenu.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-30 20:51:36 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-08-30 20:51:36 +0200
commitebe29a9410458abac19c4ba10d5dce476e7ca34b (patch)
treebd8d2e2d3fb57822562d5b253a1cfd2057061e39 /src/gui/popupmenu.cpp
parent005a76ce5d539666022c80eb5b0c1dd760db19e7 (diff)
downloadmana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.tar.gz
mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.tar.bz2
mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.tar.xz
mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.zip
Made the popup-menu work again for equip/unequip processes.
I disabled the drop from equipment window since it was more simple to implement, and because it seemed useless or even bad for the user experience to me.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r--src/gui/popupmenu.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 1c2f3b60..fbe3c739 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -32,6 +32,7 @@
#include "playerrelations.h"
#include "gui/chat.h"
+#include "gui/equipmentwindow.h"
#include "gui/inventorywindow.h"
#include "gui/itemamount.h"
@@ -266,15 +267,20 @@ void PopupMenu::handleLink(const std::string &link)
{
}
- else if (link == "activate")
+ else if (link == "activate" || link == "equip" || link == "unequip")
{
assert(mItem);
if (mItem->isEquippable())
{
if (mItem->isEquipped())
- mItem->doEvent(Event::DoUnequip);
+ {
+ PlayerInfo::getEquipment()->triggerUnequip(
+ equipmentWindow->getSelected());
+ }
else
+ {
mItem->doEvent(Event::DoEquip);
+ }
}
else
{
@@ -347,7 +353,7 @@ void PopupMenu::handleLink(const std::string &link)
}
void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
- bool isInventory)
+ bool isInventory, bool canDrop)
{
assert(item);
mItem = item;
@@ -364,17 +370,20 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
if (item->getInfo().getEquippable())
{
if (item->isEquipped())
- mBrowserBox->addRow(strprintf("@@equip|%s@@", _("Unequip")));
+ mBrowserBox->addRow(strprintf("@@unequip|%s@@", _("Unequip")));
else
mBrowserBox->addRow(strprintf("@@equip|%s@@", _("Equip")));
}
if (item->getInfo().getActivatable())
mBrowserBox->addRow(strprintf("@@activate|%s@@", _("Activate")));
- if (item->getQuantity() > 1)
- mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop...")));
- else
- mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop")));
+ if (canDrop)
+ {
+ if (item->getQuantity() > 1)
+ mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop...")));
+ else
+ mBrowserBox->addRow(strprintf("@@drop|%s@@", _("Drop")));
+ }
if (Net::getInventoryHandler()->canSplit(item))
{