diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-07-22 17:44:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-07-22 17:44:11 +0300 |
commit | 1995e723df5d5aef32b289c0122493ee6fe18b0e (patch) | |
tree | b8dc80f75ac17732c80574fe40910d02e8b90a1b | |
parent | 35263d0f161f59f2dec6586c61970eaf1ce2f6f1 (diff) | |
download | manaplus-1995e723df5d5aef32b289c0122493ee6fe18b0e.tar.gz manaplus-1995e723df5d5aef32b289c0122493ee6fe18b0e.tar.bz2 manaplus-1995e723df5d5aef32b289c0122493ee6fe18b0e.tar.xz manaplus-1995e723df5d5aef32b289c0122493ee6fe18b0e.zip |
Move "map draw type" variable into settings.
-rw-r--r-- | src/being/localplayer.cpp | 2 | ||||
-rw-r--r-- | src/gamemodifiers.cpp | 2 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 20 | ||||
-rw-r--r-- | src/gui/viewport.h | 7 | ||||
-rw-r--r-- | src/settings.h | 4 |
5 files changed, 17 insertions, 18 deletions
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 312efacd9..36275dbbe 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -3325,7 +3325,7 @@ void LocalPlayer::resetYellowBar() settings.pickUpType = config.resetIntValue("pickUpType"); if (viewport) { - viewport->setMapDrawType(0); + settings.mapDrawType = MapType::NORMAL; if (viewport->getCameraMode()) viewport->toggleCameraMode(); } diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index e7182c450..7c94b5c4c 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -490,5 +490,5 @@ static const char *const mapDrawTypeStrings[] = std::string GameModifiers::getMapDrawTypeString() { return gettext(getVarItem(&mapDrawTypeStrings[0], - viewport->getMapDrawType(), mapDrawTypeSize)); + settings.mapDrawType, mapDrawTypeSize)); } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index fb52607c7..5a2c9cc91 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -25,6 +25,7 @@ #include "actormanager.h" #include "configuration.h" #include "game.h" +#include "settings.h" #include "sdlshared.h" #include "textmanager.h" @@ -79,7 +80,6 @@ Viewport::Viewport() : mMousePressY(0), mPixelViewX(0), mPixelViewY(0), - mMapDrawType(MapType::NORMAL), mCameraMode(0), mLocalWalkTime(-1), mCameraRelativeX(0), @@ -241,14 +241,15 @@ void Viewport::draw(Graphics *graphics) // Draw tiles and sprites mMap->draw(graphics, mPixelViewX, mPixelViewY); - if (mMapDrawType != MapType::NORMAL) + const MapType::MapType drawType = settings.mapDrawType; + if (drawType != MapType::NORMAL) { - if (mMapDrawType != MapType::SPECIAL4) + if (drawType != MapType::SPECIAL4) { mMap->drawCollision(graphics, mPixelViewX, - mPixelViewY, mMapDrawType); + mPixelViewY, drawType); } - if (mMapDrawType == MapType::DEBUG) + if (drawType == MapType::DEBUG) drawDebugPath(graphics); } @@ -1001,11 +1002,12 @@ void Viewport::mouseMoved(MouseEvent &event A_UNUSED) void Viewport::toggleMapDrawType() { - mMapDrawType++; - if (mMapDrawType > MapType::BLACKWHITE) - mMapDrawType = MapType::NORMAL; + settings.mapDrawType = static_cast<MapType::MapType>( + static_cast<int>(settings.mapDrawType) + 1); + if (settings.mapDrawType > MapType::BLACKWHITE) + settings.mapDrawType = MapType::NORMAL; if (mMap) - mMap->setDrawLayersFlags(mMapDrawType); + mMap->setDrawLayersFlags(settings.mapDrawType); } void Viewport::toggleCameraMode() diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 4a7abea93..9ed4b3f7f 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -242,12 +242,6 @@ class Viewport final : public WindowContainer, void scrollBy(const int x, const int y) { mPixelViewX += x; mPixelViewY += y; } - int getMapDrawType() const A_WARN_UNUSED - { return mMapDrawType; } - - void setMapDrawType(const int n) - { mMapDrawType = n; } - int getCameraMode() const A_WARN_UNUSED { return mCameraMode; } @@ -344,7 +338,6 @@ class Viewport final : public WindowContainer, int mMousePressY; int mPixelViewX; /**< Current viewpoint in pixels. */ int mPixelViewY; /**< Current viewpoint in pixels. */ - int mMapDrawType; /**< Show a path from player to pointer. */ int mCameraMode; /**< Camera mode. */ int mLocalWalkTime; /**< Timestamp before the next walk can be sent. */ diff --git a/src/settings.h b/src/settings.h index e64a4fba3..21b0fdf91 100644 --- a/src/settings.h +++ b/src/settings.h @@ -23,6 +23,8 @@ #include "options.h" +#include "resources/map/maptype.h" + #include <string> #include <vector> @@ -63,6 +65,7 @@ class Settings final magicAttackType(0U), pvpAttackType(0U), imitationMode(0U), + mapDrawType(MapType::NORMAL), persistentIp(true), limitFps(false), inputFocused(true), @@ -101,6 +104,7 @@ class Settings final unsigned int magicAttackType; unsigned int pvpAttackType; unsigned int imitationMode; + MapType::MapType mapDrawType; bool persistentIp; bool limitFps; bool inputFocused; |