summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-26 12:04:45 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-26 12:04:45 +0300
commit1a9a7ece01b6633e1fe860cba03bfd0d895c172d (patch)
treeda2b92377903081be4746a2eb8ce5a879c334691
parentae4062ed3c48706127c32efbc70cca0cc5ce19f8 (diff)
downloadmv-1a9a7ece01b6633e1fe860cba03bfd0d895c172d.tar.gz
mv-1a9a7ece01b6633e1fe860cba03bfd0d895c172d.tar.bz2
mv-1a9a7ece01b6633e1fe860cba03bfd0d895c172d.tar.xz
mv-1a9a7ece01b6633e1fe860cba03bfd0d895c172d.zip
Move chat command /imitation into actions.
-rw-r--r--src/actions/commands.cpp14
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/commands.cpp14
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
6 files changed, 26 insertions, 18 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 29e7e740c..29414b18d 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -409,4 +409,18 @@ impHandler(navigate)
return true;
}
+impHandler(imitation)
+{
+ if (!localPlayer)
+ return false;
+
+ if (!event.args.empty())
+ localPlayer->setImitate(event.args);
+ else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
+ localPlayer->setImitate(static_cast<WhisperTab*>(event.tab)->getNick());
+ else
+ localPlayer->setImitate("");
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index f5f4b4a5e..fbee9e125 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -47,6 +47,7 @@ namespace Actions
decHandler(pseudoAway);
decHandler(follow);
decHandler(navigate);
+ decHandler(imitation);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 0929d525d..464148a87 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -151,20 +151,6 @@ static void outStringNormal(ChatTab *const tab,
}
}
-impHandler(imitation)
-{
- if (!localPlayer)
- return false;
-
- if (!event.args.empty())
- localPlayer->setImitate(event.args);
- else if (event.tab && event.tab->getType() == ChatTabType::WHISPER)
- localPlayer->setImitate(static_cast<WhisperTab*>(event.tab)->getNick());
- else
- localPlayer->setImitate("");
- return true;
-}
-
impHandler(hack)
{
Net::getChatHandler()->sendRaw(event.args);
diff --git a/src/commands.h b/src/commands.h
index 19c311320..0f42ddb9a 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(imitation);
decHandler(mail);
decHandler(hack);
decHandler(priceLoad);
@@ -105,8 +104,7 @@ namespace Commands
enum
{
- COMMAND_IMITATION = 0,
- COMMAND_MAIL,
+ COMMAND_MAIL = 0,
COMMAND_TRADE,
COMMAND_PRICELOAD,
COMMAND_PRICESAVE,
@@ -159,7 +157,6 @@ enum
static const CommandInfo commands[] =
{
- {"imitation", &Commands::imitation, -1, true},
{"mail", &Commands::mail, -1, true},
{"trade", &Commands::trade, -1, true},
{"priceload", &Commands::priceLoad, -1, false},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 7a9dcaecf..aa7cd90a4 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -377,6 +377,7 @@ namespace InputAction
PSEUDO_AWAY,
FOLLOW,
NAVIGATE,
+ IMITATION,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index ca359804b..01953a71d 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3162,6 +3162,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"navigate",
+ true},
+ {"keyImitation",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::imitation,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "imitation",
true}
};