summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-09 01:51:04 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-09 01:51:04 +0300
commitcf61a24f6551fd4d4d9c61b085f389c0f83e7517 (patch)
treef93cf82192f835cbfc4d1b506677bb9f05bd168c
parent899ad3c232a1d60111b646637a53698234cd4eea (diff)
downloadplus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.tar.gz
plus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.tar.bz2
plus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.tar.xz
plus-cf61a24f6551fd4d4d9c61b085f389c0f83e7517.zip
allow select unselectable npc if mod key pressed.
-rw-r--r--src/actormanager.cpp27
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);