From bda7b8cc0776456e8d392be45be9b74183cf0f37 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 22 Jun 2017 20:43:46 +0300 Subject: Add chat command for move mercenary to master. --- src/actions/actions.cpp | 7 +++++++ src/actions/actions.h | 1 + src/dyetool/actions/actions.cpp | 1 + src/enums/input/inputaction.h | 1 + src/gui/popups/popupmenu.cpp | 6 +----- src/input/inputactionmap.h | 6 ++++++ src/input/pages/move.cpp | 6 ++++++ 7 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index f122a5c39..adc84b15f 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1594,6 +1594,13 @@ impHandler0(mercenaryFire) return true; } +impHandler0(mercenaryToMaster) +{ + if (mercenaryHandler != nullptr) + mercenaryHandler->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 2fed641aa..bfacd0434 100644 --- a/src/actions/actions.h +++ b/src/actions/actions.h @@ -101,6 +101,7 @@ namespace Actions decHandler(uploadServerConfig); decHandler(uploadLog); decHandler(mercenaryFire); + decHandler(mercenaryToMaster); decHandler(useItem); decHandler(useItemInv); decHandler(invToStorage); diff --git a/src/dyetool/actions/actions.cpp b/src/dyetool/actions/actions.cpp index abf66c436..53294a27f 100644 --- a/src/dyetool/actions/actions.cpp +++ b/src/dyetool/actions/actions.cpp @@ -97,6 +97,7 @@ impHandlerVoid(uploadConfig) impHandlerVoid(uploadServerConfig) impHandlerVoid(uploadLog) impHandlerVoid(mercenaryFire) +impHandlerVoid(mercenaryToMaster) impHandlerVoid(useItem) impHandlerVoid(useItemInv) impHandlerVoid(invToStorage) diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 0a0311114..a7c737805 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -701,6 +701,7 @@ enumStart(InputAction) COMMAND_RECALL_PC, COMMAND_IP_CHECK, WINDOW_SERVER_INFO, + MERCENARY_TO_MASTER, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 9e394fabb..afc74fdd7 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -338,7 +338,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) case ActorType::Mercenary: // TRANSLATORS: popup menu item // TRANSLATORS: Mercenary move to master - mBrowserBox->addRow("mercenary to master", _("Move to master")); + mBrowserBox->addRow("/mercenarytomaster", _("Move to master")); addGmCommands(); mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item @@ -1297,10 +1297,6 @@ void PopupMenu::handleLink(const std::string &link, if (chat != nullptr) chatHandler->joinChat(chat, ""); } - else if (link == "mercenary to master") - { - mercenaryHandler->moveToMaster(); - } else if (link == "homunculus to master") { homunculusHandler->moveToMaster(); diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 0de10a4e4..cfee0245f 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5696,6 +5696,12 @@ static const InputActionData inputActionData "serverinfo|infoserver", UseArgs_false, Protected_false}, + {"keyMercenaryToMaster", + defaultAction(&Actions::mercenaryToMaster), + InputCondition::INGAME, + "mercenarytomaster|mercmaster", + UseArgs_false, + Protected_false}, }; #undef defaultAction diff --git a/src/input/pages/move.cpp b/src/input/pages/move.cpp index bbee36954..0c0102d9d 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 mercenary to master"), + InputAction::MERCENARY_TO_MASTER, + "", + }, { // TRANSLATORS: input action name N_("Move to navigation point shortcuts"), -- cgit v1.2.3-70-g09d2