summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-26 00:53:29 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-26 00:53:29 +0300
commite2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd (patch)
treeee5204871bd3fe6bdc5638d7ee95a75ceb8efe95
parent6e99f459bf4895e41118dbcf00ed3ba027b5b952 (diff)
downloadmanaplus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.tar.gz
manaplus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.tar.bz2
manaplus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.tar.xz
manaplus-e2dddbdd9599b9b1f6a9825ee06d4d3616d9d1dd.zip
Move chat command /follow into actions.
-rw-r--r--src/actions/commands.cpp26
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/commands.cpp15
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
-rw-r--r--src/input/pages/basic.cpp6
7 files changed, 44 insertions, 19 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index e32aee7a3..5038d9f57 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -21,6 +21,7 @@
#include "actions/commands.h"
#include "actormanager.h"
+#include "configuration.h"
#include "dropshortcut.h"
#include "emoteshortcut.h"
#include "game.h"
@@ -368,4 +369,29 @@ impHandler(pseudoAway)
return false;
}
+impHandler(follow)
+{
+ if (!localPlayer)
+ return false;
+
+ if (!features.getBoolValue("allowFollow"))
+ return false;
+
+ if (!event.args.empty())
+ {
+ localPlayer->setFollow(event.args);
+ }
+ else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
+ {
+ localPlayer->setFollow(static_cast<WhisperTab*>(event.tab)->getNick());
+ }
+ else
+ {
+ const Being *const being = localPlayer->getTarget();
+ if (being != nullptr)
+ localPlayer->setFollow(being->getName());
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 8f6813210..7034d0638 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -45,6 +45,7 @@ namespace Actions
decHandler(commandEmotePet);
decHandler(awayMessage);
decHandler(pseudoAway);
+ decHandler(follow);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 68a40bbcc..7494c45d2 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -166,21 +166,6 @@ impHandler(navigate)
return true;
}
-impHandler(follow)
-{
- if (!localPlayer)
- return false;
-
- if (!features.getBoolValue("allowFollow"))
- return false;
-
- if (!event.args.empty())
- localPlayer->setFollow(event.args);
- else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
- localPlayer->setFollow(static_cast<WhisperTab*>(event.tab)->getNick());
- return true;
-}
-
impHandler(imitation)
{
if (!localPlayer)
diff --git a/src/commands.h b/src/commands.h
index 761af598a..28add6b34 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(follow);
decHandler(imitation);
decHandler(heal);
decHandler(navigate);
@@ -108,8 +107,7 @@ namespace Commands
enum
{
- COMMAND_FOLLOW = 0,
- COMMAND_HEAL,
+ COMMAND_HEAL = 0,
COMMAND_NAVIGATE,
COMMAND_IMITATION,
COMMAND_MAIL,
@@ -165,7 +163,6 @@ enum
static const CommandInfo commands[] =
{
- {"follow", &Commands::follow, -1, true},
{"heal", &Commands::heal, -1, true},
{"navigate", &Commands::navigate, -1, true},
{"imitation", &Commands::imitation, -1, true},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 007d03d66..55310593a 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -375,6 +375,7 @@ namespace InputAction
COMMAND_EMOTE_PET,
AWAY_MESSAGE,
PSEUDO_AWAY,
+ FOLLOW,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 08b8b7c40..e773dffdb 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3144,6 +3144,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"pseudoaway",
+ true},
+ {"keyFollow",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::follow,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "follow",
true}
};
diff --git a/src/input/pages/basic.cpp b/src/input/pages/basic.cpp
index f91b495de..2c784d804 100644
--- a/src/input/pages/basic.cpp
+++ b/src/input/pages/basic.cpp
@@ -173,6 +173,12 @@ SetupActionData setupActionDataBasic[] =
},
{
// TRANSLATORS: input action name
+ N_("Follow selected player"),
+ InputAction::FOLLOW,
+ "",
+ },
+ {
+ // TRANSLATORS: input action name
N_("Change Map View Mode"),
InputAction::PATHFIND,
"",