summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-25 13:10:52 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-25 13:10:52 +0300
commitb063ffa91bbeb324568ae84cde9a90fbb28797f7 (patch)
tree26d6be637bde193829ce4e6ccb7d17e4c0ab6d1a
parente62706843143949918653a03cc0cbf6620687a60 (diff)
downloadplus-b063ffa91bbeb324568ae84cde9a90fbb28797f7.tar.gz
plus-b063ffa91bbeb324568ae84cde9a90fbb28797f7.tar.bz2
plus-b063ffa91bbeb324568ae84cde9a90fbb28797f7.tar.xz
plus-b063ffa91bbeb324568ae84cde9a90fbb28797f7.zip
Move chat command /createguild into actions.
-rw-r--r--src/actions/chat.cpp19
-rw-r--r--src/actions/chat.h1
-rw-r--r--src/commands.cpp17
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
6 files changed, 31 insertions, 21 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 22d31fbb9..58642db29 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -68,6 +68,7 @@
#include "gui/widgets/tabs/chattab.h"
+#include "net/guildhandler.h"
#include "net/net.h"
#include "net/partyhandler.h"
@@ -79,6 +80,7 @@
extern ShortcutWindow *spellShortcutWindow;
extern std::string tradePartnerName;
extern QuitDialog *quitDialog;
+extern unsigned int tmwServerVersion;
namespace Actions
{
@@ -262,4 +264,21 @@ impHandler(createParty)
return true;
}
+impHandler(createGuild)
+{
+ if (!event.tab || tmwServerVersion > 0)
+ return false;
+
+ if (event.args.empty())
+ {
+ // TRANSLATORS: create guild message
+ event.tab->chatLog(_("Guild name is missing."), ChatMsgType::BY_SERVER);
+ }
+ else
+ {
+ Net::getGuildHandler()->create(event.args);
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/chat.h b/src/actions/chat.h
index 7cb453872..7bfb96aff 100644
--- a/src/actions/chat.h
+++ b/src/actions/chat.h
@@ -39,6 +39,7 @@ namespace Actions
decHandler(query);
decHandler(clearChatTab);
decHandler(createParty);
+ decHandler(createGuild);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 6cdc7cca4..9428dd6e3 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -251,23 +251,6 @@ static void outStringNormal(ChatTab *const tab,
}
}
-impHandler(createGuild)
-{
- if (!event.tab || tmwServerVersion > 0)
- return false;
-
- if (event.args.empty())
- {
- // TRANSLATORS: create guild message
- event.tab->chatLog(_("Guild name is missing."), ChatMsgType::BY_SERVER);
- }
- else
- {
- Net::getGuildHandler()->create(event.args);
- }
- return true;
-}
-
impHandler(party)
{
if (!event.tab)
diff --git a/src/commands.h b/src/commands.h
index f1b6f2e5a..89dd71c45 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(createGuild);
decHandler(party);
decHandler(me);
decHandler(toggle);
@@ -123,8 +122,7 @@ namespace Commands
enum
{
- COMMAND_CREATEGUILD = 0,
- COMMAND_PARTY,
+ COMMAND_PARTY = 0,
COMMAND_ME,
COMMAND_TOGGLE,
COMMAND_PRESENT,
@@ -195,7 +193,6 @@ enum
static const CommandInfo commands[] =
{
- {"createguild", &Commands::createGuild, -1, true},
{"party", &Commands::party, -1, true},
{"me", &Commands::me, -1, true},
{"toggle", &Commands::toggle, -1, false},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 26d62365d..091b72ae4 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -361,6 +361,7 @@ namespace InputAction
CLEAN_GRAPHICS,
CLEAN_FONTS,
CREATE_PARTY,
+ CREATE_GUILD,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 019b6e7e7..a7f1ae0a1 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3018,6 +3018,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"createparty",
+ true},
+ {"keyCreateGuild",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::createGuild,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "createguild",
true}
};