From 61536d859c62518718d17e82e21b3a2459de3410 Mon Sep 17 00:00:00 2001 From: Björn Steinbrink Date: Wed, 8 Mar 2006 14:49:14 +0000 Subject: Reverted changes from r2225, it broke walking code as I missed the differences between tile and being collisions. --- src/gui/gui.cpp | 6 +++--- src/localplayer.cpp | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index af9a1281..b52ff8e8 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -48,6 +48,7 @@ #include "../localplayer.h" #include "../log.h" #include "../main.h" +#include "../map.h" #include "../npc.h" #include "../resources/image.h" @@ -256,8 +257,7 @@ 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 + else if (engine->getCurrentMap()->getWalk(tilex, tiley)) { // XXX XXX XXX REALLY UGLY! Uint8 *keys = SDL_GetKeyState(NULL); diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 29a2a54b..89302ea2 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -203,7 +203,8 @@ void LocalPlayer::walk(unsigned char dir) if (dx && dy && !mMap->getWalk(x + dx, y + dy)) dx = 0; - if (dx || dy) + // Walk to where the player can actually go + if ((dx || dy) && mMap->getWalk(x + dx, y + dy)) { setDestination(x + dx, y + dy); } @@ -217,10 +218,6 @@ 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); -- cgit v1.2.3-70-g09d2