From 1e7d0d8e9873283a0ec09a62e579b718c3c06e51 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Jun 2017 21:13:07 +0300 Subject: Add chat command for move homunculus to master. --- src/actions/actions.cpp | 8 ++++++++ src/actions/actions.h | 1 + src/dyetool/actions/actions.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/popups/popupmenu.cpp | 8 ++------ src/input/inputactionmap.h | 6 ++++++ src/input/pages/move.cpp | 6 ++++++ 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 @@ -90,6 +90,12 @@ SetupActionData setupActionDataMove[] = InputAction::PET_MOVE_RIGHT, "", }, + { + // TRANSLATORS: input action name + N_("Move homunculus to master"), + InputAction::HOMUNCULUS_TO_MASTER, + "", + }, { // TRANSLATORS: input action name N_("Move mercenary to master"), -- cgit v1.2.3-60-g2f50