From 00083cc82fdd40870f517d6954fe3b28cea72f65 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 27 Jul 2018 22:59:31 +0300 Subject: Send talk request from context menu by being id. --- src/gui/popups/popupmenu.cpp | 2 +- src/progs/manaplus/actions/actions.cpp | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 9e9e9d5d8..03398c6b5 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -329,7 +329,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) { // TRANSLATORS: popup menu item // TRANSLATORS: talk with npc - mBrowserBox->addRow("/talk 'NAME'", _("Talk")); + mBrowserBox->addRow("/talk :'BEINGID'", _("Talk")); #ifdef TMWA_SUPPORT if (Net::getNetworkType() != ServerType::TMWATHENA) #endif diff --git a/src/progs/manaplus/actions/actions.cpp b/src/progs/manaplus/actions/actions.cpp index 5b5a00a05..9c0188d20 100644 --- a/src/progs/manaplus/actions/actions.cpp +++ b/src/progs/manaplus/actions/actions.cpp @@ -825,7 +825,19 @@ impHandler(sell) impHandler(talk) { - Being *being = findBeing(event.args, true); + const std::string args = event.args; + Being *being = nullptr; + + if (!args.empty() && args[0] == ':') + { + being = actorManager->findBeing(fromInt(atoi( + args.substr(1).c_str()), BeingId)); + } + else + { + being = findBeing(args, true); + } + if (being == nullptr) return false; -- cgit v1.2.3-60-g2f50