summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp20
-rw-r--r--src/actionmanager.h2
-rw-r--r--src/game.cpp10
-rw-r--r--src/keyboarddata.h6
4 files changed, 25 insertions, 13 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index d3e34daa8..bbfaf5430 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -929,4 +929,24 @@ impHandler0(talk)
return false;
}
+impHandler0(stopAttack)
+{
+ if (player_node)
+ {
+ player_node->stopAttack();
+ return true;
+ }
+ return false;
+}
+
+impHandler0(untarget)
+{
+ if (player_node)
+ {
+ player_node->untarget();
+ return true;
+ }
+ return false;
+}
+
}
diff --git a/src/actionmanager.h b/src/actionmanager.h
index 05d84b989..0950b4e3d 100644
--- a/src/actionmanager.h
+++ b/src/actionmanager.h
@@ -85,6 +85,8 @@ namespace ActionManager
decHandler(directLeft);
decHandler(directRight);
decHandler(talk);
+ decHandler(stopAttack);
+ decHandler(untarget);
decHandler(hideWindows);
decHandler(helpWindowShow);
diff --git a/src/game.cpp b/src/game.cpp
index b05cd6d28..68d637829 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -862,16 +862,6 @@ void Game::handleMoveAndAttack()
mLastTarget = ActorSprite::UNKNOWN; // Reset last target
}
}
-
- // Stop attacking if the right key is pressed
- if (!inputManager.isActionActive(Input::KEY_ATTACK)
- && !inputManager.isActionActive(Input::KEY_EMOTE))
- {
- if (inputManager.isActionActive(Input::KEY_STOP_ATTACK))
- player_node->stopAttack();
- else if (inputManager.isActionActive(Input::KEY_UNTARGET))
- player_node->untarget();
- }
}
}
diff --git a/src/keyboarddata.h b/src/keyboarddata.h
index 5ea1daba3..d1b77f3ea 100644
--- a/src/keyboarddata.h
+++ b/src/keyboarddata.h
@@ -123,16 +123,16 @@ static KeyData const keyData[Input::KEY_TOTAL] = {
INPUT_KEYBOARD, SDLK_LSHIFT,
INPUT_JOYSTICK, 4,
Input::GRP_DEFAULT,
- nullptr,
+ &ActionManager::stopAttack,
Input::KEY_NO_VALUE, 50,
COND_GAME},
{"keyUnTarget",
INPUT_UNKNOWN, Input::KEY_NO_VALUE,
INPUT_UNKNOWN, Input::KEY_NO_VALUE,
Input::GRP_DEFAULT,
- nullptr,
+ &ActionManager::untarget,
Input::KEY_NO_VALUE, 50,
- COND_DEFAULT},
+ COND_GAME},
{"keyTargetClosest",
INPUT_KEYBOARD, SDLK_a,
INPUT_UNKNOWN, Input::KEY_NO_VALUE,