summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actionmanager.cpp17
-rw-r--r--src/actionmanager.h1
-rw-r--r--src/gui/setupactiondata.h6
-rw-r--r--src/input/keyboarddata.h9
-rw-r--r--src/input/keydata.h1
5 files changed, 33 insertions, 1 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 8775839ca..1c7dbce14 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -40,6 +40,7 @@
#include "gui/windows/skilldialog.h"
#include "gui/windows/socialwindow.h"
#include "gui/windows/statuswindow.h"
+#include "gui/windows/tradewindow.h"
#include "gui/windows/questswindow.h"
#include "gui/windows/quitdialog.h"
#include "gui/windows/whoisonline.h"
@@ -67,6 +68,7 @@
#include "net/net.h"
#include "net/playerhandler.h"
+#include "net/tradehandler.h"
#include "utils/gettext.h"
@@ -82,6 +84,7 @@
#define impHandler0(name) bool name(const InputEvent &event A_UNUSED)
extern ShortcutWindow *spellShortcutWindow;
+extern std::string tradePartnerName;
extern QuitDialog *quitDialog;
namespace ActionManager
@@ -1189,4 +1192,18 @@ impHandler0(prevCommandsTab)
return false;
}
+impHandler0(openTrade)
+{
+ const Being *const being = player_node->getTarget();
+ if (being && being->getType() == ActorSprite::PLAYER)
+ {
+ Net::getTradeHandler()->request(being);
+ tradePartnerName = being->getName();
+ if (tradeWindow)
+ tradeWindow->clear();
+ return true;
+ }
+ return false;
+}
+
} // namespace ActionManager
diff --git a/src/actionmanager.h b/src/actionmanager.h
index 50a71f67e..ca8c3e2b9 100644
--- a/src/actionmanager.h
+++ b/src/actionmanager.h
@@ -98,6 +98,7 @@ namespace ActionManager
decHandler(prevShortcutsTab);
decHandler(nextCommandsTab);
decHandler(prevCommandsTab);
+ decHandler(openTrade);
decHandler(hideWindows);
decHandler(helpWindowShow);
diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h
index b76ffa696..1b767516d 100644
--- a/src/gui/setupactiondata.h
+++ b/src/gui/setupactiondata.h
@@ -162,6 +162,12 @@ static SetupActionData setupActionData0[] =
},
{
// TRANSLATORS: input action name
+ N_("Open trade window"),
+ Input::KEY_OPEN_TRADE,
+ "",
+ },
+ {
+ // TRANSLATORS: input action name
N_("Change Map View Mode"),
Input::KEY_PATHFIND,
"",
diff --git a/src/input/keyboarddata.h b/src/input/keyboarddata.h
index 87202e8f2..e6bafb61b 100644
--- a/src/input/keyboarddata.h
+++ b/src/input/keyboarddata.h
@@ -2079,7 +2079,14 @@ static const KeyData keyData[Input::KEY_TOTAL] = {
Input::GRP_DEFAULT | Input::GRP_GUI,
&ActionManager::nextCommandsTab,
Input::KEY_NO_VALUE, 50,
- COND_NOINPUT | COND_INGAME}
+ COND_NOINPUT | COND_INGAME},
+ {"keyOpenTrade",
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ INPUT_UNKNOWN, Input::KEY_NO_VALUE,
+ Input::GRP_DEFAULT,
+ &ActionManager::openTrade,
+ Input::KEY_NO_VALUE, 50,
+ COND_GAME | COND_NOTARGET},
};
#endif // INPUT_KEYBOARDDATA_H
diff --git a/src/input/keydata.h b/src/input/keydata.h
index c36a11e7c..2ceb957c5 100644
--- a/src/input/keydata.h
+++ b/src/input/keydata.h
@@ -357,6 +357,7 @@ namespace Input
KEY_NEXT_SHORTCUTS_TAB,
KEY_PREV_COMMANDS_TAB,
KEY_NEXT_COMMANDS_TAB,
+ KEY_OPEN_TRADE,
KEY_TOTAL
};
} // namespace Input