summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-21 13:14:09 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-21 13:14:09 +0300
commit684e041568932a651aaeb09a1247f42860871a59 (patch)
treec1398692d694b01150b204a19199776b06a919a5
parentcfffcc941898c4163e1bd62b8e514d3535511666 (diff)
downloadmv-684e041568932a651aaeb09a1247f42860871a59.tar.gz
mv-684e041568932a651aaeb09a1247f42860871a59.tar.bz2
mv-684e041568932a651aaeb09a1247f42860871a59.tar.xz
mv-684e041568932a651aaeb09a1247f42860871a59.zip
move "change follow mode" option into gamemodifiers.
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp35
-rw-r--r--src/being/localplayer.h8
-rw-r--r--src/gamemodifiers.cpp29
-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
8 files changed, 41 insertions, 43 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 44eb2487a..9de48805f 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -524,7 +524,7 @@ impHandler0(changeAttackType)
impHandler0(changeFollowMode)
{
- callYellowBar(changeFollowMode);
+ callYellowBar2(changeFollowMode);
}
impHandler0(changeImitationMode)
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 567834d48..63834f934 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -121,7 +121,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
mMagicAttackType(config.getIntValue("magicAttackType")),
mPvpAttackType(config.getIntValue("pvpAttackType")),
mAttackType(config.getIntValue("attackType")),
- mFollowMode(config.getIntValue("followMode")),
mImitationMode(config.getIntValue("imitationMode")),
mLastTargetX(0),
mLastTargetY(0),
@@ -1263,34 +1262,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var,
debugMsg(str.substr(4));
}
-static const unsigned followModeSize = 4;
-
-void LocalPlayer::changeFollowMode(const bool forward)
-{
- changeMode(&mFollowMode, followModeSize, "followMode",
- &LocalPlayer::getFollowModeString, 0, true, forward);
-}
-
-static const char *const followModeStrings[] =
-{
- // TRANSLATORS: folow mode in status bar
- N_("(D) default follow"),
- // TRANSLATORS: folow mode in status bar
- N_("(R) relative follow"),
- // TRANSLATORS: folow mode in status bar
- N_("(M) mirror follow"),
- // TRANSLATORS: folow mode in status bar
- N_("(P) pet follow"),
- // TRANSLATORS: folow mode in status bar
- N_("(?) unknown follow")
-};
-
-std::string LocalPlayer::getFollowModeString()
-{
- return gettext(getVarItem(&followModeStrings[0],
- mFollowMode, followModeSize));
-}
-
const unsigned attackWeaponTypeSize = 4;
void LocalPlayer::changeAttackWeaponType(const bool forward)
@@ -3297,7 +3268,7 @@ void LocalPlayer::imitateDirection(const Being *const being,
if (!PacketLimiter::limitPackets(PACKET_DIRECTION))
return;
- if (mFollowMode == 2)
+ if (settings.followMode == 2)
{
uint8_t dir2 = 0;
if (dir & BeingDirection::LEFT)
@@ -3393,7 +3364,7 @@ void LocalPlayer::followMoveTo(const Being *const being,
mPickUpTarget = nullptr;
if (!mPlayerFollowed.empty() && being->getName() == mPlayerFollowed)
{
- switch (mFollowMode)
+ switch (settings.followMode)
{
case 0:
setDestination(x1, y1);
@@ -3613,7 +3584,7 @@ void LocalPlayer::resetYellowBar()
settings.moveType = 0;
settings.crazyMoveType = config.resetIntValue("crazyMoveType");
settings.moveToTargetType = config.resetIntValue("moveToTargetType");
- mFollowMode = config.resetIntValue("followMode");
+ settings.followMode = config.resetIntValue("followMode");
mAttackWeaponType = config.resetIntValue("attackWeaponType");
mAttackType = config.resetIntValue("attackType");
mMagicAttackType = config.resetIntValue("magicAttackType");
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 20a16c5c7..76fe055da 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -192,9 +192,6 @@ class LocalPlayer final : public Being,
int getAttackType() const A_WARN_UNUSED
{ return mAttackType; }
- int getFollowMode() const A_WARN_UNUSED
- { return mFollowMode; }
-
int getImitationMode() const A_WARN_UNUSED
{ return mImitationMode; }
@@ -202,8 +199,6 @@ class LocalPlayer final : public Being,
void changeAttackType(const bool forward);
- void changeFollowMode(const bool forward);
-
void changeImitationMode(const bool forward);
void changePickUpType(const bool forward);
@@ -439,8 +434,6 @@ class LocalPlayer final : public Being,
void setTestParticle(const std::string &fileName,
const bool updateHash = true);
- std::string getFollowModeString();
-
std::string getAttackWeaponTypeString();
std::string getAttackTypeString();
@@ -534,7 +527,6 @@ class LocalPlayer final : public Being,
// pvp attack type
unsigned int mPvpAttackType;
unsigned int mAttackType;
- unsigned int mFollowMode;
unsigned int mImitationMode;
int mLastTargetX;
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 3d74169ee..ccf3bfe11 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -39,6 +39,7 @@ GameModifiers::GameModifiers()
{
settings.crazyMoveType = config.getIntValue("crazyMoveType");
settings.moveToTargetType = config.getIntValue("moveToTargetType");
+ settings.followMode = config.getIntValue("followMode");
}
GameModifiers::~GameModifiers()
@@ -194,3 +195,31 @@ std::string GameModifiers::getMoveToTargetTypeString()
return gettext(getVarItem(&moveToTargetTypeStrings[0],
settings.moveToTargetType, moveToTargetTypeSize));
}
+
+static const unsigned followModeSize = 4;
+
+void GameModifiers::changeFollowMode(const bool forward)
+{
+ changeMode(&settings.followMode, followModeSize, "followMode",
+ &GameModifiers::getFollowModeString, 0, true, forward);
+}
+
+static const char *const followModeStrings[] =
+{
+ // TRANSLATORS: folow mode in status bar
+ N_("(D) default follow"),
+ // TRANSLATORS: folow mode in status bar
+ N_("(R) relative follow"),
+ // TRANSLATORS: folow mode in status bar
+ N_("(M) mirror follow"),
+ // TRANSLATORS: folow mode in status bar
+ N_("(P) pet follow"),
+ // TRANSLATORS: folow mode in status bar
+ N_("(?) unknown follow")
+};
+
+std::string GameModifiers::getFollowModeString()
+{
+ return gettext(getVarItem(&followModeStrings[0],
+ settings.followMode, followModeSize));
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index b92ecf24f..e44a57379 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -48,12 +48,16 @@ class GameModifiers final
void changeMoveToTargetType(const bool forward);
+ void changeFollowMode(const bool forward);
+
std::string getMoveTypeString();
std::string getCrazyMoveTypeString();
std::string getMoveToTargetTypeString();
+ std::string getFollowModeString();
+
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 9c5869ad9..85a5e9570 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -146,7 +146,7 @@ void StatusPopup::updateLabels() const
InputAction::CHANGE_CRAZY_MOVES_TYPE);
setLabelText(2, modifiers->getMoveToTargetTypeString(),
InputAction::CHANGE_MOVE_TO_TARGET);
- setLabelText(3, player_node->getFollowModeString(),
+ setLabelText(3, modifiers->getFollowModeString(),
InputAction::CHANGE_FOLLOW_MODE);
setLabelText(4, player_node->getAttackWeaponTypeString(),
InputAction::CHANGE_ATTACK_WEAPON_TYPE);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index c035f9759..f85c77b7e 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -645,7 +645,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
bar->setText(translateLetter2(modifiers->getMoveTypeString())
.append(translateLetter2(modifiers->getCrazyMoveTypeString()))
.append(translateLetter2(modifiers->getMoveToTargetTypeString()))
- .append(translateLetter2(player_node->getFollowModeString()))
+ .append(translateLetter2(modifiers->getFollowModeString()))
.append(" ").append(translateLetter2(
player_node->getAttackWeaponTypeString()))
.append(translateLetter2(player_node->getAttackTypeString()))
diff --git a/src/settings.h b/src/settings.h
index 2840d02ef..40f1b7b24 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -55,6 +55,7 @@ class Settings final
moveType(0U),
crazyMoveType(0U),
moveToTargetType(0U),
+ followMode(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -84,6 +85,7 @@ class Settings final
unsigned int moveType;
unsigned int crazyMoveType;
unsigned int moveToTargetType;
+ unsigned int followMode;
bool persistentIp;
bool limitFps;
bool inputFocused;