summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/actormanager.cpp3
-rw-r--r--src/being/localplayer.cpp62
-rw-r--r--src/being/localplayer.h9
-rw-r--r--src/gamemodifiers.cpp48
-rw-r--r--src/gamemodifiers.h4
-rw-r--r--src/gui/popups/statuspopup.cpp2
-rw-r--r--src/gui/windows/statuswindow.cpp2
-rw-r--r--src/settings.h2
9 files changed, 64 insertions, 70 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index a2c960d98..44eb2487a 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -554,7 +554,7 @@ impHandler0(changePvpMode)
impHandler0(changeMoveToTarget)
{
- callYellowBar(changeMoveToTargetType);
+ callYellowBar2(changeMoveToTargetType);
}
impHandler0(copyEquippedToOutfit)
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index 4e4cf0655..c94775921 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -23,6 +23,7 @@
#include "actormanager.h"
#include "configuration.h"
+#include "settings.h"
#include "main.h"
#include "being/attributes.h"
@@ -877,7 +878,7 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing,
const int attackRange = player_node->getAttackRange();
bool specialDistance = false;
- if (player_node->getMoveToTargetType() == 7
+ if (settings.moveToTargetType == 7
&& player_node->getAttackRange() > 2)
{
specialDistance = true;
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 956ff07eb..567834d48 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -120,7 +120,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
mPickUpType(config.getIntValue("pickUpType")),
mMagicAttackType(config.getIntValue("magicAttackType")),
mPvpAttackType(config.getIntValue("pvpAttackType")),
- mMoveToTargetType(config.getIntValue("moveToTargetType")),
mAttackType(config.getIntValue("attackType")),
mFollowMode(config.getIntValue("followMode")),
mImitationMode(config.getIntValue("imitationMode")),
@@ -1128,14 +1127,10 @@ void LocalPlayer::moveToTarget(int dist)
if (dist == -1)
{
- dist = mMoveToTargetType;
- if (mMoveToTargetType == 0)
+ dist = settings.moveToTargetType;
+ if (dist != 0)
{
- dist = 0;
- }
- else
- {
- switch (mMoveToTargetType)
+ switch (dist)
{
case 10:
dist = mAttackRange;
@@ -1150,7 +1145,6 @@ void LocalPlayer::moveToTarget(int dist)
dist = 2;
break;
default:
- dist = mMoveToTargetType;
break;
}
}
@@ -1269,52 +1263,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var,
debugMsg(str.substr(4));
}
-static const unsigned moveToTargetTypeSize = 13;
-
-void LocalPlayer::changeMoveToTargetType(const bool forward)
-{
- changeMode(&mMoveToTargetType, moveToTargetTypeSize, "moveToTargetType",
- &LocalPlayer::getMoveToTargetTypeString, 0, true, forward);
-}
-
-static const char *const moveToTargetTypeStrings[] =
-{
- // TRANSLATORS: move to target type in status bar
- N_("(0) default moves to target"),
- // TRANSLATORS: move to target type in status bar
- N_("(1) moves to target in distance 1"),
- // TRANSLATORS: move to target type in status bar
- N_("(2) moves to target in distance 2"),
- // TRANSLATORS: move to target type in status bar
- N_("(3) moves to target in distance 3"),
- // TRANSLATORS: move to target type in status bar
- N_("(4) moves to target in distance 4"),
- // TRANSLATORS: move to target type in status bar
- N_("(5) moves to target in distance 5"),
- // TRANSLATORS: move to target type in status bar
- N_("(6) moves to target in distance 6"),
- // TRANSLATORS: move to target type in status bar
- N_("(7) moves to target in distance 7"),
- // TRANSLATORS: move to target type in status bar
- N_("(8) moves to target in distance 8"),
- // TRANSLATORS: move to target type in status bar
- N_("(9) moves to target in distance 9"),
- // TRANSLATORS: move to target type in status bar
- N_("(A) moves to target in attack range"),
- // TRANSLATORS: move to target type in status bar
- N_("(a) archer attack range"),
- // TRANSLATORS: move to target type in status bar
- N_("(B) moves to target in attack range - 1"),
- // TRANSLATORS: move to target type in status bar
- N_("(?) move to target")
-};
-
-std::string LocalPlayer::getMoveToTargetTypeString()
-{
- return gettext(getVarItem(&moveToTargetTypeStrings[0],
- mMoveToTargetType, moveToTargetTypeSize));
-}
-
static const unsigned followModeSize = 4;
void LocalPlayer::changeFollowMode(const bool forward)
@@ -3567,7 +3515,7 @@ void LocalPlayer::fixAttackTarget()
if (!mMap || !mTarget)
return;
- if (mMoveToTargetType == 7 || !mAttackType
+ if (settings.moveToTargetType == 7 || !mAttackType
|| !config.getBoolValue("autofixPos"))
{
return;
@@ -3664,7 +3612,7 @@ void LocalPlayer::resetYellowBar()
{
settings.moveType = 0;
settings.crazyMoveType = config.resetIntValue("crazyMoveType");
- mMoveToTargetType = config.resetIntValue("moveToTargetType");
+ settings.moveToTargetType = config.resetIntValue("moveToTargetType");
mFollowMode = config.resetIntValue("followMode");
mAttackWeaponType = config.resetIntValue("attackWeaponType");
mAttackType = config.resetIntValue("attackType");
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 319825e65..20a16c5c7 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -240,9 +240,6 @@ class LocalPlayer final : public Being,
int getPvpAttackType() const A_WARN_UNUSED
{ return mPvpAttackType; }
- int getMoveToTargetType() const A_WARN_UNUSED
- { return mMoveToTargetType; }
-
int getDisableGameModifiers() const A_WARN_UNUSED
{ return mDisableGameModifiers; }
@@ -250,8 +247,6 @@ class LocalPlayer final : public Being,
void tryPingRequest();
- void changeMoveToTargetType(const bool forward);
-
void switchGameModifiers();
void magicAttack() const;
@@ -444,8 +439,6 @@ class LocalPlayer final : public Being,
void setTestParticle(const std::string &fileName,
const bool updateHash = true);
- std::string getMoveToTargetTypeString();
-
std::string getFollowModeString();
std::string getAttackWeaponTypeString();
@@ -540,8 +533,6 @@ class LocalPlayer final : public Being,
unsigned int mMagicAttackType;
// pvp attack type
unsigned int mPvpAttackType;
- // type how move to target
- unsigned int mMoveToTargetType;
unsigned int mAttackType;
unsigned int mFollowMode;
unsigned int mImitationMode;
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 4facc4cf4..3d74169ee 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -38,6 +38,7 @@ GameModifiers *modifiers = nullptr;
GameModifiers::GameModifiers()
{
settings.crazyMoveType = config.getIntValue("crazyMoveType");
+ settings.moveToTargetType = config.getIntValue("moveToTargetType");
}
GameModifiers::~GameModifiers()
@@ -146,3 +147,50 @@ std::string GameModifiers::getCrazyMoveTypeString()
return _("(?) crazy move");
}
}
+
+static const unsigned moveToTargetTypeSize = 13;
+
+void GameModifiers::changeMoveToTargetType(const bool forward)
+{
+ changeMode(&settings.moveToTargetType, moveToTargetTypeSize,
+ "moveToTargetType",
+ &GameModifiers::getMoveToTargetTypeString, 0, true, forward);
+}
+
+static const char *const moveToTargetTypeStrings[] =
+{
+ // TRANSLATORS: move to target type in status bar
+ N_("(0) default moves to target"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(1) moves to target in distance 1"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(2) moves to target in distance 2"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(3) moves to target in distance 3"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(4) moves to target in distance 4"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(5) moves to target in distance 5"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(6) moves to target in distance 6"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(7) moves to target in distance 7"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(8) moves to target in distance 8"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(9) moves to target in distance 9"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(A) moves to target in attack range"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(a) archer attack range"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(B) moves to target in attack range - 1"),
+ // TRANSLATORS: move to target type in status bar
+ N_("(?) move to target")
+};
+
+std::string GameModifiers::getMoveToTargetTypeString()
+{
+ return gettext(getVarItem(&moveToTargetTypeStrings[0],
+ settings.moveToTargetType, moveToTargetTypeSize));
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index 72b9f5cf0..b92ecf24f 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -46,10 +46,14 @@ class GameModifiers final
void changeCrazyMoveType(const bool forward);
+ void changeMoveToTargetType(const bool forward);
+
std::string getMoveTypeString();
std::string getCrazyMoveTypeString();
+ std::string getMoveToTargetTypeString();
+
protected:
static const char *getVarItem(const char *const *const arr,
const unsigned index,
diff --git a/src/gui/popups/statuspopup.cpp b/src/gui/popups/statuspopup.cpp
index 06d822f2c..9c5869ad9 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -144,7 +144,7 @@ void StatusPopup::updateLabels() const
InputAction::INVERT_DIRECTION);
setLabelText(1, modifiers->getCrazyMoveTypeString(),
InputAction::CHANGE_CRAZY_MOVES_TYPE);
- setLabelText(2, player_node->getMoveToTargetTypeString(),
+ setLabelText(2, modifiers->getMoveToTargetTypeString(),
InputAction::CHANGE_MOVE_TO_TARGET);
setLabelText(3, player_node->getFollowModeString(),
InputAction::CHANGE_FOLLOW_MODE);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index a726217e3..c035f9759 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -644,7 +644,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
bar->setText(translateLetter2(modifiers->getMoveTypeString())
.append(translateLetter2(modifiers->getCrazyMoveTypeString()))
- .append(translateLetter2(player_node->getMoveToTargetTypeString()))
+ .append(translateLetter2(modifiers->getMoveToTargetTypeString()))
.append(translateLetter2(player_node->getFollowModeString()))
.append(" ").append(translateLetter2(
player_node->getAttackWeaponTypeString()))
diff --git a/src/settings.h b/src/settings.h
index ae12551cf..2840d02ef 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -54,6 +54,7 @@ class Settings final
textureSize(1024),
moveType(0U),
crazyMoveType(0U),
+ moveToTargetType(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -82,6 +83,7 @@ class Settings final
unsigned int textureSize;
unsigned int moveType;
unsigned int crazyMoveType;
+ unsigned int moveToTargetType;
bool persistentIp;
bool limitFps;
bool inputFocused;