diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-09 01:51:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-09 01:51:04 +0300 |
commit | cf61a24f6551fd4d4d9c61b085f389c0f83e7517 (patch) | |
tree | f93cf82192f835cbfc4d1b506677bb9f05bd168c | |
parent | 899ad3c232a1d60111b646637a53698234cd4eea (diff) | |
download | manaplus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.tar.gz manaplus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.tar.bz2 manaplus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.tar.xz manaplus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.zip |
allow select unselectable npc if mod key pressed.
-rw-r--r-- | src/actormanager.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index a056fd5fc..9661dc2fe 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -37,6 +37,8 @@ #include "gui/windows/equipmentwindow.h" #include "gui/windows/socialwindow.h" +#include "input/inputmanager.h" + #include "utils/checkutils.h" #include "utils/gettext.h" @@ -327,6 +329,7 @@ Being *ActorManager::findBeingByPixel(const int x, const int y, return nullptr; const bool targetDead = mTargetDeadPlayers; + const bool modActive = inputManager.isActionActive(Input::KEY_STOP_ATTACK); if (mExtMouseTargeting) { @@ -360,8 +363,11 @@ Being *ActorManager::findBeingByPixel(const int x, const int y, Being *const being = static_cast<Being*>(*it); - if (being->getInfo() && !being->getInfo()->isTargetSelection()) + if (being->getInfo() && !(being->getInfo()->isTargetSelection() + || modActive)) + { continue; + } if ((being->isAlive() || (targetDead && being->getType() == Being::PLAYER)) @@ -406,8 +412,11 @@ Being *ActorManager::findBeingByPixel(const int x, const int y, Being *const being = static_cast<Being*>(*it); - if (being->getInfo() && !being->getInfo()->isTargetSelection()) + if (being->getInfo() && !(being->getInfo()->isTargetSelection() + || modActive)) + { continue; + } if ((being->getPixelX() - mapTileSize / 2 <= x) && (being->getPixelX() + mapTileSize / 2 > x) && @@ -430,6 +439,7 @@ void ActorManager::findBeingsByPixel(std::vector<ActorSprite*> &beings, const int xtol = mapTileSize / 2; const int uptol = mapTileSize; + const bool modActive = inputManager.isActionActive(Input::KEY_STOP_ATTACK); for_actors { @@ -442,7 +452,7 @@ void ActorManager::findBeingsByPixel(std::vector<ActorSprite*> &beings, const Being *const being = dynamic_cast<const Being*>(*it); if (being && being->getInfo() - && !being->getInfo()->isTargetSelection()) + && !(being->getInfo()->isTargetSelection() || modActive)) { continue; } @@ -879,6 +889,7 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, const bool filtered = config.getBoolValue("enableAttackFilter") && type == Being::MONSTER; + const bool modActive = inputManager.isActionActive(Input::KEY_STOP_ATTACK); bool ignoreDefault = false; if (filtered) @@ -935,8 +946,11 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, } } - if (being->getInfo() && !being->getInfo()->isTargetSelection()) + if (being->getInfo() + && !(being->getInfo()->isTargetSelection() || modActive)) + { continue; + } if (validateBeing(aroundBeing, being, type, nullptr, maxDist)) { @@ -1029,8 +1043,11 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, } } - if (being->getInfo() && !being->getInfo()->isTargetSelection()) + if (being->getInfo() + && !(being->getInfo()->isTargetSelection() || modActive)) + { continue; + } const bool valid = validateBeing(aroundBeing, being, type, excluded, 50); |