summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-21 13:24:00 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-21 13:24:00 +0300
commit623c0127e4ad5170e9ee003475ed566cec55cfeb (patch)
tree269181626445874223a4b450ea65d6dbc46fb3c3 /src
parent684e041568932a651aaeb09a1247f42860871a59 (diff)
downloadplus-623c0127e4ad5170e9ee003475ed566cec55cfeb.tar.gz
plus-623c0127e4ad5170e9ee003475ed566cec55cfeb.tar.bz2
plus-623c0127e4ad5170e9ee003475ed566cec55cfeb.tar.xz
plus-623c0127e4ad5170e9ee003475ed566cec55cfeb.zip
move "change attack weapon type" option into gamemodifiers.
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp35
-rw-r--r--src/being/localplayer.h9
-rw-r--r--src/gamemodifiers.cpp30
-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, 42 insertions, 44 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 9de48805f..07e452117 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -514,7 +514,7 @@ impHandler0(changeMoveType)
impHandler0(changeAttackWeaponType)
{
- callYellowBar(changeAttackWeaponType);
+ callYellowBar2(changeAttackWeaponType);
}
impHandler0(changeAttackType)
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
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index ccf3bfe11..e04629301 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -40,6 +40,7 @@ GameModifiers::GameModifiers()
settings.crazyMoveType = config.getIntValue("crazyMoveType");
settings.moveToTargetType = config.getIntValue("moveToTargetType");
settings.followMode = config.getIntValue("followMode");
+ settings.attackWeaponType = config.getIntValue("attackWeaponType");
}
GameModifiers::~GameModifiers()
@@ -223,3 +224,32 @@ std::string GameModifiers::getFollowModeString()
return gettext(getVarItem(&followModeStrings[0],
settings.followMode, followModeSize));
}
+
+const unsigned attackWeaponTypeSize = 4;
+
+void GameModifiers::changeAttackWeaponType(const bool forward)
+{
+ changeMode(&settings.attackWeaponType, attackWeaponTypeSize,
+ "attackWeaponType",
+ &GameModifiers::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 GameModifiers::getAttackWeaponTypeString()
+{
+ return gettext(getVarItem(&attackWeaponTypeStrings[0],
+ settings.attackWeaponType, attackWeaponTypeSize));
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index e44a57379..9c1e21953 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -50,6 +50,8 @@ class GameModifiers final
void changeFollowMode(const bool forward);
+ void changeAttackWeaponType(const bool forward);
+
std::string getMoveTypeString();
std::string getCrazyMoveTypeString();
@@ -58,6 +60,8 @@ class GameModifiers final
std::string getFollowModeString();
+ std::string getAttackWeaponTypeString();
+
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 85a5e9570..5a5c27e12 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -148,7 +148,7 @@ void StatusPopup::updateLabels() const
InputAction::CHANGE_MOVE_TO_TARGET);
setLabelText(3, modifiers->getFollowModeString(),
InputAction::CHANGE_FOLLOW_MODE);
- setLabelText(4, player_node->getAttackWeaponTypeString(),
+ setLabelText(4, modifiers->getAttackWeaponTypeString(),
InputAction::CHANGE_ATTACK_WEAPON_TYPE);
setLabelText(5, player_node->getAttackTypeString(),
InputAction::CHANGE_ATTACK_TYPE);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index f85c77b7e..718234814 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -647,7 +647,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
.append(translateLetter2(modifiers->getMoveToTargetTypeString()))
.append(translateLetter2(modifiers->getFollowModeString()))
.append(" ").append(translateLetter2(
- player_node->getAttackWeaponTypeString()))
+ modifiers->getAttackWeaponTypeString()))
.append(translateLetter2(player_node->getAttackTypeString()))
.append(translateLetter2(player_node->getMagicAttackString()))
.append(translateLetter2(player_node->getPvpAttackString()))
diff --git a/src/settings.h b/src/settings.h
index 40f1b7b24..668079707 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -56,6 +56,7 @@ class Settings final
crazyMoveType(0U),
moveToTargetType(0U),
followMode(0U),
+ attackWeaponType(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -86,6 +87,7 @@ class Settings final
unsigned int crazyMoveType;
unsigned int moveToTargetType;
unsigned int followMode;
+ unsigned int attackWeaponType;
bool persistentIp;
bool limitFps;
bool inputFocused;