From 8b6afd0d756b9fc66c9f4de3ef452c24f64c87d1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 21 Jul 2014 17:53:41 +0300 Subject: move "change attack type" option into gamemodifiers. --- src/being/localplayer.cpp | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) (limited to 'src/being/localplayer.cpp') diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index aed4a17e2..aaaf2e411 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -119,7 +119,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : mPickUpType(config.getIntValue("pickUpType")), mMagicAttackType(config.getIntValue("magicAttackType")), mPvpAttackType(config.getIntValue("pvpAttackType")), - mAttackType(config.getIntValue("attackType")), mImitationMode(config.getIntValue("imitationMode")), mLastTargetX(0), mLastTargetY(0), @@ -558,7 +557,7 @@ void LocalPlayer::setDestination(const int x, const int y) { mActivityTime = cur_time; - if (getAttackType() == 0 || !mAttackMoving) + if (settings.attackType == 0 || !mAttackMoving) mKeepAttacking = false; // Only send a new message to the server when destination changes @@ -1261,34 +1260,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var, debugMsg(str.substr(4)); } -const unsigned attackTypeSize = 4; - -void LocalPlayer::changeAttackType(const bool forward) -{ - changeMode(&mAttackType, attackTypeSize, "attackType", - &LocalPlayer::getAttackTypeString, 0, true, forward); -} - -static const char *const attackTypeStrings[] = -{ - // TRANSLATORS: attack type in status bar - N_("(D) default attack"), - // TRANSLATORS: attack type in status bar - N_("(G) go and attack"), - // TRANSLATORS: attack type in status bar - N_("(A) go, attack, pickup"), - // TRANSLATORS: attack type in status bar - N_("(d) without auto attack"), - // TRANSLATORS: attack type in status bar - N_("(?) attack") -}; - -std::string LocalPlayer::getAttackTypeString() -{ - return gettext(getVarItem(&attackTypeStrings[0], - mAttackType, attackTypeSize)); -} - const unsigned quickDropCounterSize = 31; void LocalPlayer::changeQuickDropCounter(const bool forward) @@ -3121,13 +3092,13 @@ void LocalPlayer::attack2(Being *const target, const bool keep, changeEquipmentBeforeAttack(target); // probably need cache getPathLength(target) - if ((!target || mAttackType == 0 || mAttackType == 3) + if ((!target || settings.attackType == 0 || settings.attackType == 3) || (withinAttackRange(target, serverVersion < 1, serverVersion < 1 ? 1 : 0) && getPathLength(target) <= getAttackRange2())) { attack(target, keep); - if (mAttackType == 2) + if (settings.attackType == 2) { if (!target) { @@ -3142,7 +3113,7 @@ void LocalPlayer::attack2(Being *const target, const bool keep, } else if (!mPickUpTarget) { - if (mAttackType == 2) + if (settings.attackType == 2) { if (pickUpItems()) return; @@ -3457,7 +3428,7 @@ void LocalPlayer::fixAttackTarget() if (!mMap || !mTarget) return; - if (settings.moveToTargetType == 7 || !mAttackType + if (settings.moveToTargetType == 7 || !settings.attackType || !config.getBoolValue("autofixPos")) { return; @@ -3557,7 +3528,7 @@ void LocalPlayer::resetYellowBar() settings.moveToTargetType = config.resetIntValue("moveToTargetType"); settings.followMode = config.resetIntValue("followMode"); settings.attackWeaponType = config.resetIntValue("attackWeaponType"); - mAttackType = config.resetIntValue("attackType"); + settings.attackType = config.resetIntValue("attackType"); mMagicAttackType = config.resetIntValue("magicAttackType"); mPvpAttackType = config.resetIntValue("pvpAttackType"); mQuickDropCounter = config.resetIntValue("quickDropCounter"); -- cgit v1.2.3-60-g2f50