summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-21 21:25:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-21 21:25:47 +0300
commitc41fcc1f637e76e5ff671b223ce6c151af89e7d3 (patch)
treeae7afae3d8c30eff4569fc0c41fb8d0ef99ecd94 /src
parent8b6afd0d756b9fc66c9f4de3ef452c24f64c87d1 (diff)
downloadManaVerse-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.tar.gz
ManaVerse-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.tar.bz2
ManaVerse-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.tar.xz
ManaVerse-c41fcc1f637e76e5ff671b223ce6c151af89e7d3.zip
move "change drop counter" option into gamemodifiers.
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp4
-rw-r--r--src/being/localplayer.cpp34
-rw-r--r--src/being/localplayer.h11
-rw-r--r--src/commands.cpp5
-rw-r--r--src/dropshortcut.cpp7
-rw-r--r--src/gamemodifiers.cpp33
-rw-r--r--src/gamemodifiers.h6
-rw-r--r--src/gui/popups/statuspopup.cpp2
-rw-r--r--src/gui/windows/statuswindow.cpp2
-rw-r--r--src/settings.h2
10 files changed, 53 insertions, 53 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 65edb562a..21905063f 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -108,9 +108,9 @@
return false;
#define callYellowBarCond(name) \
- if (player_node && !player_node->getDisableGameModifiers()) \
+ if (modifiers && !player_node->getDisableGameModifiers()) \
{ \
- player_node->name(!inputManager.isActionActive( \
+ modifiers->name(!inputManager.isActionActive( \
InputAction::STOP_ATTACK)); \
return true; \
} \
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index aaaf2e411..3e6051643 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),
- mQuickDropCounter(config.getIntValue("quickDropCounter")),
mMoveState(0),
mPickUpType(config.getIntValue("pickUpType")),
mMagicAttackType(config.getIntValue("magicAttackType")),
@@ -1260,37 +1259,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var,
debugMsg(str.substr(4));
}
-const unsigned quickDropCounterSize = 31;
-
-void LocalPlayer::changeQuickDropCounter(const bool forward)
-{
- changeMode(&mQuickDropCounter, quickDropCounterSize, "quickDropCounter",
- &LocalPlayer::getQuickDropCounterString, 1, true, forward);
-}
-
-std::string LocalPlayer::getQuickDropCounterString()
-{
- if (mQuickDropCounter > 9)
- {
- return strprintf("(%c) drop counter %u", static_cast<signed char>(
- 'a' + mQuickDropCounter - 10), mQuickDropCounter);
- }
- else
- {
- return strprintf("(%u) drop counter %u",
- mQuickDropCounter, mQuickDropCounter);
- }
-}
-
-void LocalPlayer::setQuickDropCounter(const int n)
-{
- if (n < 1 || n >= static_cast<signed>(quickDropCounterSize))
- return;
- mQuickDropCounter = n;
- config.setValue("quickDropCounter", mQuickDropCounter);
- UpdateStatusListener::distributeEvent();
-}
-
const unsigned pickUpTypeSize = 7;
void LocalPlayer::changePickUpType(const bool forward)
@@ -3531,7 +3499,7 @@ void LocalPlayer::resetYellowBar()
settings.attackType = config.resetIntValue("attackType");
mMagicAttackType = config.resetIntValue("magicAttackType");
mPvpAttackType = config.resetIntValue("pvpAttackType");
- mQuickDropCounter = config.resetIntValue("quickDropCounter");
+ settings.quickDropCounter = config.resetIntValue("quickDropCounter");
mPickUpType = config.resetIntValue("pickUpType");
if (viewport)
{
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 4225be4a0..8660efd87 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -196,13 +196,6 @@ class LocalPlayer final : public Being,
int getPickUpType() const A_WARN_UNUSED
{ return mPickUpType; }
- int getQuickDropCounter() const A_WARN_UNUSED
- { return mQuickDropCounter; }
-
- void setQuickDropCounter(const int n);
-
- void changeQuickDropCounter(const bool forward);
-
unsigned int getMoveState() const A_WARN_UNUSED
{ return mMoveState; }
@@ -424,8 +417,6 @@ class LocalPlayer final : public Being,
void setTestParticle(const std::string &fileName,
const bool updateHash = true);
- std::string getQuickDropCounterString();
-
std::string getPickUpTypeString();
static std::string getMapDrawTypeString();
@@ -500,8 +491,6 @@ class LocalPlayer final : public Being,
// crazy move state
unsigned int mCrazyMoveState;
- // quick drop counter
- unsigned int mQuickDropCounter;
// move state. used if mMoveType == 2
unsigned int mMoveState;
// pick up type 1x1, normal aka 2x1, forward aka 2x3, 3x3, 3x3 + 1
diff --git a/src/commands.cpp b/src/commands.cpp
index 09eee8b05..f64e570c1 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -27,6 +27,7 @@
#include "client.h"
#include "configuration.h"
#include "game.h"
+#include "gamemodifiers.h"
#include "graphicsmanager.h"
#include "guildmanager.h"
#include "main.h"
@@ -1161,8 +1162,8 @@ impHandler2(dumpTests)
impHandler1(setDrop)
{
- if (player_node)
- player_node->setQuickDropCounter(atoi(args.c_str()));
+ if (modifiers)
+ modifiers->setQuickDropCounter(atoi(args.c_str()));
}
impHandler0(error)
diff --git a/src/dropshortcut.cpp b/src/dropshortcut.cpp
index ed60e623d..328d71adf 100644
--- a/src/dropshortcut.cpp
+++ b/src/dropshortcut.cpp
@@ -25,6 +25,7 @@
#include "configuration.h"
#include "inventory.h"
#include "item.h"
+#include "settings.h"
#include "being/localplayer.h"
#include "being/playerinfo.h"
@@ -109,7 +110,7 @@ void DropShortcut::dropFirst() const
->findItem(itemId, itemColor);
if (item && item->getQuantity())
{
- const int cnt = player_node->getQuickDropCounter();
+ const int cnt = settings.quickDropCounter;
if (player_node->isServerBuggy())
{
PlayerInfo::dropItem(item, cnt, true);
@@ -130,12 +131,12 @@ void DropShortcut::dropItems(const int cnt)
if (player_node->isServerBuggy())
{
- dropItem(player_node->getQuickDropCounter());
+ dropItem(settings.quickDropCounter);
return;
}
int n = 0;
- const int sz = player_node->getQuickDropCounter();
+ const int sz = settings.quickDropCounter;
for (int f = 0; f < 9; f++)
{
for (int i = 0; i < sz; i++)
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 6fa606408..d98332f39 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -42,6 +42,7 @@ GameModifiers::GameModifiers()
settings.followMode = config.getIntValue("followMode");
settings.attackWeaponType = config.getIntValue("attackWeaponType");
settings.attackType = config.getIntValue("attackType");
+ settings.quickDropCounter = config.getIntValue("quickDropCounter");
}
GameModifiers::~GameModifiers()
@@ -282,3 +283,35 @@ std::string GameModifiers::getAttackTypeString()
return gettext(getVarItem(&attackTypeStrings[0],
settings.attackType, attackTypeSize));
}
+
+const unsigned quickDropCounterSize = 31;
+
+void GameModifiers::changeQuickDropCounter(const bool forward)
+{
+ changeMode(&settings.quickDropCounter, quickDropCounterSize,
+ "quickDropCounter",
+ &GameModifiers::getQuickDropCounterString, 1, true, forward);
+}
+
+std::string GameModifiers::getQuickDropCounterString()
+{
+ const unsigned int cnt = settings.quickDropCounter;
+ if (cnt > 9)
+ {
+ return strprintf("(%c) drop counter %u", static_cast<signed char>(
+ 'a' + cnt - 10), cnt);
+ }
+ else
+ {
+ return strprintf("(%u) drop counter %u", cnt, cnt);
+ }
+}
+
+void GameModifiers::setQuickDropCounter(const int n)
+{
+ if (n < 1 || n >= static_cast<signed>(quickDropCounterSize))
+ return;
+ settings.quickDropCounter = n;
+ config.setValue("quickDropCounter", n);
+ UpdateStatusListener::distributeEvent();
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index 1ede2d49a..ed19773d8 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -54,6 +54,10 @@ class GameModifiers final
void changeAttackType(const bool forward);
+ void changeQuickDropCounter(const bool forward);
+
+ void setQuickDropCounter(const int n);
+
std::string getMoveTypeString();
std::string getCrazyMoveTypeString();
@@ -66,6 +70,8 @@ class GameModifiers final
std::string getAttackTypeString();
+ std::string getQuickDropCounterString();
+
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 8275e1748..3a3e15b1c 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -152,7 +152,7 @@ void StatusPopup::updateLabels() const
InputAction::CHANGE_ATTACK_WEAPON_TYPE);
setLabelText(5, modifiers->getAttackTypeString(),
InputAction::CHANGE_ATTACK_TYPE);
- setLabelText(6, player_node->getQuickDropCounterString(),
+ setLabelText(6, modifiers->getQuickDropCounterString(),
InputAction::SWITCH_QUICK_DROP);
setLabelText(7, player_node->getPickUpTypeString(),
InputAction::CHANGE_PICKUP_TYPE);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 5be44f76b..2517239f5 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -652,7 +652,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
.append(translateLetter2(player_node->getMagicAttackString()))
.append(translateLetter2(player_node->getPvpAttackString()))
.append(" ").append(translateLetter2(
- player_node->getQuickDropCounterString()))
+ modifiers->getQuickDropCounterString()))
.append(translateLetter2(player_node->getPickUpTypeString()))
.append(" ").append(translateLetter2(
LocalPlayer::getMapDrawTypeString()))
diff --git a/src/settings.h b/src/settings.h
index 05c24a9b4..cd174a8fa 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -58,6 +58,7 @@ class Settings final
followMode(0U),
attackWeaponType(0U),
attackType(0U),
+ quickDropCounter(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -90,6 +91,7 @@ class Settings final
unsigned int followMode;
unsigned int attackWeaponType;
unsigned int attackType;
+ unsigned int quickDropCounter;
bool persistentIp;
bool limitFps;
bool inputFocused;