From 802481a7e19c45da2128de18359b44f1a95c476c Mon Sep 17 00:00:00 2001 From: David Athay Date: Tue, 26 May 2009 15:25:55 +0100 Subject: Fixed attacking for tmwserv. Added back attacking with keyboard for tmwserv. --- src/game.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index 98985e74..41bcc9cc 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -728,7 +728,7 @@ void Game::handleInput() default: break; } - if (keyboard.isEnabled() && + if (keyboard.isEnabled() && !chatWindow->isInputFocused() && !npcDialog->isInputFocused()) { const int tKey = keyboard.getKeyIndex(event.key.keysym.sym); @@ -988,7 +988,7 @@ void Game::handleInput() } #else player_node->setWalkingDir(direction); - +#endif // Attacking monsters if (keyboard.isKeyActive(keyboard.KEY_ATTACK) || (joystick && joystick->buttonPressed(0))) @@ -1005,7 +1005,11 @@ void Game::handleInput() // A set target has highest priority if (!player_node->getTarget()) { +#ifdef TMWSERV_SUPPORT + Uint16 targetX = x / 32, targetY = y / 32; +#else Uint16 targetX = x, targetY = y; +#endif // Only auto target Monsters target = beingManager->findNearestLivingBeing(targetX, targetY, 20, Being::MONSTER); @@ -1013,8 +1017,6 @@ void Game::handleInput() player_node->attack(target, newTarget); } -#endif - // Target the nearest player/monster/npc if ((keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) || keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) || @@ -1058,7 +1060,7 @@ void Game::handleInput() } // Stop attacking if the right key is pressed - if (!keyboard.isKeyActive(keyboard.KEY_ATTACK) + if (!keyboard.isKeyActive(keyboard.KEY_ATTACK) && keyboard.isKeyActive(keyboard.KEY_TARGET)) { player_node->stopAttack(); -- cgit v1.2.3-60-g2f50