From 4bb530a447cc08fbe176cface478898e0b35f5d1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 Aug 2014 13:16:08 +0300 Subject: Move chat command /party into actions. --- src/actions/chat.cpp | 17 +++++++++++++++++ src/actions/chat.h | 1 + src/commands.cpp | 17 ----------------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp index 58642db29..be6c88bbe 100644 --- a/src/actions/chat.cpp +++ b/src/actions/chat.cpp @@ -281,4 +281,21 @@ impHandler(createGuild) return true; } +impHandler(party) +{ + if (!event.tab) + return false; + + if (!event.args.empty()) + { + Net::getPartyHandler()->invite(event.args); + } + else + { + // TRANSLATORS: party invite message + event.tab->chatLog(_("Please specify a name."), ChatMsgType::BY_SERVER); + } + return true; +} + } // namespace Actions diff --git a/src/actions/chat.h b/src/actions/chat.h index 7bfb96aff..c575827fd 100644 --- a/src/actions/chat.h +++ b/src/actions/chat.h @@ -40,6 +40,7 @@ namespace Actions decHandler(clearChatTab); decHandler(createParty); decHandler(createGuild); + decHandler(party); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 9428dd6e3..f709e4a91 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -251,23 +251,6 @@ static void outStringNormal(ChatTab *const tab, } } -impHandler(party) -{ - if (!event.tab) - return false; - - if (!event.args.empty()) - { - Net::getPartyHandler()->invite(event.args); - } - else - { - // TRANSLATORS: party invite message - event.tab->chatLog(_("Please specify a name."), ChatMsgType::BY_SERVER); - } - return true; -} - impHandler(me) { outString(event.tab, strprintf("*%s*", event.args.c_str()), event.args); diff --git a/src/commands.h b/src/commands.h index 89dd71c45..c448ca4d3 100644 --- a/src/commands.h +++ b/src/commands.h @@ -51,7 +51,6 @@ struct CommandInfo final namespace Commands { - decHandler(party); decHandler(me); decHandler(toggle); decHandler(present); @@ -122,8 +121,7 @@ namespace Commands enum { - COMMAND_PARTY = 0, - COMMAND_ME, + COMMAND_ME = 0, COMMAND_TOGGLE, COMMAND_PRESENT, COMMAND_QUIT, @@ -193,7 +191,6 @@ enum static const CommandInfo commands[] = { - {"party", &Commands::party, -1, true}, {"me", &Commands::me, -1, true}, {"toggle", &Commands::toggle, -1, false}, {"present", &Commands::present, -1, false}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 091b72ae4..47414e0db 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -362,6 +362,7 @@ namespace InputAction CLEAN_FONTS, CREATE_PARTY, CREATE_GUILD, + PARTY, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index a7f1ae0a1..d01e870fb 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3027,6 +3027,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "createguild", + true}, + {"keyParty", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::party, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "party", true} }; -- cgit v1.2.3-70-g09d2