From 7b882f006038b0b24a86ca285afb005125dc5d2d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 26 Aug 2014 21:09:56 +0300 Subject: Move chat command /info into actions. --- src/actions/commands.cpp | 23 +++++++++++++++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 20 -------------------- src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 6e8fca4a0..2e0f8d6fe 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -71,6 +71,7 @@ #include "gui/widgets/tabs/whispertab.h" #include "net/adminhandler.h" +#include "net/guildhandler.h" #include "net/pethandler.h" #include "net/net.h" @@ -79,6 +80,8 @@ #include "debug.h" +extern unsigned int tmwServerVersion; + namespace Actions { @@ -434,4 +437,24 @@ impHandler(sendMail) return false; } +impHandler(info) +{ + if (!event.tab || !localPlayer || tmwServerVersion > 0) + return false; + + switch (event.tab->getType()) + { + case ChatTabType::GUILD: + { + const Guild *const guild = localPlayer->getGuild(); + if (guild) + Net::getGuildHandler()->info(guild->getId()); + break; + } + default: + break; + } + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 98f13b2d5..d0730fe01 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -49,6 +49,7 @@ namespace Actions decHandler(navigate); decHandler(imitation); decHandler(sendMail); + decHandler(info); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index acb240b28..64d0e7e52 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -157,26 +157,6 @@ impHandler(hack) return true; } -impHandler(info) -{ - if (!event.tab || !localPlayer || tmwServerVersion > 0) - return false; - - switch (event.tab->getType()) - { - case ChatTabType::GUILD: - { - const Guild *const guild = localPlayer->getGuild(); - if (guild) - Net::getGuildHandler()->info(guild->getId()); - break; - } - default: - break; - } - return true; -} - impHandler(wait) { if (localPlayer) diff --git a/src/commands.h b/src/commands.h index d5c7b2e35..920499582 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(hack); - decHandler(info); decHandler(wait); decHandler(uptime); decHandler(addAttack); @@ -95,8 +94,7 @@ namespace Commands enum { - COMMAND_INFO = 0, - COMMAND_WAIT, + COMMAND_WAIT = 0, COMMAND_UPTIME, COMMAND_ADDPRIORITYATTACK, COMMAND_ADDATTACK, @@ -139,7 +137,6 @@ enum static const CommandInfo commands[] = { - {"info", &Commands::info, -1, false}, {"wait", &Commands::wait, -1, true}, {"uptime", &Commands::uptime, -1, false}, {"addpriorityattack", &Commands::addPriorityAttack, -1, true}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index e57deb0bc..b5dabdfec 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -386,6 +386,7 @@ namespace InputAction DISCONNECT, UNDRESS, DIRS, + INFO, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index 10dbcf90f..2048b845f 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3243,6 +3243,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "dirs", + false}, + {"keyInfo", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::info, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "info", false} }; -- cgit v1.2.3-60-g2f50