summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-23 19:44:33 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-23 19:44:33 +0300
commitd6f58bee33ca548ea6fc125553aa8d4d2fdba91f (patch)
treef56a9c37da0ef39c470a3da6315a073c87b1c984
parent663b79fd68f9e7f578415f3d0f015a3d8ba998cb (diff)
downloadmv-d6f58bee33ca548ea6fc125553aa8d4d2fdba91f.tar.gz
mv-d6f58bee33ca548ea6fc125553aa8d4d2fdba91f.tar.bz2
mv-d6f58bee33ca548ea6fc125553aa8d4d2fdba91f.tar.xz
mv-d6f58bee33ca548ea6fc125553aa8d4d2fdba91f.zip
Move chat command /announce into actions.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/actions/commands.cpp85
-rw-r--r--src/actions/commands.h35
-rw-r--r--src/commands.cpp7
-rw-r--r--src/commands.h5
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h12
8 files changed, 137 insertions, 12 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1c52822f9..b36cd5b73 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -741,6 +741,8 @@ SET(SRCS
actions/actions.h
actions/chat.cpp
actions/chat.h
+ actions/commands.cpp
+ actions/commands.h
actions/move.cpp
actions/move.h
actions/statusbar.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 106faa7a7..0c8cb0370 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -859,6 +859,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \
actions/actions.h \
actions/chat.cpp \
actions/chat.h \
+ actions/commands.cpp \
+ actions/commands.h \
actions/move.cpp \
actions/move.h \
actions/statusbar.cpp \
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
new file mode 100644
index 000000000..c7607a2cd
--- /dev/null
+++ b/src/actions/commands.cpp
@@ -0,0 +1,85 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2012-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "actions/commands.h"
+
+#include "actormanager.h"
+#include "dropshortcut.h"
+#include "emoteshortcut.h"
+#include "game.h"
+#include "itemshortcut.h"
+#include "soundmanager.h"
+
+#include "actions/actiondef.h"
+
+#include "being/attributes.h"
+#include "being/localplayer.h"
+#include "being/playerinfo.h"
+#include "being/playerrelations.h"
+
+#include "gui/dialogsmanager.h"
+#include "gui/gui.h"
+#include "gui/popupmanager.h"
+#include "gui/sdlinput.h"
+#include "gui/viewport.h"
+
+#include "gui/popups/popupmenu.h"
+
+#include "gui/windows/skilldialog.h"
+#include "gui/windows/socialwindow.h"
+#include "gui/windows/statuswindow.h"
+#include "gui/windows/tradewindow.h"
+#include "gui/windows/questswindow.h"
+#include "gui/windows/quitdialog.h"
+#include "gui/windows/whoisonline.h"
+#include "gui/windows/botcheckerwindow.h"
+#include "gui/windows/buyselldialog.h"
+#include "gui/windows/chatwindow.h"
+#include "gui/windows/debugwindow.h"
+#include "gui/windows/didyouknowwindow.h"
+#include "gui/windows/equipmentwindow.h"
+#include "gui/windows/helpwindow.h"
+#include "gui/windows/inventorywindow.h"
+#include "gui/windows/killstats.h"
+#include "gui/windows/minimap.h"
+#include "gui/windows/npcdialog.h"
+#include "gui/windows/outfitwindow.h"
+#include "gui/windows/setupwindow.h"
+#include "gui/windows/shopwindow.h"
+#include "gui/windows/shortcutwindow.h"
+#include "gui/windows/updaterwindow.h"
+
+#include "gui/widgets/tabs/chattab.h"
+
+#include "net/adminhandler.h"
+#include "net/net.h"
+
+#include "debug.h"
+
+namespace Actions
+{
+
+impHandler(chatAnnounce)
+{
+ Net::getAdminHandler()->announce(event.args);
+ return true;
+}
+
+} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
new file mode 100644
index 000000000..9b991ed8a
--- /dev/null
+++ b/src/actions/commands.h
@@ -0,0 +1,35 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ACTIONS_COMMANDS_H
+#define ACTIONS_COMMANDS_H
+
+#define decHandler(name) bool name(InputEvent &event)
+
+struct InputEvent;
+
+namespace Actions
+{
+ decHandler(chatAnnounce);
+} // namespace Actions
+
+#undef decHandler
+
+#endif // ACTIONS_CHAT_H
diff --git a/src/commands.cpp b/src/commands.cpp
index f13950d59..cef6939d2 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -251,13 +251,6 @@ static void outStringNormal(ChatTab *const tab,
}
}
-
-impHandler(announce)
-{
- Net::getAdminHandler()->announce(event.args);
- return true;
-}
-
impHandler0(ipcToggle)
{
if (ipc)
diff --git a/src/commands.h b/src/commands.h
index 54f97c617..345996977 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -51,7 +51,6 @@ struct CommandInfo final
namespace Commands
{
- decHandler(announce);
decHandler(ipcToggle);
decHandler(where);
decHandler(who);
@@ -141,8 +140,7 @@ namespace Commands
enum
{
- COMMAND_ANNOUNCE = 0,
- COMMAND_IPC_TOGGLE,
+ COMMAND_IPC_TOGGLE = 0,
COMMAND_WHERE,
COMMAND_WHO,
COMMAND_MSG,
@@ -235,7 +233,6 @@ enum
static const CommandInfo commands[] =
{
- {"announce", &Commands::announce, -1, true},
{"ipctoggle", &Commands::ipcToggle, -1, false},
{"where", &Commands::where, -1, false},
{"who", &Commands::who, -1, false},
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index c9a35a66f..d67e60d2d 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -343,6 +343,7 @@ namespace InputAction
TARGET_CLOSEST_MONSTER,
CLOSE_ALL_CHAT_TABS,
IGNORE_ALL_WHISPERS,
+ CHAT_ANNOUNCE,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index 47138a746..37810b5d7 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -27,6 +27,7 @@
#include "actions/actions.h"
#include "actions/chat.h"
+#include "actions/commands.h"
#include "actions/move.h"
#include "actions/statusbar.h"
#include "actions/tabs.h"
@@ -2855,7 +2856,16 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"ignoreallwhispers",
- false}
+ false},
+ {"keyChatAnnounce",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT | Input::GRP_GUI,
+ &Actions::chatAnnounce,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "announce",
+ true}
};
#endif // INPUT_INPUTACTIONMAP_H