From 59d351895a3a15b517c4493fab89a62137b12157 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Sun, 10 May 2009 13:45:00 +1200 Subject: Modify keyboard handling The attack key now no longer changes the target if there is a target already set, and changing the target to the same being now no longer cancels the target since a dedicated Cancel Target Key now exists. --- src/game.cpp | 12 +----------- src/localplayer.cpp | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 3cfe2e3c..203629ff 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -920,24 +920,14 @@ void Game::handleInput() bool newTarget = !keyboard.isKeyActive(keyboard.KEY_TARGET); // A set target has highest priority - if (newTarget || !player_node->getTarget()) + if (!player_node->getTarget()) { Uint16 targetX = x, targetY = y; - switch (player_node->getSpriteDirection()) - { - case DIRECTION_UP : --targetY; break; - case DIRECTION_DOWN : ++targetY; break; - case DIRECTION_LEFT : --targetX; break; - case DIRECTION_RIGHT: ++targetX; break; - default: break; - } - // Only auto target Monsters target = beingManager->findNearestLivingBeing(targetX, targetY, 20, Being::MONSTER); } - player_node->attack(target, newTarget); } #endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index afd7f0eb..c68be7a8 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -526,7 +526,7 @@ void LocalPlayer::setTarget(Being *target) mLastTarget = tick_time; if (target == mTarget) - target = NULL; + return; if (target || mAction == ATTACK) { -- cgit v1.2.3-70-g09d2