diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-10 01:07:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-10 01:07:30 +0300 |
commit | 8ca5407776fa9c3038b608f9caf401952c2631d6 (patch) | |
tree | 1a30526373487e4c4a18b22a965b75ca369b0fdd /src/actions/commands.cpp | |
parent | e62ca47b5ec9c8e630933a674c1419d911722f85 (diff) | |
download | manaplus-8ca5407776fa9c3038b608f9caf401952c2631d6.tar.gz manaplus-8ca5407776fa9c3038b608f9caf401952c2631d6.tar.bz2 manaplus-8ca5407776fa9c3038b608f9caf401952c2631d6.tar.xz manaplus-8ca5407776fa9c3038b608f9caf401952c2631d6.zip |
Add chat command for move monster in attack list into one position down.
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r-- | src/actions/commands.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 79ed06f3c..d033413bd 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -1897,6 +1897,8 @@ impHandler0(outfitToChat) impHandler(moveAttackUp) { + if (!actorManager) + return false; const std::string args = event.args; const int idx = actorManager->getAttackMobIndex(args); if (idx > 0) @@ -1926,4 +1928,40 @@ impHandler(moveAttackUp) return false; } +impHandler(moveAttackDown) +{ + if (!actorManager) + return false; + const std::string args = event.args; + const int idx = actorManager->getAttackMobIndex(args); + const int size = actorManager->getAttackMobsSize(); + if (idx + 1 < size) + { + 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; + if (it2 == mobs.end()) + break; + + mobs.splice(it, mobs, it2); + actorManager->setAttackMobs(mobs); + actorManager->rebuildAttackMobs(); + break; + } + ++ it; + ++ it2; + } + + if (socialWindow) + socialWindow->updateAttackFilter(); + } + return false; +} + } // namespace Actions |