summaryrefslogtreecommitdiff
path: root/src/actorspritemanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-14 19:37:45 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-14 19:38:46 +0300
commitb37522537cd7049e82172fbae87b4c240f80b07a (patch)
treeb94f6812b147e1d2847ee0f3161938e5ef621256 /src/actorspritemanager.cpp
parentfe7a1342dc71a412a177a69b022ac1d1cc1fbdc6 (diff)
downloadManaVerse-b37522537cd7049e82172fbae87b4c240f80b07a.tar.gz
ManaVerse-b37522537cd7049e82172fbae87b4c240f80b07a.tar.bz2
ManaVerse-b37522537cd7049e82172fbae87b4c240f80b07a.tar.xz
ManaVerse-b37522537cd7049e82172fbae87b4c240f80b07a.zip
Add npc cycle select.
Diffstat (limited to 'src/actorspritemanager.cpp')
-rw-r--r--src/actorspritemanager.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index 61ca20a79..3206fe36a 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -191,6 +191,7 @@ ActorSpriteManager::ActorSpriteManager() :
mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")),
mCyclePlayers(config.getBoolValue("cyclePlayers")),
mCycleMonsters(config.getBoolValue("cycleMonsters")),
+ mCycleNPC(config.getBoolValue("cycleNPC")),
mExtMouseTargeting(config.getBoolValue("extMouseTargeting"))
{
config.addListener("targetDeadPlayers", this);
@@ -861,10 +862,11 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
maxDist = maxDist * maxDist;
bool cycleSelect = (mCyclePlayers && type == Being::PLAYER)
- || (mCycleMonsters && type == Being::MONSTER);
+ || (mCycleMonsters && type == Being::MONSTER)
+ || (mCycleNPC && type == Being::NPC);
bool filtered = config.getBoolValue("enableAttackFilter")
- && type != Being::PLAYER;
+ && type == Being::MONSTER;
bool ignoreDefault = false;
if (filtered)
@@ -962,7 +964,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
{
Being *target = sortedBeings.at(0);
- if (specialDistance && target->getType() == Being::MONSTER
+ if (specialDistance && target->getType() == type
&& target->getDistance() <= 2)
{
return nullptr;
@@ -1027,7 +1029,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
int d = being->getDistance();
// logger->log("dist: %d", dist);
// logger->log("name: %s, %d, %d", being->getName().c_str(), (int)valid, d);
- if (being->getType() != Being::MONSTER
+ if (being->getType() != type
|| !mTargetOnlyReachable)
{ // if distance not calculated, use old distance
d = (being->getTileX() - x) * (being->getTileX() - x)
@@ -1038,7 +1040,7 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing,
continue;
if (specialDistance && being->getDistance() <= 2
- && being->getType() == Being::MONSTER)
+ && being->getType() == type)
{
continue;
}
@@ -1467,6 +1469,8 @@ void ActorSpriteManager::optionChanged(const std::string &name)
mCyclePlayers = config.getBoolValue("cyclePlayers");
else if (name == "cycleMonsters")
mCycleMonsters = config.getBoolValue("cycleMonsters");
+ else if (name == "cycleNPC")
+ mCycleNPC = config.getBoolValue("cycleNPC");
else if (name == "extMouseTargeting")
mExtMouseTargeting = config.getBoolValue("extMouseTargeting");
}