From 23af9b972ec8d4a1094aadf0d0171f16d82a7fcb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Jan 2016 16:23:45 +0300 Subject: Improve undress popup menu item. --- src/actions/actions.cpp | 19 +++++++++++++++++-- src/gui/popups/popupmenu.cpp | 6 +----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index eb6404d37..77da32cd4 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -1155,9 +1155,24 @@ impHandler(undress) if (!actorManager || !localPlayer) return false; + const std::string args = event.args; + Being *target = nullptr; - if (!event.args.empty()) - target = actorManager->findNearestByName(event.args); + if (!args.empty()) + { + if (args[0] == ':') + { + target = actorManager->findBeing(fromInt(atoi( + args.substr(1).c_str()), BeingId)); + if (target && target->getType() == ActorType::Monster) + target = nullptr; + } + else + { + target = actorManager->findNearestByName(event.args); + } + } + if (!target) target = localPlayer->getTarget(); if (target && beingHandler) diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index d1e23b558..74908fd98 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1078,10 +1078,6 @@ void PopupMenu::handleLink(const std::string &link, { CREATEWIDGET(TextCommandEditor, mSpell); } - else if (link == "undress" && being) - { - beingHandler->undress(being); - } else if (link == "addcomment" && !mNick.empty()) { TextDialog *const dialog = CREATEWIDGETR(TextDialog, @@ -2593,7 +2589,7 @@ void PopupMenu::addPlayerMisc() mBrowserBox->addRow("items", _("Show Items")); // TRANSLATORS: popup menu item // TRANSLATORS: undress player - mBrowserBox->addRow("undress", _("Undress")); + mBrowserBox->addRow("/undress :'BEINGID'", _("Undress")); // TRANSLATORS: popup menu item // TRANSLATORS: add comment to player mBrowserBox->addRow("addcomment", _("Add comment")); -- cgit v1.2.3-70-g09d2