summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-21 21:39:00 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-21 21:39:00 +0300
commiteed7ef561a9d590d507255118132676f868b1bd3 (patch)
tree586f7f394c0d7678ed615525c6129fb9d787bf04 /src
parentc41fcc1f637e76e5ff671b223ce6c151af89e7d3 (diff)
downloadmv-eed7ef561a9d590d507255118132676f868b1bd3.tar.gz
mv-eed7ef561a9d590d507255118132676f868b1bd3.tar.bz2
mv-eed7ef561a9d590d507255118132676f868b1bd3.tar.xz
mv-eed7ef561a9d590d507255118132676f868b1bd3.zip
move "change pickup type" option into gamemodifiers.
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp2
-rw-r--r--src/being/localplayer.cpp44
-rw-r--r--src/being/localplayer.h9
-rw-r--r--src/gamemodifiers.cpp35
-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, 49 insertions, 51 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 21905063f..bbf3c9571 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -470,7 +470,7 @@ impHandler0(changeCrazyMove)
impHandler0(changePickupType)
{
- callYellowBar(changePickUpType);
+ callYellowBar2(changePickUpType);
}
impHandler0(moveToTarget)
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 3e6051643..035697a73 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -115,7 +115,6 @@ LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) :
mGMLevel(0),
mCrazyMoveState(0),
mMoveState(0),
- mPickUpType(config.getIntValue("pickUpType")),
mMagicAttackType(config.getIntValue("magicAttackType")),
mPvpAttackType(config.getIntValue("pvpAttackType")),
mImitationMode(config.getIntValue("imitationMode")),
@@ -478,7 +477,8 @@ bool LocalPlayer::pickUp(FloorItem *const item)
const int dy = item->getTileY() - mY;
int dist = 6;
- if (mPickUpType >= 4 && mPickUpType <= 6)
+ const unsigned int pickUpType = settings.pickUpType;
+ if (pickUpType >= 4 && pickUpType <= 6)
dist = 4;
if (dx * dx + dy * dy < dist)
@@ -489,7 +489,7 @@ bool LocalPlayer::pickUp(FloorItem *const item)
mPickUpTarget = nullptr;
}
}
- else if (mPickUpType >= 4 && mPickUpType <= 6)
+ else if (pickUpType >= 4 && pickUpType <= 6)
{
const Vector &playerPos = getPosition();
const Path debugPath = mMap->findPath(
@@ -1259,40 +1259,6 @@ void LocalPlayer::changeMode(unsigned *restrict const var,
debugMsg(str.substr(4));
}
-const unsigned pickUpTypeSize = 7;
-
-void LocalPlayer::changePickUpType(const bool forward)
-{
- changeMode(&mPickUpType, pickUpTypeSize, "pickUpType",
- &LocalPlayer::getPickUpTypeString, 0, true, forward);
-}
-
-static const char *const pickUpTypeStrings[] =
-{
- // TRANSLATORS: pickup size in status bar
- N_("(S) small pick up 1x1 cells"),
- // TRANSLATORS: pickup size in status bar
- N_("(D) default pick up 2x1 cells"),
- // TRANSLATORS: pickup size in status bar
- N_("(F) forward pick up 2x3 cells"),
- // TRANSLATORS: pickup size in status bar
- N_("(3) pick up 3x3 cells"),
- // TRANSLATORS: pickup size in status bar
- N_("(g) go and pick up in distance 4"),
- // TRANSLATORS: pickup size in status bar
- N_("(G) go and pick up in distance 8"),
- // TRANSLATORS: pickup size in status bar
- N_("(A) go and pick up in max distance"),
- // TRANSLATORS: pickup size in status bar
- N_("(?) pick up")
-};
-
-std::string LocalPlayer::getPickUpTypeString()
-{
- return gettext(getVarItem(&pickUpTypeStrings[0],
- mPickUpType, pickUpTypeSize));
-}
-
const unsigned debugPathSize = 7;
static const char *const debugPathStrings[] =
@@ -2334,7 +2300,7 @@ bool LocalPlayer::pickUpItems(int pickUpType)
status = pickUp(item);
if (pickUpType == 0)
- pickUpType = mPickUpType;
+ pickUpType = settings.pickUpType;
if (pickUpType == 0)
return status;
@@ -3500,7 +3466,7 @@ void LocalPlayer::resetYellowBar()
mMagicAttackType = config.resetIntValue("magicAttackType");
mPvpAttackType = config.resetIntValue("pvpAttackType");
settings.quickDropCounter = config.resetIntValue("quickDropCounter");
- mPickUpType = config.resetIntValue("pickUpType");
+ settings.pickUpType = config.resetIntValue("pickUpType");
if (viewport)
{
viewport->setMapDrawType(0);
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index 8660efd87..835e85dbe 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -191,11 +191,6 @@ class LocalPlayer final : public Being,
void changeImitationMode(const bool forward);
- void changePickUpType(const bool forward);
-
- int getPickUpType() const A_WARN_UNUSED
- { return mPickUpType; }
-
unsigned int getMoveState() const A_WARN_UNUSED
{ return mMoveState; }
@@ -417,8 +412,6 @@ class LocalPlayer final : public Being,
void setTestParticle(const std::string &fileName,
const bool updateHash = true);
- std::string getPickUpTypeString();
-
static std::string getMapDrawTypeString();
std::string getMagicAttackString();
@@ -493,8 +486,6 @@ class LocalPlayer final : public Being,
unsigned int mCrazyMoveState;
// move state. used if mMoveType == 2
unsigned int mMoveState;
- // pick up type 1x1, normal aka 2x1, forward aka 2x3, 3x3, 3x3 + 1
- unsigned int mPickUpType;
// magic attack type
unsigned int mMagicAttackType;
// pvp attack type
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index d98332f39..3f2650659 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -43,6 +43,7 @@ GameModifiers::GameModifiers()
settings.attackWeaponType = config.getIntValue("attackWeaponType");
settings.attackType = config.getIntValue("attackType");
settings.quickDropCounter = config.getIntValue("quickDropCounter");
+ settings.pickUpType = config.getIntValue("pickUpType");
}
GameModifiers::~GameModifiers()
@@ -315,3 +316,37 @@ void GameModifiers::setQuickDropCounter(const int n)
config.setValue("quickDropCounter", n);
UpdateStatusListener::distributeEvent();
}
+
+const unsigned pickUpTypeSize = 7;
+
+void GameModifiers::changePickUpType(const bool forward)
+{
+ changeMode(&settings.pickUpType, pickUpTypeSize, "pickUpType",
+ &GameModifiers::getPickUpTypeString, 0, true, forward);
+}
+
+static const char *const pickUpTypeStrings[] =
+{
+ // TRANSLATORS: pickup size in status bar
+ N_("(S) small pick up 1x1 cells"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(D) default pick up 2x1 cells"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(F) forward pick up 2x3 cells"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(3) pick up 3x3 cells"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(g) go and pick up in distance 4"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(G) go and pick up in distance 8"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(A) go and pick up in max distance"),
+ // TRANSLATORS: pickup size in status bar
+ N_("(?) pick up")
+};
+
+std::string GameModifiers::getPickUpTypeString()
+{
+ return gettext(getVarItem(&pickUpTypeStrings[0],
+ settings.pickUpType, pickUpTypeSize));
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index ed19773d8..b08955588 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -56,6 +56,8 @@ class GameModifiers final
void changeQuickDropCounter(const bool forward);
+ void changePickUpType(const bool forward);
+
void setQuickDropCounter(const int n);
std::string getMoveTypeString();
@@ -72,6 +74,8 @@ class GameModifiers final
std::string getQuickDropCounterString();
+ std::string getPickUpTypeString();
+
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 3a3e15b1c..0c7dc3bae 100644
--- a/src/gui/popups/statuspopup.cpp
+++ b/src/gui/popups/statuspopup.cpp
@@ -154,7 +154,7 @@ void StatusPopup::updateLabels() const
InputAction::CHANGE_ATTACK_TYPE);
setLabelText(6, modifiers->getQuickDropCounterString(),
InputAction::SWITCH_QUICK_DROP);
- setLabelText(7, player_node->getPickUpTypeString(),
+ setLabelText(7, modifiers->getPickUpTypeString(),
InputAction::CHANGE_PICKUP_TYPE);
setLabelText(8, LocalPlayer::getMapDrawTypeString(),
InputAction::PATHFIND);
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp
index 2517239f5..29d899711 100644
--- a/src/gui/windows/statuswindow.cpp
+++ b/src/gui/windows/statuswindow.cpp
@@ -653,7 +653,7 @@ void StatusWindow::updateStatusBar(ProgressBar *const bar,
.append(translateLetter2(player_node->getPvpAttackString()))
.append(" ").append(translateLetter2(
modifiers->getQuickDropCounterString()))
- .append(translateLetter2(player_node->getPickUpTypeString()))
+ .append(translateLetter2(modifiers->getPickUpTypeString()))
.append(" ").append(translateLetter2(
LocalPlayer::getMapDrawTypeString()))
.append(" ").append(translateLetter2(
diff --git a/src/settings.h b/src/settings.h
index cd174a8fa..e224eafb9 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -59,6 +59,7 @@ class Settings final
attackWeaponType(0U),
attackType(0U),
quickDropCounter(0U),
+ pickUpType(0U),
persistentIp(true),
limitFps(false),
inputFocused(true),
@@ -92,6 +93,7 @@ class Settings final
unsigned int attackWeaponType;
unsigned int attackType;
unsigned int quickDropCounter;
+ unsigned int pickUpType;
bool persistentIp;
bool limitFps;
bool inputFocused;