From 623c0127e4ad5170e9ee003475ed566cec55cfeb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 21 Jul 2014 13:24:00 +0300 Subject: move "change attack weapon type" option into gamemodifiers. --- src/being/localplayer.cpp | 35 +++-------------------------------- src/being/localplayer.h | 9 --------- 2 files changed, 3 insertions(+), 41 deletions(-) (limited to 'src/being') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 63834f934..aed4a17e2 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -114,7 +114,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : StatListener(), mGMLevel(0), mCrazyMoveState(0), - mAttackWeaponType(config.getIntValue("attackWeaponType")), mQuickDropCounter(config.getIntValue("quickDropCounter")), mMoveState(0), mPickUpType(config.getIntValue("pickUpType")), @@ -1262,34 +1261,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var, debugMsg(str.substr(4)); } -const unsigned attackWeaponTypeSize = 4; - -void LocalPlayer::changeAttackWeaponType(const bool forward) -{ - changeMode(&mAttackWeaponType, attackWeaponTypeSize, "attackWeaponType", - &LocalPlayer::getAttackWeaponTypeString, 1, true, forward); -} - -static const char *const attackWeaponTypeStrings[] = -{ - // TRANSLATORS: switch attack type in status bar - N_("(?) attack"), - // TRANSLATORS: switch attack type in status bar - N_("(D) default attack"), - // TRANSLATORS: switch attack type in status bar - N_("(s) switch attack without shield"), - // TRANSLATORS: switch attack type in status bar - N_("(S) switch attack with shield"), - // TRANSLATORS: switch attack type in status bar - N_("(?) attack") -}; - -std::string LocalPlayer::getAttackWeaponTypeString() -{ - return gettext(getVarItem(&attackWeaponTypeStrings[0], - mAttackWeaponType, attackWeaponTypeSize)); -} - const unsigned attackTypeSize = 4; void LocalPlayer::changeAttackType(const bool forward) @@ -1598,7 +1569,7 @@ std::string LocalPlayer::getGameModifiersString() void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const { - if (mAttackWeaponType == 1 || !target || !PlayerInfo::getInventory()) + if (settings.attackWeaponType == 1 || !target || !PlayerInfo::getInventory()) return; bool allowSword = false; @@ -1637,7 +1608,7 @@ void LocalPlayer::changeEquipmentBeforeAttack(const Being *const target) const PlayerInfo::equipItem(item, true); // if need equip shield too - if (mAttackWeaponType == 3) + if (settings.attackWeaponType == 3) { // searching shield const WeaponsInfos &shields = WeaponsDB::getShields(); @@ -3585,7 +3556,7 @@ void LocalPlayer::resetYellowBar() settings.crazyMoveType = config.resetIntValue("crazyMoveType"); settings.moveToTargetType = config.resetIntValue("moveToTargetType"); settings.followMode = config.resetIntValue("followMode"); - mAttackWeaponType = config.resetIntValue("attackWeaponType"); + settings.attackWeaponType = config.resetIntValue("attackWeaponType"); mAttackType = config.resetIntValue("attackType"); mMagicAttackType = config.resetIntValue("magicAttackType"); mPvpAttackType = config.resetIntValue("pvpAttackType"); diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 76fe055da..711582125 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -186,17 +186,12 @@ class LocalPlayer final : public Being, bool isPathSetByMouse() const A_WARN_UNUSED { return mPathSetByMouse; } - int getAttackWeaponType() const A_WARN_UNUSED - { return mAttackWeaponType; } - int getAttackType() const A_WARN_UNUSED { return mAttackType; } int getImitationMode() const A_WARN_UNUSED { return mImitationMode; } - void changeAttackWeaponType(const bool forward); - void changeAttackType(const bool forward); void changeImitationMode(const bool forward); @@ -434,8 +429,6 @@ class LocalPlayer final : public Being, void setTestParticle(const std::string &fileName, const bool updateHash = true); - std::string getAttackWeaponTypeString(); - std::string getAttackTypeString(); std::string getQuickDropCounterString(); @@ -514,8 +507,6 @@ class LocalPlayer final : public Being, // crazy move state unsigned int mCrazyMoveState; - // attack weapon type - unsigned int mAttackWeaponType; // quick drop counter unsigned int mQuickDropCounter; // move state. used if mMoveType == 2 -- cgit v1.2.3-70-g09d2