From 94deb596ae86bfe453c9d88e85266caae26e3980 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Fri, 20 Jan 2012 01:42:11 +0100 Subject: Simplified and made generic the way the pickup is handled. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I also made the range be taken from the server type as for the pickup and npc talk ranges. Last but no least, I fixed the parameters sent with PGMSG_PICKUP to send the (item) position where to pickup at as described in the manaserv protocol. The pickup is still not 100% functional due certainly to two problems: 1. The client item coordinates might not be the exact same as in the server. 2. The client seems to try to pick up the item a bit too soon, probably for the reason given in 1. I'll investigate this in another patch. Reviewed-by: Thorbjørn Lindeijer, Erik Schilling. --- src/gui/viewport.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/gui/viewport.cpp') diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 855a05e4..fd6bc6a3 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -468,12 +468,17 @@ void Viewport::mousePressed(gcn::MouseEvent &event) // Ignore it if its dead if (mHoverBeing->isAlive()) { - if (local_player->withinAttackRange(mHoverBeing) || - keyboard.isKeyActive(keyboard.KEY_ATTACK)) + if (local_player->withinRange(mHoverBeing, + local_player->getAttackRange()) + || keyboard.isKeyActive(keyboard.KEY_ATTACK)) + { local_player->attack(mHoverBeing, !keyboard.isKeyActive(keyboard.KEY_TARGET)); + } else + { local_player->setGotoTarget(mHoverBeing); + } } } // Picks up a item if we clicked on one -- cgit v1.2.3-60-g2f50