diff options
-rw-r--r-- | src/actions/commands.cpp | 31 | ||||
-rw-r--r-- | src/actions/commands.h | 1 | ||||
-rw-r--r-- | src/dyetool/actions/commands.cpp | 1 | ||||
-rw-r--r-- | src/enums/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 32 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 8 |
6 files changed, 42 insertions, 32 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 35fd376cc..79ed06f3c 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1895,4 +1895,35 @@ impHandler0(outfitToChat) return true; } +impHandler(moveAttackUp) +{ + const std::string args = event.args; + const int idx = actorManager->getAttackMobIndex(args); + if (idx > 0) + { + std::list<std::string> mobs + = actorManager->getAttackMobs(); + std::list<std::string>::iterator it = mobs.begin(); + std::list<std::string>::iterator it2 = it; + while (it != mobs.end()) + { + if (*it == args) + { + -- it2; + mobs.splice(it2, mobs, it); + actorManager->setAttackMobs(mobs); + actorManager->rebuildAttackMobs(); + break; + } + ++ it; + ++ it2; + } + + if (socialWindow) + socialWindow->updateAttackFilter(); + return true; + } + return false; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 6295b7264..6b97f295e 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -153,6 +153,7 @@ namespace Actions decHandler(partyExpShare); decHandler(partyAutoItemShare); decHandler(outfitToChat); + decHandler(moveAttackUp); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index b0d90de6a..37076648f 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -153,5 +153,6 @@ impHandlerVoid(partyItemShare) impHandlerVoid(partyExpShare) impHandlerVoid(partyAutoItemShare) impHandlerVoid(outfitToChat) +impHandlerVoid(moveAttackUp) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 5fc37aa1f..6eb6c84f5 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -688,6 +688,7 @@ enumStart(InputAction) COPY_OUTFIT_TO_CHAT, COMMAND_TRANSLATE, COMMAND_SEND_GUI_KEY, + MOVE_ATTACK_UP, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index ff2b7cfa6..cdc6e7494 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1239,36 +1239,6 @@ void PopupMenu::handleLink(const std::string &link, dialog->setActionEventId("ok"); dialog->addActionListener(&mPlayerListener); } - else if (link == "attack moveup") - { - if (actorManager) - { - const int idx = actorManager->getAttackMobIndex(mName); - if (idx > 0) - { - std::list<std::string> mobs - = actorManager->getAttackMobs(); - std::list<std::string>::iterator it = mobs.begin(); - std::list<std::string>::iterator it2 = it; - while (it != mobs.end()) - { - if (*it == mName) - { - -- it2; - mobs.splice(it2, mobs, it); - actorManager->setAttackMobs(mobs); - actorManager->rebuildAttackMobs(); - break; - } - ++ it; - ++ it2; - } - - if (socialWindow) - socialWindow->updateAttackFilter(); - } - } - } else if (link == "priority moveup") { if (actorManager) @@ -2146,7 +2116,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, { // TRANSLATORS: popup menu item // TRANSLATORS: move attack target up - mBrowserBox->addRow("attack moveup", _("Move up")); + mBrowserBox->addRow("/moveattackup 'NAME'", _("Move up")); } if (idx + 1 < size) { diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index f4d8f5739..d368ff911 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5616,7 +5616,13 @@ static const InputActionData inputActionData defaultAction(&Actions::sendGuiKey), InputCondition::ENABLED, "guikey|sendguikey", - UseArgs_false, + UseArgs_true, + Protected_true}, + {"keyMoveAttackUp", + defaultAction(&Actions::moveAttackUp), + InputCondition::ENABLED, + "attackmoveup|moveattackup", + UseArgs_true, Protected_true}, }; |