diff options
author | David Athay <ko2fan@gmail.com> | 2009-05-26 15:25:55 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-05-26 15:33:49 +0100 |
commit | 802481a7e19c45da2128de18359b44f1a95c476c (patch) | |
tree | 7c9bc341c16547ed30fe7212b0d672607ce19bf5 /src/game.cpp | |
parent | cd5ca5b198f7345f363dba322f49a8e3703dd431 (diff) | |
download | mana-802481a7e19c45da2128de18359b44f1a95c476c.tar.gz mana-802481a7e19c45da2128de18359b44f1a95c476c.tar.bz2 mana-802481a7e19c45da2128de18359b44f1a95c476c.tar.xz mana-802481a7e19c45da2128de18359b44f1a95c476c.zip |
Fixed attacking for tmwserv. Added back attacking with keyboard for tmwserv.
Diffstat (limited to 'src/game.cpp')
-rw-r--r-- | src/game.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
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(); |