From 744b9d6689b67779a1d17c6d3de7cd016ca1033b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 20 Jul 2014 20:58:31 +0300 Subject: move "change move" option into gamemodifiers. --- src/being/localplayer.cpp | 46 +++++++--------------------------------------- src/being/localplayer.h | 12 ------------ 2 files changed, 7 insertions(+), 51 deletions(-) (limited to 'src/being') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index ac73d45df..df42ffc24 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -30,6 +30,7 @@ #include "guild.h" #include "item.h" #include "party.h" +#include "settings.h" #include "soundconsts.h" #include "soundmanager.h" #include "statuseffect.h" @@ -112,7 +113,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : AttributeListener(), StatListener(), mGMLevel(0), - mMoveType(0), mCrazyMoveType(config.getIntValue("crazyMoveType")), mCrazyMoveState(0), mAttackWeaponType(config.getIntValue("attackWeaponType")), @@ -568,7 +568,7 @@ void LocalPlayer::setDestination(const int x, const int y) // Only send a new message to the server when destination changes if (x != mDest.x || y != mDest.y) { - if (mMoveType != 1) + if (settings.moveType != 1) { Net::getPlayerHandler()->setDestination(x, y, mDirection); Being::setDestination(x, y); @@ -1237,8 +1237,6 @@ void LocalPlayer::moveToHome() } } -static const unsigned moveTypeSize = 5; - void LocalPlayer::changeMode(unsigned *restrict const var, const unsigned limit, const char *restrict const conf, @@ -1272,35 +1270,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var, debugMsg(str.substr(4)); } -void LocalPlayer::changeMoveType(const bool forward) -{ - mMoveState = 0; - changeMode(&mMoveType, moveTypeSize, "invertMoveDirection", - &LocalPlayer::getMoveTypeString, 0, false, forward); -} - -static const char *const moveTypeStrings[] = -{ - // TRANSLATORS: move type in status bar - N_("(D) default moves"), - // TRANSLATORS: move type in status bar - N_("(I) invert moves"), - // TRANSLATORS: move type in status bar - N_("(c) moves with some crazy moves"), - // TRANSLATORS: move type in status bar - N_("(C) moves with crazy moves"), - // TRANSLATORS: move type in status bar - N_("(d) double normal + crazy"), - // TRANSLATORS: move type in status bar - N_("(?) unknown move") -}; - -std::string LocalPlayer::getMoveTypeString() -{ - return gettext(getVarItem(&moveTypeStrings[0], - mMoveType, moveTypeSize)); -} - static const unsigned crazyMoveTypeSize = 11; void LocalPlayer::changeCrazyMoveType(const bool forward) @@ -2671,18 +2640,17 @@ void LocalPlayer::specialMove(const unsigned char direction) if (direction && (mNavigateX || mNavigateY)) navigateClean(); - if (direction && (mMoveType >= 2 - && mMoveType <= 4) - && !mIsServerBuggy) + if (direction && (settings.moveType >= 2 + && settings.moveType <= 4)) { if (mAction == BeingAction::MOVE) return; int max; - if (mMoveType == 2) + if (settings.moveType == 2) max = 5; - else if (mMoveType == 4) + else if (settings.moveType == 4) max = 1; else max = 3; @@ -3724,7 +3692,7 @@ void LocalPlayer::checkNewName(Being *const being) void LocalPlayer::resetYellowBar() { - mMoveType = 0; + settings.moveType = 0; mCrazyMoveType = config.resetIntValue("crazyMoveType"); mMoveToTargetType = config.resetIntValue("moveToTargetType"); mFollowMode = config.resetIntValue("followMode"); diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 82a258678..5a2d10627 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -186,14 +186,6 @@ class LocalPlayer final : public Being, bool isPathSetByMouse() const A_WARN_UNUSED { return mPathSetByMouse; } - int getMoveType() const A_WARN_UNUSED - { return mMoveType; } - - void setMoveType(const int n) - { mMoveType = n; } - - void changeMoveType(const bool forward); - int getAttackWeaponType() const A_WARN_UNUSED { return mAttackWeaponType; } @@ -451,8 +443,6 @@ class LocalPlayer final : public Being, void setTestParticle(const std::string &fileName, const bool updateHash = true); - std::string getMoveTypeString(); - std::string getCrazyMoveTypeString(); std::string getMoveToTargetTypeString(); @@ -537,8 +527,6 @@ class LocalPlayer final : public Being, int mGMLevel; - // move type - unsigned int mMoveType; // crazy move type unsigned int mCrazyMoveType; // crazy move state -- cgit v1.2.3-60-g2f50