summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-17 00:02:23 +0100
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer>2011-03-17 00:02:23 +0100
commit452dc7f163749de0b5d698af2f022ca22c1aabb0 (patch)
tree5a84201f77bb71bc2ee2e1a4adb37220756d32b1 /src/gui/viewport.cpp
parent6846acdcf0159423c188b56fc4a5f4c19f123eb7 (diff)
downloadmana-452dc7f163749de0b5d698af2f022ca22c1aabb0.tar.gz
mana-452dc7f163749de0b5d698af2f022ca22c1aabb0.tar.bz2
mana-452dc7f163749de0b5d698af2f022ca22c1aabb0.tar.xz
mana-452dc7f163749de0b5d698af2f022ca22c1aabb0.zip
Now the client centers the pixel positions when using tA.
I made it so that the behaviour can be changed with only a boolean setting in the playerhandler.
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 459edab5..19bed735 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -37,6 +37,7 @@
#include "gui/beingpopup.h"
#include "net/net.h"
+#include "net/playerhandler.h"
#include "resources/resourcemanager.h"
@@ -270,12 +271,38 @@ void Viewport::_drawDebugPath(Graphics *graphics)
(int) playerPos.y - (int) mPixelViewY - playerRadius,
playerRadius * 2, playerRadius * 2));
- debugPath = mMap->findPixelPath(
- (int) playerPos.x,
- (int) playerPos.y,
- mMouseX + (int) mPixelViewX,
- mMouseY + (int) mPixelViewY,
- playerRadius, 0xFF);
+ // Prepare the walkmask corresponding to the protocol
+ unsigned char walkMask = 0;
+ switch (Net::getNetworkType())
+ {
+ case ServerInfo::TMWATHENA:
+ walkMask = Map::BLOCKMASK_WALL | Map::BLOCKMASK_CHARACTER;
+ break;
+ case ServerInfo::MANASERV:
+ default:
+ walkMask = Map::BLOCKMASK_WALL;
+ break;
+ }
+
+ // Adapt the path finding to the precision requested
+ if (Net::getPlayerHandler()->usePixelPrecision())
+ {
+ debugPath = mMap->findPixelPath(
+ (int) playerPos.x,
+ (int) playerPos.y,
+ mMouseX + (int) mPixelViewX,
+ mMouseY + (int) mPixelViewY,
+ playerRadius, walkMask);
+ }
+ else
+ {
+ debugPath = mMap->findTilePath(
+ (int) playerPos.x,
+ (int) playerPos.y,
+ mMouseX + (int) mPixelViewX,
+ mMouseY + (int) mPixelViewY,
+ walkMask);
+ }
// We draw the path proposed by mouse
_drawPath(graphics, debugPath, gcn::Color(128, 0, 128));