summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2008-10-28 19:50:23 +0000
committerIra Rice <irarice@gmail.com>2008-10-28 19:50:23 +0000
commitbd15dca49554b66c2921f99bbc0a5e5494019898 (patch)
tree6f569262a2ca88256477f1f2fc6b3e8204a773a4
parenta5c89d99f3a75bfa0d7a8605f310747772bb690b (diff)
downloadmana-bd15dca49554b66c2921f99bbc0a5e5494019898.tar.gz
mana-bd15dca49554b66c2921f99bbc0a5e5494019898.tar.bz2
mana-bd15dca49554b66c2921f99bbc0a5e5494019898.tar.xz
mana-bd15dca49554b66c2921f99bbc0a5e5494019898.zip
Fixed a fast walking bug that was caused by a state conflict
where the keys would tell the client to attack and stop attacking all at the same time. Thanks to SoftLace for reporting it.
-rw-r--r--src/game.cpp12
-rw-r--r--src/localplayer.cpp6
2 files changed, 9 insertions, 9 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 86427a7a..58c85e42 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -826,7 +826,7 @@ void Game::handleInput()
}
// Target the nearest player if 'q' is pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) )
+ if ( keyboard.isKeyActive(keyboard.KEY_TARGET_PLAYER) && !keyboard.isKeyActive(keyboard.KEY_TARGET) )
{
Being *target = beingManager->findNearestLivingBeing(player_node, 20, Being::PLAYER);
@@ -834,7 +834,7 @@ void Game::handleInput()
}
// Target the nearest monster if 'a' pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) )
+ if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) && !keyboard.isKeyActive(keyboard.KEY_TARGET) )
{
Being *target = beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER);
@@ -842,7 +842,7 @@ void Game::handleInput()
}
// Target the nearest npc if 'n' pressed
- if ( keyboard.isKeyActive(keyboard.KEY_TARGET_NPC) )
+ if ( keyboard.isKeyActive(keyboard.KEY_TARGET_NPC) && !keyboard.isKeyActive(keyboard.KEY_TARGET) )
{
Being *target = beingManager->findNearestLivingBeing(x, y, 20, Being::NPC);
@@ -866,6 +866,12 @@ void Game::handleInput()
}
}
+ // Stop attacking if shift is pressed
+ if (keyboard.isKeyActive(keyboard.KEY_TARGET))
+ {
+ player_node->stopAttack();
+ }
+
if (joystick)
{
if (joystick->buttonPressed(1))
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 87a4f81b..ee73b673 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -29,7 +29,6 @@
#include "game.h"
#include "inventory.h"
#include "item.h"
-#include "keyboardconfig.h"
#include "main.h"
#include "monster.h"
#include "particle.h"
@@ -130,11 +129,6 @@ void LocalPlayer::logic()
mLastTarget = -1;
}
- if (keyboard.isKeyActive(keyboard.KEY_TARGET))
- {
- stopAttack();
- }
-
if (mTarget)
{
if (mTarget->mAction == DEAD)