summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 01:46:03 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-08 01:46:03 +0000
commitdaa73fee2b89f16c42a05a7ab081699e024fab23 (patch)
tree06971d9b38d44e8fb6695f41b5e061580b054c33
parente32395931f516de22e064459fa6f58a3e583acdf (diff)
downloadmana-daa73fee2b89f16c42a05a7ab081699e024fab23.tar.gz
mana-daa73fee2b89f16c42a05a7ab081699e024fab23.tar.bz2
mana-daa73fee2b89f16c42a05a7ab081699e024fab23.tar.xz
mana-daa73fee2b89f16c42a05a7ab081699e024fab23.zip
Let the LocalPlayer decide whether it can walk to a destination.
-rw-r--r--ChangeLog7
-rw-r--r--src/gui/gui.cpp6
-rw-r--r--src/localplayer.cpp9
3 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e861d97..221c7c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-08 Björn Steinbrink <B.Steinbrink@gmx.de>
+
+ * src/localplayer.cpp, src/gui/gui.cpp: Let the LocalPlayer decide
+ whether it can walk to a destination.
+
2006-03-07 Yohann Ferreira <bertram@cegetel.net>
* trunk/debian/rules, trunk/debian/changelog,
@@ -8,7 +13,7 @@
* data/graphics/tiles/Makefile.am, data/graphics/tiles/Woodland.png:
Removed unused tileset.
-
+
2006-03-06 Björn Steinbrink <B.Steinbrink@gmx.de>
* configure.ac: Version changed to 0.0.19.
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index b52ff8e8..af9a1281 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -48,7 +48,6 @@
#include "../localplayer.h"
#include "../log.h"
#include "../main.h"
-#include "../map.h"
#include "../npc.h"
#include "../resources/image.h"
@@ -257,7 +256,8 @@ Gui::mousePress(int mx, int my, int button)
Being *being;
FloorItem *floorItem;
- if ((being = beingManager->findBeing(tilex, tiley)) && being->getType() != Being::LOCALPLAYER)
+ if ((being = beingManager->findBeing(tilex, tiley))
+ && being->getType() != Being::LOCALPLAYER)
{
showPopup(mx, my, being);
return;
@@ -310,7 +310,7 @@ Gui::mousePress(int mx, int my, int button)
player_node->pickUp(item);
}
// Just walk around
- else if (engine->getCurrentMap()->getWalk(tilex, tiley))
+ else
{
// XXX XXX XXX REALLY UGLY!
Uint8 *keys = SDL_GetKeyState(NULL);
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index e10fd3d6..29a2a54b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -178,7 +178,7 @@ void LocalPlayer::walk(unsigned char dir)
if (action == WALK)
{
- // Avoid sending the coordinates to the server
+ // Just finish the current action, otherwise we get out of sync
Being::setDestination(x, y);
return;
}
@@ -203,8 +203,7 @@ void LocalPlayer::walk(unsigned char dir)
if (dx && dy && !mMap->getWalk(x + dx, y + dy))
dx = 0;
- // Walk to where the player can actually go
- if ((dx || dy) && mMap->getWalk(x + dx, y + dy))
+ if (dx || dy)
{
setDestination(x + dx, y + dy);
}
@@ -218,6 +217,10 @@ void LocalPlayer::walk(unsigned char dir)
void LocalPlayer::setDestination(Uint16 x, Uint16 y)
{
+ // Check if we can walk there
+ if (!mMap->getWalk(x, y))
+ return;
+
char temp[3];
MessageOut outMsg(mNetwork);
set_coordinates(temp, x, y, direction);