diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-10 01:53:49 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-10 01:53:49 +0300 |
commit | 2291f18b6366312916903de6cfe973379ebd536d (patch) | |
tree | 4d3f8ea4fa31f19dd402fc44089b129583a81a4e /src/actions/commands.cpp | |
parent | 5ac88f3197be965804827751e8679cc6dd59b188 (diff) | |
download | mv-2291f18b6366312916903de6cfe973379ebd536d.tar.gz mv-2291f18b6366312916903de6cfe973379ebd536d.tar.bz2 mv-2291f18b6366312916903de6cfe973379ebd536d.tar.xz mv-2291f18b6366312916903de6cfe973379ebd536d.zip |
Add chat command for move monster in priority attack list into one position down.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r-- | src/actions/commands.cpp | 39 |
1 files changed, 39 insertions, 0 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 |