diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-10 01:21:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-10 01:21:18 +0300 |
commit | 5ac88f3197be965804827751e8679cc6dd59b188 (patch) | |
tree | b1b1852ba9c386029cdcc4128826d1bea4f955a9 /src/actions | |
parent | 8ca5407776fa9c3038b608f9caf401952c2631d6 (diff) | |
download | manaplus-5ac88f3197be965804827751e8679cc6dd59b188.tar.gz manaplus-5ac88f3197be965804827751e8679cc6dd59b188.tar.bz2 manaplus-5ac88f3197be965804827751e8679cc6dd59b188.tar.xz manaplus-5ac88f3197be965804827751e8679cc6dd59b188.zip |
Add chat command for move monster in priority attack list into one position up.
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/commands.cpp | 34 | ||||
-rw-r--r-- | src/actions/commands.h | 1 |
2 files changed, 35 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index d033413bd..13b88499b 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1960,8 +1960,42 @@ impHandler(moveAttackDown) if (socialWindow) socialWindow->updateAttackFilter(); + return true; } return false; } +impHandler(movePriorityAttackUp) +{ + if (!actorManager) + return false; + const std::string args = event.args; + const int idx = actorManager-> + getPriorityAttackMobIndex(args); + if (idx > 0) + { + 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; + mobs.splice(it2, mobs, it); + actorManager->setPriorityAttackMobs(mobs); + actorManager->rebuildPriorityAttackMobs(); + break; + } + ++ it; + ++ it2; + } + + if (socialWindow) + socialWindow->updateAttackFilter(); + return true; + } +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 5340f1b5b..26907f7ac 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -155,6 +155,7 @@ namespace Actions decHandler(outfitToChat); decHandler(moveAttackUp); decHandler(moveAttackDown); + decHandler(movePriorityAttackUp); } // namespace Actions #undef decHandler |