diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/commands.cpp | 39 | ||||
-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 | 42 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 10 |
6 files changed, 54 insertions, 40 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 13b88499b..71dd2e7b4 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1996,6 +1996,45 @@ impHandler(movePriorityAttackUp) socialWindow->updateAttackFilter(); return true; } + return false; +} + +impHandler(movePriorityAttackDown) +{ + if (!actorManager) + return false; + const std::string args = event.args; + const int idx = actorManager + ->getPriorityAttackMobIndex(args); + const int size = actorManager->getPriorityAttackMobsSize(); + if (idx + 1 < size) + { + std::list<std::string> mobs + = actorManager->getPriorityAttackMobs(); + std::list<std::string>::iterator it = mobs.begin(); + std::list<std::string>::iterator it2 = it; + while (it != mobs.end()) + { + if (*it == args) + { + ++ it2; + if (it2 == mobs.end()) + break; + + mobs.splice(it, mobs, it2); + actorManager->setPriorityAttackMobs(mobs); + actorManager->rebuildPriorityAttackMobs(); + 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 26907f7ac..6c2c6cc9d 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -156,6 +156,7 @@ namespace Actions decHandler(moveAttackUp); decHandler(moveAttackDown); decHandler(movePriorityAttackUp); + decHandler(movePriorityAttackDown); } // namespace Actions #undef decHandler diff --git a/src/dyetool/actions/commands.cpp b/src/dyetool/actions/commands.cpp index 87645ed4f..956c5e0ed 100644 --- a/src/dyetool/actions/commands.cpp +++ b/src/dyetool/actions/commands.cpp @@ -156,5 +156,6 @@ impHandlerVoid(outfitToChat) impHandlerVoid(moveAttackUp) impHandlerVoid(moveAttackDown) impHandlerVoid(movePriorityAttackUp) +impHandlerVoid(movePriorityAttackDown) } // namespace Actions diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h index 59d7cf59c..dfff6b401 100644 --- a/src/enums/input/inputaction.h +++ b/src/enums/input/inputaction.h @@ -691,6 +691,7 @@ enumStart(InputAction) MOVE_ATTACK_UP, MOVE_ATTACK_DOWN, MOVE_PRIORITY_ATTACK_UP, + MOVE_PRIORITY_ATTACK_DOWN, TOTAL } enumEnd(InputAction); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index aa5a05625..47ef604be 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -1239,41 +1239,6 @@ void PopupMenu::handleLink(const std::string &link, dialog->setActionEventId("ok"); dialog->addActionListener(&mPlayerListener); } - else if (link == "priority movedown") - { - if (localPlayer && actorManager) - { - const int idx = actorManager - ->getPriorityAttackMobIndex(mName); - const int size = actorManager->getPriorityAttackMobsSize(); - if (idx + 1 < size) - { - std::list<std::string> mobs - = actorManager->getPriorityAttackMobs(); - std::list<std::string>::iterator it = mobs.begin(); - std::list<std::string>::iterator it2 = it; - while (it != mobs.end()) - { - if (*it == mName) - { - ++ it2; - if (it2 == mobs.end()) - break; - - mobs.splice(it, mobs, it2); - actorManager->setPriorityAttackMobs(mobs); - actorManager->rebuildPriorityAttackMobs(); - break; - } - ++ it; - ++ it2; - } - - if (socialWindow) - socialWindow->updateAttackFilter(); - } - } - } else if (link == "items" && being) { if (being == localPlayer) @@ -2075,9 +2040,10 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, } if (idx + 1 < size) { - // TRANSLATORS: popup menu item - // TRANSLATORS: move attack target down - mBrowserBox->addRow("priority movedown", _("Move down")); + mBrowserBox->addRow("/movepriorityattackdown 'NAME'", + // TRANSLATORS: popup menu item + // TRANSLATORS: move attack target down + _("Move down")); } break; } diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 6ea9ea303..a2507f884 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -5626,16 +5626,22 @@ static const InputActionData inputActionData Protected_true}, {"keyMoveAttackDown", defaultAction(&Actions::moveAttackDown), - InputCondition::ENABLED, + InputCondition::INGAME, "attackmovedown|moveattackdown", UseArgs_true, Protected_true}, {"keyMovePriorityAttackUp", defaultAction(&Actions::movePriorityAttackUp), - InputCondition::ENABLED, + InputCondition::INGAME, "attackmovepriorityup|movepriorityattackup", UseArgs_true, Protected_true}, + {"keyMovePriorityAttackDown", + defaultAction(&Actions::movePriorityAttackDown), + InputCondition::INGAME, + "attackmoveprioritydown|movepriorityattackdown", + UseArgs_true, + Protected_true}, }; #undef defaultAction |