summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-07-25 19:13:27 +0300
committerAndrei Karas <akaras@inbox.ru>2014-07-25 19:13:27 +0300
commit7d6d3d997614e8e76ca9044ca8ed5a81d3b14a95 (patch)
tree16e2456b0eda0e4dd81863374206038c6eb4e26f
parentd4e289e6bed3cff65e106fc6ed5aabfedb4e7da8 (diff)
downloadManaVerse-7d6d3d997614e8e76ca9044ca8ed5a81d3b14a95.tar.gz
ManaVerse-7d6d3d997614e8e76ca9044ca8ed5a81d3b14a95.tar.bz2
ManaVerse-7d6d3d997614e8e76ca9044ca8ed5a81d3b14a95.tar.xz
ManaVerse-7d6d3d997614e8e76ca9044ca8ed5a81d3b14a95.zip
Move reset yellow bar into gamemmodifiers.
-rw-r--r--src/being/localplayer.cpp27
-rw-r--r--src/being/localplayer.h2
-rw-r--r--src/gamemodifiers.cpp30
-rw-r--r--src/gamemodifiers.h2
-rw-r--r--src/gui/popups/popupmenu.cpp5
5 files changed, 35 insertions, 31 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index c3937badc..a980ec73b 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -3204,33 +3204,6 @@ void LocalPlayer::checkNewName(Being *const being)
}
}
-void LocalPlayer::resetYellowBar()
-{
- settings.moveType = 0;
- settings.crazyMoveType = config.resetIntValue("crazyMoveType");
- settings.moveToTargetType = config.resetIntValue("moveToTargetType");
- settings.followMode = config.resetIntValue("followMode");
- settings.attackWeaponType = config.resetIntValue("attackWeaponType");
- settings.attackType = config.resetIntValue("attackType");
- settings.magicAttackType = config.resetIntValue("magicAttackType");
- settings.pvpAttackType = config.resetIntValue("pvpAttackType");
- settings.quickDropCounter = config.resetIntValue("quickDropCounter");
- settings.pickUpType = config.resetIntValue("pickUpType");
- if (viewport)
- {
- settings.mapDrawType = MapType::NORMAL;
- if (settings.cameraMode)
- viewport->toggleCameraMode();
- }
- if (mMap)
- mMap->setDrawLayersFlags(0);
- settings.imitationMode = config.resetIntValue("imitationMode");
- settings.disableGameModifiers = config.resetBoolValue(
- "disableGameModifiers");
-
- UpdateStatusListener::distributeEvent();
-}
-
unsigned char LocalPlayer::getWalkMask() const
{
// for now blocking all types of collisions
diff --git a/src/being/localplayer.h b/src/being/localplayer.h
index c01032e8e..de78981cc 100644
--- a/src/being/localplayer.h
+++ b/src/being/localplayer.h
@@ -366,8 +366,6 @@ class LocalPlayer final : public Being,
void checkNewName(Being *const being);
- void resetYellowBar();
-
unsigned char getWalkMask() const override final A_WARN_UNUSED;
void saveHomes();
diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp
index 2db410884..57a51b0e8 100644
--- a/src/gamemodifiers.cpp
+++ b/src/gamemodifiers.cpp
@@ -35,6 +35,8 @@
#include "gui/widgets/tabs/chattab.h"
+#include "resources/map/map.h"
+
#include "listeners/awaylistener.h"
#include "listeners/updatestatuslistener.h"
@@ -449,3 +451,31 @@ addModifier(CameraMode, cameraMode, 2,
// TRANSLATORS: camera mode in status bar
N_("(?) away")
})
+
+void GameModifiers::resetModifiers()
+{
+ settings.moveType = 0;
+ settings.crazyMoveType = config.resetIntValue("crazyMoveType");
+ settings.moveToTargetType = config.resetIntValue("moveToTargetType");
+ settings.followMode = config.resetIntValue("followMode");
+ settings.attackWeaponType = config.resetIntValue("attackWeaponType");
+ settings.attackType = config.resetIntValue("attackType");
+ settings.magicAttackType = config.resetIntValue("magicAttackType");
+ settings.pvpAttackType = config.resetIntValue("pvpAttackType");
+ settings.quickDropCounter = config.resetIntValue("quickDropCounter");
+ settings.pickUpType = config.resetIntValue("pickUpType");
+ settings.mapDrawType = MapType::NORMAL;
+ if (viewport)
+ {
+ if (settings.cameraMode)
+ viewport->toggleCameraMode();
+ Map *const map = viewport->getMap();
+ if (map)
+ map->setDrawLayersFlags(0);
+ }
+ settings.imitationMode = config.resetIntValue("imitationMode");
+ settings.disableGameModifiers = config.resetBoolValue(
+ "disableGameModifiers");
+
+ UpdateStatusListener::distributeEvent();
+}
diff --git a/src/gamemodifiers.h b/src/gamemodifiers.h
index 10ea579d9..8ca57ef3f 100644
--- a/src/gamemodifiers.h
+++ b/src/gamemodifiers.h
@@ -100,6 +100,8 @@ class GameModifiers final
std::string getCameraModeString();
+ void resetModifiers();
+
protected:
static const char *getVarItem(const char *const *const arr,
const unsigned index,
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 687aa38cf..1712ce34b 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -28,6 +28,7 @@
#include "configuration.h"
#include "dropshortcut.h"
#include "game.h"
+#include "gamemodifiers.h"
#include "guild.h"
#include "guildmanager.h"
#include "item.h"
@@ -1721,8 +1722,8 @@ void PopupMenu::handleLink(const std::string &link,
}
else if (link == "reset yellow")
{
- if (player_node)
- player_node->resetYellowBar();
+ if (modifiers)
+ modifiers->resetModifiers();
}
else if (link == "bar to chat" && !mNick.empty())
{