summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-25 13:04:02 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-25 13:04:02 +0300
commite62706843143949918653a03cc0cbf6620687a60 (patch)
tree648b609d88e7e642d6ecd0007780aaee03ee92db
parent4c0d3dc62399e35c288cb82dfbf3f8811328f06c (diff)
downloadplus-e62706843143949918653a03cc0cbf6620687a60.tar.gz
plus-e62706843143949918653a03cc0cbf6620687a60.tar.bz2
plus-e62706843143949918653a03cc0cbf6620687a60.tar.xz
plus-e62706843143949918653a03cc0cbf6620687a60.zip
Move chat command /createparty into actions.
-rw-r--r--src/actions/chat.cpp20
-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.h11
6 files changed, 33 insertions, 22 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index 74f3fc691..22d31fbb9 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -68,6 +68,9 @@
#include "gui/widgets/tabs/chattab.h"
+#include "net/net.h"
+#include "net/partyhandler.h"
+
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -242,4 +245,21 @@ impHandler0(clearChatTab)
return false;
}
+impHandler(createParty)
+{
+ if (!event.tab)
+ return false;
+
+ if (event.args.empty())
+ {
+ // TRANSLATORS: create party message
+ event.tab->chatLog(_("Party name is missing."), ChatMsgType::BY_SERVER);
+ }
+ else
+ {
+ Net::getPartyHandler()->create(event.args);
+ }
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/chat.h b/src/actions/chat.h
index 8a5e3a3c8..7cb453872 100644
--- a/src/actions/chat.h
+++ b/src/actions/chat.h
@@ -38,6 +38,7 @@ namespace Actions
decHandler(msg);
decHandler(query);
decHandler(clearChatTab);
+ decHandler(createParty);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index ed90a9d56..6cdc7cca4 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -251,23 +251,6 @@ static void outStringNormal(ChatTab *const tab,
}
}
-impHandler(createParty)
-{
- if (!event.tab)
- return false;
-
- if (event.args.empty())
- {
- // TRANSLATORS: create party message
- event.tab->chatLog(_("Party name is missing."), ChatMsgType::BY_SERVER);
- }
- else
- {
- Net::getPartyHandler()->create(event.args);
- }
- return true;
-}
-
impHandler(createGuild)
{
if (!event.tab || tmwServerVersion > 0)
diff --git a/src/commands.h b/src/commands.h
index fceff7fe1..f1b6f2e5a 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(createParty);
decHandler(createGuild);
decHandler(party);
decHandler(me);
@@ -124,8 +123,7 @@ namespace Commands
enum
{
- COMMAND_CREATEPARTY = 0,
- COMMAND_CREATEGUILD,
+ COMMAND_CREATEGUILD = 0,
COMMAND_PARTY,
COMMAND_ME,
COMMAND_TOGGLE,
@@ -197,7 +195,6 @@ enum
static const CommandInfo commands[] =
{
- {"createparty", &Commands::createParty, -1, true},
{"createguild", &Commands::createGuild, -1, true},
{"party", &Commands::party, -1, true},
{"me", &Commands::me, -1, true},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 68c0483d1..26d62365d 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -360,6 +360,7 @@ namespace InputAction
ERASE,
CLEAN_GRAPHICS,
CLEAN_FONTS,
+ CREATE_PARTY,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index f8d8c944f..019b6e7e7 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3009,7 +3009,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"cleanfonts",
- false}
+ false},
+ {"keyCreateParty",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::createParty,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "createparty",
+ true}
};
#endif // INPUT_INPUTACTIONMAP_H