diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-24 22:49:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-24 22:49:20 +0300 |
commit | 84d56b88a03054d35b84dc1ecbd7ad4614f8ac86 (patch) | |
tree | a6de73a2a93ac287413917c1ba540dff6f65da5d /src/actormanager.cpp | |
parent | 0a4da74459471686e153b600253f12706d0ce8de (diff) | |
download | manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.tar.gz manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.tar.bz2 manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.tar.xz manaverse-84d56b88a03054d35b84dc1ecbd7ad4614f8ac86.zip |
Add new action for select closest monster without filters and sorting.
By default unassigned.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r-- | src/actormanager.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 36fdf7c93..4e4cf0655 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -833,25 +833,36 @@ Being *ActorManager::findNearestLivingBeing(const int x, const int y, { const int maxDist = maxTileDist * mapTileSize; - return findNearestLivingBeing(nullptr, maxDist, type, x, y, excluded); + return findNearestLivingBeing(nullptr, maxDist, + type, + x, y, + excluded, + true); } Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, const int maxDist, - const ActorType::Type type) const + const ActorType::Type type, + const bool allowSort) const { if (!aroundBeing) return nullptr; - return findNearestLivingBeing(aroundBeing, maxDist, type, - aroundBeing->getTileX(), aroundBeing->getTileY(), aroundBeing); + return findNearestLivingBeing(aroundBeing, + maxDist, + type, + aroundBeing->getTileX(), + aroundBeing->getTileY(), + aroundBeing, + allowSort); } Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, int maxDist, const ActorType::Type &type, const int x, const int y, - const Being *const excluded) const + const Being *const excluded, + const bool allowSort) const { if (!aroundBeing || !player_node) return nullptr; @@ -874,11 +885,13 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, maxDist = maxDist * maxDist; - const bool cycleSelect = (mCyclePlayers && type == ActorType::PLAYER) + const bool cycleSelect = allowSort + && ((mCyclePlayers && type == ActorType::PLAYER) || (mCycleMonsters && type == ActorType::MONSTER) - || (mCycleNPC && type == ActorType::NPC); + || (mCycleNPC && type == ActorType::NPC)); - const bool filtered = config.getBoolValue("enableAttackFilter") + const bool filtered = allowSort + && config.getBoolValue("enableAttackFilter") && type == ActorType::MONSTER; const bool modActive = inputManager.isActionActive( InputAction::STOP_ATTACK); |