diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/viewport.cpp | 22 | ||||
-rw-r--r-- | src/gui/viewport.h | 4 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 01aa75ee..dc4b9721 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -86,6 +86,10 @@ Viewport::~Viewport() void Viewport::setMap(Map *map) { + if (mMap && map) + { + map->setDebugFlags(mMap->getDebugFlags()); + } mMap = map; } @@ -191,8 +195,10 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) if (mShowDebugPath) { mMap->drawCollision(graphics, (int) mPixelViewX, - (int) mPixelViewY); - _drawDebugPath(graphics); + (int) mPixelViewY, + mShowDebugPath); + if (mShowDebugPath == Map::MAP_DEBUG) + _drawDebugPath(graphics); } } @@ -462,3 +468,15 @@ void Viewport::mouseMoved(gcn::MouseEvent &event) mSelectedBeing = beingManager->findBeing(tilex, tiley); } + +void Viewport::toggleDebugPath() +{ + mShowDebugPath++; + if (mShowDebugPath > Map::MAP_SPECIAL) + mShowDebugPath = Map::MAP_NORMAL; + if (mMap) + { + mMap->setDebugFlags(mShowDebugPath); + } +} + diff --git a/src/gui/viewport.h b/src/gui/viewport.h index e4311222..e1030972 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -80,7 +80,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener, /** * Toggles whether the path debug graphics are shown */ - void toggleDebugPath() { mShowDebugPath = !mShowDebugPath; } + void toggleDebugPath(); /** * Handles mouse press on map. @@ -173,7 +173,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener, float mPixelViewY; /**< Current viewpoint in pixels. */ int mTileViewX; /**< Current viewpoint in tiles. */ int mTileViewY; /**< Current viewpoint in tiles. */ - bool mShowDebugPath; /**< Show a path from player to pointer. */ + int mShowDebugPath; /**< Show a path from player to pointer. */ bool mVisibleNames; /**< Show target names. */ bool mPlayerFollowMouse; |