summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-22 21:13:07 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-22 21:13:07 +0300
commit1e7d0d8e9873283a0ec09a62e579b718c3c06e51 (patch)
treef54c3317f1d3fe70cfc2634dba7b0a7744270ece /src
parentbda7b8cc0776456e8d392be45be9b74183cf0f37 (diff)
downloadmv-1e7d0d8e9873283a0ec09a62e579b718c3c06e51.tar.gz
mv-1e7d0d8e9873283a0ec09a62e579b718c3c06e51.tar.bz2
mv-1e7d0d8e9873283a0ec09a62e579b718c3c06e51.tar.xz
mv-1e7d0d8e9873283a0ec09a62e579b718c3c06e51.zip
Add chat command for move homunculus to master.
Diffstat (limited to 'src')
-rw-r--r--src/actions/actions.cpp8
-rw-r--r--src/actions/actions.h1
-rw-r--r--src/dyetool/actions/actions.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/gui/popups/popupmenu.cpp8
-rw-r--r--src/input/inputactionmap.h6
-rw-r--r--src/input/pages/move.cpp6
7 files changed, 25 insertions, 6 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index adc84b15f..65de77689 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -84,6 +84,7 @@
#include "net/buysellhandler.h"
#include "net/chathandler.h"
#include "net/download.h"
+#include "net/homunculushandler.h"
#include "net/gamehandler.h"
#include "net/inventoryhandler.h"
#include "net/ipc.h"
@@ -1601,6 +1602,13 @@ impHandler0(mercenaryToMaster)
return true;
}
+impHandler0(homunculusToMaster)
+{
+ if (homunculusHandler != nullptr)
+ homunculusHandler->moveToMaster();
+ return true;
+}
+
impHandler(useItem)
{
const int itemId = atoi(event.args.c_str());
diff --git a/src/actions/actions.h b/src/actions/actions.h
index bfacd0434..107f978aa 100644
--- a/src/actions/actions.h
+++ b/src/actions/actions.h
@@ -102,6 +102,7 @@ namespace Actions
decHandler(uploadLog);
decHandler(mercenaryFire);
decHandler(mercenaryToMaster);
+ decHandler(homunculusToMaster);
decHandler(useItem);
decHandler(useItemInv);
decHandler(invToStorage);
diff --git a/src/dyetool/actions/actions.cpp b/src/dyetool/actions/actions.cpp
index 53294a27f..7dc23fe38 100644
--- a/src/dyetool/actions/actions.cpp
+++ b/src/dyetool/actions/actions.cpp
@@ -98,6 +98,7 @@ impHandlerVoid(uploadServerConfig)
impHandlerVoid(uploadLog)
impHandlerVoid(mercenaryFire)
impHandlerVoid(mercenaryToMaster)
+impHandlerVoid(homunculusToMaster)
impHandlerVoid(useItem)
impHandlerVoid(useItemInv)
impHandlerVoid(invToStorage)
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index a7c737805..6f423207e 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -702,6 +702,7 @@ enumStart(InputAction)
COMMAND_IP_CHECK,
WINDOW_SERVER_INFO,
MERCENARY_TO_MASTER,
+ HOMUNCULUS_TO_MASTER,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index afc74fdd7..15fcc34cb 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -352,9 +352,9 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being)
const HomunculusInfo *const info = PlayerInfo::getHomunculus();
if (info != nullptr)
{
- mBrowserBox->addRow("homunculus to master",
+ mBrowserBox->addRow("/homunculustomaster",
// TRANSLATORS: popup menu item
- // TRANSLATORS: Mercenary move to master
+ // TRANSLATORS: homunculus move to master
_("Move to master"));
// TRANSLATORS: popup menu item
// TRANSLATORS: feed homunculus
@@ -1297,10 +1297,6 @@ void PopupMenu::handleLink(const std::string &link,
if (chat != nullptr)
chatHandler->joinChat(chat, "");
}
- else if (link == "homunculus to master")
- {
- homunculusHandler->moveToMaster();
- }
else if (link == "homunculus feed")
{
homunculusHandler->feed();
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index cfee0245f..dc2a38e7d 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5702,6 +5702,12 @@ static const InputActionData inputActionData
"mercenarytomaster|mercmaster",
UseArgs_false,
Protected_false},
+ {"keyHomunculusToMaster",
+ defaultAction(&Actions::homunculusToMaster),
+ InputCondition::INGAME,
+ "homunculustomaster|homunmaster",
+ UseArgs_false,
+ Protected_false},
};
#undef defaultAction
diff --git a/src/input/pages/move.cpp b/src/input/pages/move.cpp
index 0c0102d9d..8df8a2c5d 100644
--- a/src/input/pages/move.cpp
+++ b/src/input/pages/move.cpp
@@ -92,6 +92,12 @@ SetupActionData setupActionDataMove[] =
},
{
// TRANSLATORS: input action name
+ N_("Move homunculus to master"),
+ InputAction::HOMUNCULUS_TO_MASTER,
+ "",
+ },
+ {
+ // TRANSLATORS: input action name
N_("Move mercenary to master"),
InputAction::MERCENARY_TO_MASTER,
"",