From 1a9a7ece01b6633e1fe860cba03bfd0d895c172d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Aug 2014 12:04:45 +0300 Subject: Move chat command /imitation into actions. --- src/actions/commands.cpp | 14 ++++++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 14 -------------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 26 insertions(+), 18 deletions(-) (limited to 'src') 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(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(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} }; -- cgit v1.2.3-70-g09d2