summaryrefslogtreecommitdiff
path: root/src
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
parentfe7a1342dc71a412a177a69b022ac1d1cc1fbdc6 (diff)
downloadmanaplus-b37522537cd7049e82172fbae87b4c240f80b07a.tar.gz
manaplus-b37522537cd7049e82172fbae87b4c240f80b07a.tar.bz2
manaplus-b37522537cd7049e82172fbae87b4c240f80b07a.tar.xz
manaplus-b37522537cd7049e82172fbae87b4c240f80b07a.zip
Add npc cycle select.
Diffstat (limited to 'src')
-rw-r--r--src/actorspritemanager.cpp14
-rw-r--r--src/actorspritemanager.h1
-rw-r--r--src/defaults.cpp1
-rw-r--r--src/gui/setup_other.cpp3
4 files changed, 14 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");
}
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index 1491ca6d4..86bc7d9cd 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -306,6 +306,7 @@ class ActorSpriteManager: public ConfigListener
bool mTargetOnlyReachable;
bool mCyclePlayers;
bool mCycleMonsters;
+ bool mCycleNPC;
bool mExtMouseTargeting;
#define defVarsP(mob) \
diff --git a/src/defaults.cpp b/src/defaults.cpp
index 1eb87a677..1ddad88d4 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -163,6 +163,7 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "logToChat", false);
AddDEF(configData, "cyclePlayers", true);
AddDEF(configData, "cycleMonsters", true);
+ AddDEF(configData, "cycleNPC", true);
AddDEF(configData, "floorItemsHighlight", true);
AddDEF(configData, "enableBotCheker", true);
AddDEF(configData, "removeColors", true);
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index bfc3059c7..e011be983 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -155,6 +155,9 @@ Setup_Other::Setup_Other()
new SetupItemLabel(_("NPC"), "", this);
+ new SetupItemCheckBox(_("Cycle npc targets"), "",
+ "cycleNPC", this, "cycleNPCEvent");
+
new SetupItemCheckBox(_("Log NPC dialogue"), "", "logNpcInGui",
this, "logNpcInGuiEvent");