summaryrefslogtreecommitdiff
path: root/src/gui/viewport.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2008-04-17 16:23:36 +0000
committerYohann Ferreira <bertram@cegetel.net>2008-04-17 16:23:36 +0000
commitc93e1faa1034519c26ef4481c7cfd0bd465a6d85 (patch)
tree78bce6818146f358b63a586196030d5a4f021ad0 /src/gui/viewport.cpp
parent1f639454d986ea0d44b563eaa71019d9f1c01c24 (diff)
downloadmana-c93e1faa1034519c26ef4481c7cfd0bd465a6d85.tar.gz
mana-c93e1faa1034519c26ef4481c7cfd0bd465a6d85.tar.bz2
mana-c93e1faa1034519c26ef4481c7cfd0bd465a6d85.tar.xz
mana-c93e1faa1034519c26ef4481c7cfd0bd465a6d85.zip
Added input type parameter to the LocalPlayer::SetDestination methods in order to keep control over
message flooding to the server with mouse dragging. (I need feedback !)
Diffstat (limited to 'src/gui/viewport.cpp')
-rw-r--r--src/gui/viewport.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 33449659..1b6cfa1c 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -253,9 +253,10 @@ Viewport::logic()
if (mPlayerFollowMouse && button & SDL_BUTTON(1) &&
mWalkTime != player_node->mWalkTime)
{
- player_node->setDestination(mouseX + (int) mViewX,
- mouseY + (int) mViewY);
- mWalkTime = player_node->mWalkTime;
+ player_node->setDestination(mouseX + (int) mViewX,
+ mouseY + (int) mViewY,
+ BY_MOUSE);
+ mWalkTime = player_node->mWalkTime;
}
for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++)
@@ -396,12 +397,14 @@ Viewport::mousePressed(gcn::MouseEvent &event)
// Just walk around
else
{
- // XXX XXX XXX REALLY UGLY!
+ // FIXME: REALLY UGLY!
Uint8 *keys = SDL_GetKeyState(NULL);
if (!(keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT]))
{
+
player_node->setDestination(event.getX() + (int) mViewX,
- event.getY() + (int) mViewY);
+ event.getY() + (int) mViewY,
+ BY_MOUSE);
}
mPlayerFollowMouse = true;
}
@@ -429,7 +432,8 @@ Viewport::mouseDragged(gcn::MouseEvent &event)
if (mPlayerFollowMouse && mWalkTime == player_node->mWalkTime)
{
player_node->setDestination(event.getX() + (int) mViewX,
- event.getY() + (int) mViewY);
+ event.getY() + (int) mViewY,
+ BY_MOUSE);
}
}