summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-21 00:18:41 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-21 00:18:41 +0300
commitb02b4ce0b656a93fbcaa927b0ba289edfec6e22c (patch)
treea31a6f99778d0cf0b45689584939bd8c391627ae
parent744b9d6689b67779a1d17c6d3de7cd016ca1033b (diff)
downloadManaVerse-b02b4ce0b656a93fbcaa927b0ba289edfec6e22c.tar.gz
ManaVerse-b02b4ce0b656a93fbcaa927b0ba289edfec6e22c.tar.bz2
ManaVerse-b02b4ce0b656a93fbcaa927b0ba289edfec6e22c.tar.xz
ManaVerse-b02b4ce0b656a93fbcaa927b0ba289edfec6e22c.zip
move "change crazy move" option into gamemodifiers.
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp34
-rw-r--r--src/being/localplayer.h19
-rw-r--r--src/gamemodifiers.cpp31
-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, 50 insertions, 46 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index f30fab781..a2c960d98 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -465,7 +465,7 @@ impHandler0(itenplz)
impHandler0(changeCrazyMove)
{
- callYellowBar(changeCrazyMoveType);
+ callYellowBar2(changeCrazyMoveType);
}
impHandler0(changePickupType)
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index df42ffc24..956ff07eb 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -113,7 +113,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
AttributeListener(),
StatListener(),
mGMLevel(0),
- mCrazyMoveType(config.getIntValue("crazyMoveType")),
mCrazyMoveState(0),
mAttackWeaponType(config.getIntValue("attackWeaponType")),
mQuickDropCounter(config.getIntValue("quickDropCounter")),
@@ -1270,35 +1269,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var,
debugMsg(str.substr(4));
}
-static const unsigned crazyMoveTypeSize = 11;
-
-void LocalPlayer::changeCrazyMoveType(const bool forward)
-{
- mCrazyMoveState = 0;
- changeMode(&mCrazyMoveType, crazyMoveTypeSize, "crazyMoveType",
- &LocalPlayer::getCrazyMoveTypeString, 1, true, forward);
-}
-
-std::string LocalPlayer::getCrazyMoveTypeString()
-{
- if (mCrazyMoveType < crazyMoveTypeSize - 1)
- {
- // TRANSLATORS: crazy move type in status bar
- return strprintf(_("(%u) crazy move number %u"),
- mCrazyMoveType, mCrazyMoveType);
- }
- else if (mCrazyMoveType == crazyMoveTypeSize - 1)
- {
- // TRANSLATORS: crazy move type in status bar
- return _("(a) custom crazy move");
- }
- else
- {
- // TRANSLATORS: crazy move type in status bar
- return _("(?) crazy move");
- }
-}
-
static const unsigned moveToTargetTypeSize = 13;
void LocalPlayer::changeMoveToTargetType(const bool forward)
@@ -1787,7 +1757,7 @@ void LocalPlayer::crazyMove()
{
const bool oldDisableCrazyMove = mDisableCrazyMove;
mDisableCrazyMove = true;
- switch (mCrazyMoveType)
+ switch (settings.crazyMoveType)
{
case 1:
crazyMove1();
@@ -3693,7 +3663,7 @@ void LocalPlayer::checkNewName(Being *const being)
void LocalPlayer::resetYellowBar()
{
settings.moveType = 0;
- mCrazyMoveType = config.resetIntValue("crazyMoveType");
+ settings.crazyMoveType = config.resetIntValue("crazyMoveType");
mMoveToTargetType = config.resetIntValue("moveToTargetType");
mFollowMode = config.resetIntValue("followMode");
mAttackWeaponType = config.resetIntValue("attackWeaponType");
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 5a2d10627..319825e65 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -208,9 +208,6 @@ class LocalPlayer final : public Being,
void changePickUpType(const bool forward);
- int getCrazyMoveType() const A_WARN_UNUSED
- { return mCrazyMoveType; }
-
int getPickUpType() const A_WARN_UNUSED
{ return mPickUpType; }
@@ -221,12 +218,18 @@ class LocalPlayer final : public Being,
void changeQuickDropCounter(const bool forward);
- int getMoveState() const A_WARN_UNUSED
+ unsigned int getMoveState() const A_WARN_UNUSED
{ return mMoveState; }
- void setMoveState(const int n)
+ void setMoveState(const unsigned int n)
{ mMoveState = n; }
+ unsigned int getCrazyMoveState() const A_WARN_UNUSED
+ { return mCrazyMoveState; }
+
+ void setCrazyMoveState(const unsigned int n)
+ { mCrazyMoveState = n; }
+
void switchMagicAttack(const bool forward);
void switchPvpAttack(const bool forward);
@@ -259,8 +262,6 @@ class LocalPlayer final : public Being,
bool pickUpItems(int pickUpType = 0);
- void changeCrazyMoveType(const bool forward);
-
void crazyMove();
void moveTo(const int x, const int y);
@@ -443,8 +444,6 @@ class LocalPlayer final : public Being,
void setTestParticle(const std::string &fileName,
const bool updateHash = true);
- std::string getCrazyMoveTypeString();
-
std::string getMoveToTargetTypeString();
std::string getFollowModeString();
@@ -527,8 +526,6 @@ class LocalPlayer final : public Being,
int mGMLevel;
- // crazy move type
- unsigned int mCrazyMoveType;
// crazy move state
unsigned int mCrazyMoveState;
// attack weapon type
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index aea2fa6d6..4facc4cf4 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -37,6 +37,7 @@ GameModifiers *modifiers = nullptr;
GameModifiers::GameModifiers()
{
+ settings.crazyMoveType = config.getIntValue("crazyMoveType");
}
GameModifiers::~GameModifiers()
@@ -115,3 +116,33 @@ std::string GameModifiers::getMoveTypeString()
return gettext(getVarItem(&moveTypeStrings[0],
settings.moveType, moveTypeSize));
}
+
+static const unsigned crazyMoveTypeSize = 11;
+
+void GameModifiers::changeCrazyMoveType(const bool forward)
+{
+ player_node->setCrazyMoveState(0U);
+ changeMode(&settings.crazyMoveType, crazyMoveTypeSize, "crazyMoveType",
+ &GameModifiers::getCrazyMoveTypeString, 1, true, forward);
+}
+
+std::string GameModifiers::getCrazyMoveTypeString()
+{
+ const unsigned int crazyMoveType = settings.crazyMoveType;
+ if (crazyMoveType < crazyMoveTypeSize - 1)
+ {
+ // TRANSLATORS: crazy move type in status bar
+ return strprintf(_("(%u) crazy move number %u"),
+ crazyMoveType, crazyMoveType);
+ }
+ else if (crazyMoveType == crazyMoveTypeSize - 1)
+ {
+ // TRANSLATORS: crazy move type in status bar
+ return _("(a) custom crazy move");
+ }
+ else
+ {
+ // TRANSLATORS: crazy move type in status bar
+ return _("(?) crazy move");
+ }
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index 0a1aa945f..72b9f5cf0 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -44,8 +44,12 @@ class GameModifiers final
void changeMoveType(const bool forward);
+ void changeCrazyMoveType(const bool forward);
+
std::string getMoveTypeString();
+ std::string getCrazyMoveTypeString();
+
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 23c0f313f..06d822f2c 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -142,7 +142,7 @@ void StatusPopup::updateLabels() const
setLabelText(0, modifiers->getMoveTypeString(),
InputAction::INVERT_DIRECTION);
- setLabelText(1, player_node->getCrazyMoveTypeString(),
+ setLabelText(1, modifiers->getCrazyMoveTypeString(),
InputAction::CHANGE_CRAZY_MOVES_TYPE);
setLabelText(2, player_node->getMoveToTargetTypeString(),
InputAction::CHANGE_MOVE_TO_TARGET);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 470028024..a726217e3 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -643,7 +643,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
return;
bar->setText(translateLetter2(modifiers->getMoveTypeString())
- .append(translateLetter2(player_node->getCrazyMoveTypeString()))
+ .append(translateLetter2(modifiers->getCrazyMoveTypeString()))
.append(translateLetter2(player_node->getMoveToTargetTypeString()))
.append(translateLetter2(player_node->getFollowModeString()))
.append(" ").append(translateLetter2(
diff --git a/src/settings.h b/src/settings.h
index 50ea3223d..ae12551cf 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -53,6 +53,7 @@ class Settings final
guiAlpha(1.0F),
textureSize(1024),
moveType(0U),
+ crazyMoveType(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -80,6 +81,7 @@ class Settings final
float guiAlpha;
unsigned int textureSize;
unsigned int moveType;
+ unsigned int crazyMoveType;
bool persistentIp;
bool limitFps;
bool inputFocused;