summaryrefslogtreecommitdiff
path: root/src/actionmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-06-06 14:49:47 +0300
committerAndrei Karas <akaras@inbox.ru>2014-06-06 14:49:47 +0300
commitc649cf883480071c9b93909c4ea4ee5ec98155b2 (patch)
tree71022fd2db59c643c19c78c5524ffcd038e35a7f /src/actionmanager.cpp
parent4cab6fc78e19799f223d951d5ccc9afb303b65f2 (diff)
downloadmanaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.gz
manaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.bz2
manaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.xz
manaplus-c649cf883480071c9b93909c4ea4ee5ec98155b2.zip
Remove some duplicate code.
Diffstat (limited to 'src/actionmanager.cpp')
-rw-r--r--src/actionmanager.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp
index 10b51cb41..5c0bf85fd 100644
--- a/src/actionmanager.cpp
+++ b/src/actionmanager.cpp
@@ -663,14 +663,19 @@ impHandler0(pickup)
return false;
}
+static void doSit()
+{
+ if (inputManager.isActionActive(InputAction::EMOTE))
+ player_node->updateSit();
+ else
+ player_node->toggleSit();
+}
+
impHandler0(sit)
{
if (player_node)
{
- if (inputManager.isActionActive(InputAction::EMOTE))
- player_node->updateSit();
- else
- player_node->toggleSit();
+ doSit();
return true;
}
return false;
@@ -1147,10 +1152,8 @@ impHandler0(stopSit)
return false;
if (!player_node->getTarget())
{
- if (inputManager.isActionActive(InputAction::EMOTE))
- player_node->updateSit();
- else
- player_node->toggleSit();
+ doSit();
+ return true;
}
return true;
}