summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp29
-rw-r--r--src/being/localplayer.h7
-rw-r--r--src/gamemodifiers.cpp25
-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, 36 insertions, 37 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index cec5fce97..a9c779dbe 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -529,7 +529,7 @@ impHandler0(changeFollowMode)
impHandler0(changeImitationMode)
{
- callYellowBar(changeImitationMode);
+ callYellowBar2(changeImitationMode);
}
impHandler0(magicAttack)
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index baeb75146..d7580b552 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -115,7 +115,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
mGMLevel(0),
mCrazyMoveState(0),
mMoveState(0),
- mImitationMode(config.getIntValue("imitationMode")),
mLastTargetX(0),
mLastTargetY(0),
mHomes(),
@@ -1285,30 +1284,6 @@ std::string LocalPlayer::getMapDrawTypeString()
viewport->getMapDrawType(), debugPathSize));
}
-const unsigned imitationModeSize = 2;
-
-void LocalPlayer::changeImitationMode(const bool forward)
-{
- changeMode(&mImitationMode, imitationModeSize, "imitationMode",
- &LocalPlayer::getImitationModeString, 0, true, forward);
-}
-
-static const char *const imitationModeStrings[] =
-{
- // TRANSLATORS: imitation type in status bar
- N_("(D) default imitation"),
- // TRANSLATORS: imitation type in status bar
- N_("(O) outfits imitation"),
- // TRANSLATORS: imitation type in status bar
- N_("(?) imitation")
-};
-
-std::string LocalPlayer::getImitationModeString()
-{
- return gettext(getVarItem(&imitationModeStrings[0],
- mImitationMode, imitationModeSize));
-}
-
const unsigned awayModeSize = 2;
void LocalPlayer::changeAwayMode()
@@ -3113,7 +3088,7 @@ void LocalPlayer::imitateOutfit(const Being *const player,
if (!player)
return;
- if (mImitationMode == 1 && !mPlayerImitated.empty()
+ if (settings.imitationMode == 1 && !mPlayerImitated.empty()
&& player->getName() == mPlayerImitated)
{
if (sprite < 0 || sprite >= player->getNumberOfLayers())
@@ -3415,7 +3390,7 @@ void LocalPlayer::resetYellowBar()
}
if (mMap)
mMap->setDrawLayersFlags(0);
- mImitationMode = config.resetIntValue("imitationMode");
+ settings.imitationMode = config.resetIntValue("imitationMode");
mDisableGameModifiers = config.resetBoolValue("disableGameModifiers");
UpdateStatusListener::distributeEvent();
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 191ed73fe..b7b071c46 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -186,11 +186,6 @@ class LocalPlayer final : public Being,
bool isPathSetByMouse() const A_WARN_UNUSED
{ return mPathSetByMouse; }
- int getImitationMode() const A_WARN_UNUSED
- { return mImitationMode; }
-
- void changeImitationMode(const bool forward);
-
unsigned int getMoveState() const A_WARN_UNUSED
{ return mMoveState; }
@@ -404,8 +399,6 @@ class LocalPlayer final : public Being,
static std::string getMapDrawTypeString();
- std::string getImitationModeString();
-
std::string getAwayModeString();
static std::string getCameraModeString();
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 5ce9dd63b..bb1907a37 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -46,6 +46,7 @@ GameModifiers::GameModifiers()
settings.pickUpType = config.getIntValue("pickUpType");
settings.magicAttackType = config.getIntValue("magicAttackType");
settings.pvpAttackType = config.getIntValue("pvpAttackType");
+ settings.imitationMode = config.getIntValue("imitationMode");
}
GameModifiers::~GameModifiers()
@@ -410,3 +411,27 @@ std::string GameModifiers::getPvpAttackTypeString()
return gettext(getVarItem(&pvpAttackTypeStrings[0],
settings.pvpAttackType, pvpAttackTypeSize));
}
+
+const unsigned imitationModeSize = 2;
+
+void GameModifiers::changeImitationMode(const bool forward)
+{
+ changeMode(&settings.imitationMode, imitationModeSize, "imitationMode",
+ &GameModifiers::getImitationModeString, 0, true, forward);
+}
+
+static const char *const imitationModeStrings[] =
+{
+ // TRANSLATORS: imitation type in status bar
+ N_("(D) default imitation"),
+ // TRANSLATORS: imitation type in status bar
+ N_("(O) outfits imitation"),
+ // TRANSLATORS: imitation type in status bar
+ N_("(?) imitation")
+};
+
+std::string GameModifiers::getImitationModeString()
+{
+ return gettext(getVarItem(&imitationModeStrings[0],
+ settings.imitationMode, imitationModeSize));
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index 35615f15a..01416d794 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -62,6 +62,8 @@ class GameModifiers final
void changePvpAttackType(const bool forward);
+ void changeImitationMode(const bool forward);
+
void setQuickDropCounter(const int n);
std::string getMoveTypeString();
@@ -84,6 +86,8 @@ class GameModifiers final
std::string getPvpAttackTypeString();
+ std::string getImitationModeString();
+
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 8536e25d8..69aec1f8a 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -164,7 +164,7 @@ void StatusPopup::updateLabels() const
InputAction::SWITCH_PVP_ATTACK);
setLabelText(11, player_node->getGameModifiersString(),
InputAction::DISABLE_GAME_MODIFIERS);
- setLabelText(12, player_node->getImitationModeString(),
+ setLabelText(12, modifiers->getImitationModeString(),
InputAction::CHANGE_IMITATION_MODE);
setLabelText(13, player_node->getAwayModeString(),
InputAction::AWAY);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index aee371f9e..b2d2c2ff8 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -657,7 +657,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
.append(" ").append(translateLetter2(
LocalPlayer::getMapDrawTypeString()))
.append(" ").append(translateLetter2(
- player_node->getImitationModeString()))
+ modifiers->getImitationModeString()))
.append(translateLetter2(LocalPlayer::getCameraModeString()))
.append(translateLetter2(player_node->getAwayModeString())));
diff --git a/src/settings.h b/src/settings.h
index cd6e68a99..cd9c319ec 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -62,6 +62,7 @@ class Settings final
pickUpType(0U),
magicAttackType(0U),
pvpAttackType(0U),
+ imitationMode(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -98,6 +99,7 @@ class Settings final
unsigned int pickUpType;
unsigned int magicAttackType;
unsigned int pvpAttackType;
+ unsigned int imitationMode;
bool persistentIp;
bool limitFps;
bool inputFocused;