summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-02-24 03:40:23 +0200
committerAndrei Karas <akaras@inbox.ru>2011-02-24 03:40:23 +0200
commit473dc9b1949ba7c51b59146815969b723a748d6d (patch)
tree3faf602e81cd0b3246ba0d39a2b30a8108c10e27 /src/gui
parent595a3957e0aa94ca2036055874e03a6d05f67114 (diff)
downloadmv-473dc9b1949ba7c51b59146815969b723a748d6d.tar.gz
mv-473dc9b1949ba7c51b59146815969b723a748d6d.tar.bz2
mv-473dc9b1949ba7c51b59146815969b723a748d6d.tar.xz
mv-473dc9b1949ba7c51b59146815969b723a748d6d.zip
Add to item context menu "add to trade" items.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/popupmenu.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 8dc392efc..693ee0f70 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -866,6 +866,31 @@ void PopupMenu::handleLink(const std::string &link,
mItem->getInvIndex(), mItem->getQuantity(),
Inventory::STORAGE);
}
+ else if (link == "addtrade" && mItem)
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd,
+ tradeWindow, mItem);
+ }
+ else if (link == "addtrade 10" && mItem)
+ {
+ if (tradeWindow)
+ {
+ int cnt = 10;
+ if (cnt > mItem->getQuantity())
+ cnt = mItem->getQuantity();
+ tradeWindow->tradeItem(mItem, cnt);
+ }
+ }
+ else if (link == "addtrade half" && mItem)
+ {
+ if (tradeWindow)
+ tradeWindow->tradeItem(mItem, mItem->getQuantity() / 2);
+ }
+ else if (link == "addtrade all" && mItem)
+ {
+ if (tradeWindow)
+ tradeWindow->tradeItem(mItem, mItem->getQuantity());
+ }
else if (link == "retrieve" && mItem)
{
ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove, mWindow,
@@ -1092,6 +1117,23 @@ void PopupMenu::showPopup(Window *parent, int x, int y, Item *item,
if (isInventory)
{
+ if (tradeWindow)
+ {
+ mBrowserBox->addRow(strprintf("@@addtrade|%s@@", _("Add to trade")));
+ if (cnt > 1)
+ {
+ if (cnt > 10)
+ {
+ mBrowserBox->addRow(strprintf("@@addtrade 10|%s@@",
+ _("Add to trade 10")));
+ }
+ mBrowserBox->addRow(strprintf("@@addtrade half|%s@@",
+ _("Add to trade half")));
+ mBrowserBox->addRow(strprintf("@@addtrade all|%s@@",
+ _("Add to trade all")));
+ }
+ mBrowserBox->addRow("##3---");
+ }
if (InventoryWindow::isStorageActive())
{
mBrowserBox->addRow(strprintf("@@store|%s@@", _("Store")));