summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/popupmenu.cpp56
-rw-r--r--src/gui/popupmenu.h2
-rw-r--r--src/gui/storagewindow.cpp2
-rw-r--r--src/gui/viewport.cpp4
-rw-r--r--src/gui/viewport.h2
5 files changed, 46 insertions, 20 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index b02e6f2a..c46f673c 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -23,6 +23,7 @@
#include "gui/chat.h"
#include "gui/inventorywindow.h"
+#include "gui/storagewindow.h"
#include "gui/itemamount.h"
#include "gui/widgets/browserbox.h"
@@ -290,6 +291,18 @@ void PopupMenu::handleLink(const std::string &link)
inventoryWindow, mItem);
}
+ else if (link == "store")
+ {
+ new ItemAmountWindow(ItemAmountWindow::StoreAdd,
+ inventoryWindow, mItem);
+ }
+
+ else if (link == "retrieve")
+ {
+ new ItemAmountWindow(ItemAmountWindow::StoreRemove,
+ storageWindow, mItem);
+ }
+
else if (link == "party" && being && being->getType() == Being::PLAYER)
{
player_node->inviteToParty(dynamic_cast<Player*>(being));
@@ -324,31 +337,44 @@ void PopupMenu::handleLink(const std::string &link)
mItem = NULL;
}
-void PopupMenu::showPopup(int x, int y, Item *item)
+void PopupMenu::showPopup(int x, int y, Item *item, bool isInventory)
{
assert(item);
mItem = item;
mBrowserBox->clearRows();
- if (item->isEquipment())
+ if (isInventory)
{
-#ifdef TMWSERV_SUPPORT
- mBrowserBox->addRow(_("@@use|Equip@@"));
-#else
- if (item->isEquipped())
- mBrowserBox->addRow(_("@@use|Unequip@@"));
+ if (item->isEquipment())
+ {
+ if (item->isEquipped())
+ mBrowserBox->addRow(_("@@use|Unequip@@"));
+ else
+ mBrowserBox->addRow(_("@@use|Equip@@"));
+ }
else
- mBrowserBox->addRow(_("@@use|Equip@@"));
-#endif
- }
- else
- mBrowserBox->addRow(_("@@use|Use@@"));
+ mBrowserBox->addRow(_("@@use|Use@@"));
+
+ mBrowserBox->addRow(_("@@drop|Drop@@"));
- mBrowserBox->addRow(_("@@drop|Drop@@"));
#ifdef TMWSERV_SUPPORT
- if (!item->isEquipment())
- mBrowserBox->addRow(_("@@split|Split@@"));
+ if (!item->isEquipment())
+ {
+ mBrowserBox->addRow(_("@@split|Split@@"));
+ }
#endif
+
+ if (player_node->getInStorage())
+ {
+ mBrowserBox->addRow(_("@@store|Store@@"));
+ }
+ }
+ // Assume in storage for now
+ // TODO: make this whole system more flexible, if needed
+ else
+ {
+ mBrowserBox->addRow(_("@@retrieve|Retrieve@@"));
+ }
mBrowserBox->addRow(_("@@chat|Add to chat@@"));
mBrowserBox->addRow("##3---");
mBrowserBox->addRow(_("@@cancel|Cancel@@"));
diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h
index 1caa00af..cd5ddbed 100644
--- a/src/gui/popupmenu.h
+++ b/src/gui/popupmenu.h
@@ -56,7 +56,7 @@ class PopupMenu : public Popup, public LinkHandler
* Shows the related popup menu when right click on the inventory
* at the specified mouse coordinates.
*/
- void showPopup(int x, int y, Item *item);
+ void showPopup(int x, int y, Item *item, bool isInventory);
/**
* Handles link action.
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
index d779800b..f3558830 100644
--- a/src/gui/storagewindow.cpp
+++ b/src/gui/storagewindow.cpp
@@ -178,7 +178,7 @@ void StorageWindow::mouseClicked(gcn::MouseEvent &event)
*/
const int mx = event.getX() + getX();
const int my = event.getY() + getY();
- viewport->showPopup(mx, my, item);
+ viewport->showPopup(mx, my, item, false);
}
}
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 041794c2..f92a81b8 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -449,9 +449,9 @@ void Viewport::mouseReleased(gcn::MouseEvent &event)
mPlayerFollowMouse = false;
}
-void Viewport::showPopup(int x, int y, Item *item)
+void Viewport::showPopup(int x, int y, Item *item, bool isInventory)
{
- mPopupMenu->showPopup(x, y, item);
+ mPopupMenu->showPopup(x, y, item, isInventory);
}
void Viewport::closePopupMenu()
diff --git a/src/gui/viewport.h b/src/gui/viewport.h
index 3dae5a2a..33a2d837 100644
--- a/src/gui/viewport.h
+++ b/src/gui/viewport.h
@@ -106,7 +106,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener,
* Shows a popup for an item.
* TODO Find some way to get rid of Item here
*/
- void showPopup(int x, int y, Item *item);
+ void showPopup(int x, int y, Item *item, bool isInventory = true);
/**
* Closes the popup menu. Needed for when the player dies or switching