summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlue Sans Douze <bluesansdouze@gmail.com>2010-01-14 21:55:56 +0100
committerBlue Sans Douze <bluesansdouze@gmail.com>2010-01-14 21:55:56 +0100
commitc5e241b276bcbf725309360edc2bdf033f49e98e (patch)
treeb697f3565d2b0c22c919b7d2ad65a7db4c07ccf5 /src
parent938e215a848a65281be0fc5cda10dd0872c846a4 (diff)
downloadmana-c5e241b276bcbf725309360edc2bdf033f49e98e.tar.gz
mana-c5e241b276bcbf725309360edc2bdf033f49e98e.tar.bz2
mana-c5e241b276bcbf725309360edc2bdf033f49e98e.tar.xz
mana-c5e241b276bcbf725309360edc2bdf033f49e98e.zip
Auto-store feature
Autostore is a feature that allow you a fast store-retreive by pressing emote key and clicking on the object you want to move. All the stack will be moved that way.
Diffstat (limited to 'src')
-rw-r--r--src/gui/inventorywindow.cpp14
-rw-r--r--src/gui/inventorywindow.h1
-rw-r--r--src/gui/storagewindow.cpp13
3 files changed, 28 insertions, 0 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 80533025..ffff6b1a 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -25,6 +25,7 @@
#include "item.h"
#include "localplayer.h"
#include "units.h"
+#include "keyboardconfig.h"
#include "gui/itemamount.h"
#include "gui/setup.h"
@@ -221,6 +222,19 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
const int my = event.getY() + getY();
viewport->showPopup(mx, my, item);
}
+
+ if (event.getButton() == gcn::MouseEvent::LEFT)
+ {
+ if (storageWindow && keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ {
+ Item *item = mItems->getSelectedItem();
+
+ if(!item)
+ return;
+
+ storageWindow->addStore(item, item->getQuantity());
+ }
+ }
}
void InventoryWindow::keyPressed(gcn::KeyEvent &event)
diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h
index 5117c23f..3a13035c 100644
--- a/src/gui/inventorywindow.h
+++ b/src/gui/inventorywindow.h
@@ -24,6 +24,7 @@
#include "inventory.h"
+#include "gui/storagewindow.h"
#include "gui/widgets/window.h"
#include "net/inventoryhandler.h"
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
index b05c2104..c3b13ef9 100644
--- a/src/gui/storagewindow.cpp
+++ b/src/gui/storagewindow.cpp
@@ -25,6 +25,7 @@
#include "item.h"
#include "localplayer.h"
#include "units.h"
+#include "keyboardconfig.h"
#include "gui/inventorywindow.h"
#include "gui/itemamount.h"
@@ -174,6 +175,18 @@ void StorageWindow::mouseClicked(gcn::MouseEvent &event)
const int my = event.getY() + getY();
viewport->showPopup(mx, my, item, false);
}
+ if (event.getButton() == gcn::MouseEvent::LEFT)
+ {
+ if (keyboard.isKeyActive(keyboard.KEY_EMOTE))
+ {
+ Item *item = mItems->getSelectedItem();
+
+ if(!item)
+ return;
+
+ removeStore(item, item->getQuantity());
+ }
+ }
}
Item *StorageWindow::getSelectedItem() const