diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-11 13:56:26 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-11 13:56:26 +0300 |
commit | c5eb5667a14c59eba9590e8f0eff0f58da421046 (patch) | |
tree | b48f417bc120231e676ad3eaeb8d56ce41c89e2f | |
parent | 8f6f916bb53d15dd2b6a466501e50b32f03d7a9d (diff) | |
download | mv-c5eb5667a14c59eba9590e8f0eff0f58da421046.tar.gz mv-c5eb5667a14c59eba9590e8f0eff0f58da421046.tar.bz2 mv-c5eb5667a14c59eba9590e8f0eff0f58da421046.tar.xz mv-c5eb5667a14c59eba9590e8f0eff0f58da421046.zip |
Remove "attack" popup menu handler.
-rw-r--r-- | src/actions/actions.cpp | 16 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 13 |
2 files changed, 18 insertions, 11 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 3ee65a396..03944500d 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -561,8 +561,20 @@ impHandler(attack) return false; Being *target = nullptr; - if (!event.args.empty()) - target = actorManager->findNearestByName(event.args); + std::string args = event.args; + if (!args.empty()) + { + if (args[0] != ':') + { + target = actorManager->findNearestByName(args); + } + else + { + target = actorManager->findBeing(atoi(args.substr(1).c_str())); + if (target && target->getType() != ActorType::Monster) + target = nullptr; + } + } if (!target) target = localPlayer->getTarget(); else diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 4850b2a2c..1ebe7b2af 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -167,7 +167,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBrowserBox->addRow("/trade 'NAME'", _("Trade")); // TRANSLATORS: popup menu item // TRANSLATORS: trade attack player - mBrowserBox->addRow("attack", _("Attack")); + mBrowserBox->addRow("/attack 'NAME'", _("Attack")); // TRANSLATORS: popup menu item // TRANSLATORS: send whisper to player mBrowserBox->addRow("whisper", _("Whisper")); @@ -281,7 +281,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) // Monsters can be attacked // TRANSLATORS: popup menu item // TRANSLATORS: attack monster - mBrowserBox->addRow("attack", _("Attack")); + mBrowserBox->addRow("/attack :'BEINGID'", _("Attack")); if (config.getBoolValue("enableAttackFilter")) { @@ -795,7 +795,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) mBrowserBox->addRow("/trade 'NAME'", _("Trade")); // TRANSLATORS: popup menu item // TRANSLATORS: attack player - mBrowserBox->addRow("attack", _("Attack")); + mBrowserBox->addRow("/attack 'NAME'", _("Attack")); mBrowserBox->addRow("##3---"); // TRANSLATORS: popup menu item // TRANSLATORS: heal player @@ -979,12 +979,7 @@ void PopupMenu::handleLink(const std::string &link, if (actorManager) being = actorManager->findBeing(mBeingId); - if (link == "attack" && being) - { - if (localPlayer) - localPlayer->attack(being, true); - } - else if (link == "heal" && being && being->getType() != ActorType::Monster) + if (link == "heal" && being && being->getType() != ActorType::Monster) { if (actorManager) actorManager->heal(being); |