summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 15:36:30 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 15:36:30 +0300
commitba4e639a333eed40f95f7bf7a361c0bd0186c334 (patch)
treeb35eabbf47e6ca848bc1fd3b05233689e387d0a3 /src
parentb3f08b33aff591346efb4a94c4cfccdd7b120e9f (diff)
downloadmv-ba4e639a333eed40f95f7bf7a361c0bd0186c334.tar.gz
mv-ba4e639a333eed40f95f7bf7a361c0bd0186c334.tar.bz2
mv-ba4e639a333eed40f95f7bf7a361c0bd0186c334.tar.xz
mv-ba4e639a333eed40f95f7bf7a361c0bd0186c334.zip
Move chat command /removename into actions.
Diffstat (limited to 'src')
-rw-r--r--src/actions/commands.cpp12
-rw-r--r--src/actions/commands.h1
-rw-r--r--src/commands.cpp12
-rw-r--r--src/commands.h5
-rw-r--r--src/gui/popups/popupmenu.cpp4
-rw-r--r--src/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h9
7 files changed, 26 insertions, 18 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 27d80bf00..8a5cad3f2 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -610,4 +610,16 @@ impHandler(dontRemoveName)
return false;
}
+impHandler(removeName)
+{
+ if (event.tab)
+ {
+ event.tab->setRemoveNames(true);
+ if (chatWindow)
+ chatWindow->saveState();
+ return true;
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index a00c844a0..0874cefaa 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -62,6 +62,7 @@ namespace Actions
decHandler(enableHighlight);
decHandler(disableHighlight);
decHandler(dontRemoveName);
+ decHandler(removeName);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index e7a6a2682..f2d7cd6ce 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -106,18 +106,6 @@ impHandler(hack)
return true;
}
-impHandler(removeName)
-{
- if (event.tab)
- {
- event.tab->setRemoveNames(true);
- if (chatWindow)
- chatWindow->saveState();
- return true;
- }
- return false;
-}
-
impHandler(disableAway)
{
if (event.tab)
diff --git a/src/commands.h b/src/commands.h
index 3fc566412..de5e80d03 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(hack);
- decHandler(removeName);
decHandler(disableAway);
decHandler(enableAway);
decHandler(testParticle);
@@ -70,8 +69,7 @@ namespace Commands
enum
{
- COMMAND_REMOVENAME = 0,
- COMMAND_DISABLEAWAY,
+ COMMAND_DISABLEAWAY = 0,
COMMAND_ENABLEAWAY,
COMMAND_TEST_PARTICLE,
COMMAND_CREATEITEMS,
@@ -88,7 +86,6 @@ enum
static const CommandInfo commands[] =
{
- {"", &Commands::removeName, -1, false},
{"disableaway", &Commands::disableAway, -1, false},
{"enableaway", &Commands::enableAway, -1, false},
{"testparticle", &Commands::testParticle, -1, true},
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 7a8285cc0..b3970e7aa 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1470,8 +1470,8 @@ void PopupMenu::handleLink(const std::string &link,
}
else if (link == "remove name" && mTab)
{
- if (commandHandler)
- commandHandler->invokeCommand(COMMAND_REMOVENAME, mTab);
+ inputManager.executeChatCommand(InputAction::REMOVE_NAME,
+ std::string(), mTab);
}
else if (link == "disable away" && mTab)
{
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index cdfe410fa..36f9277b1 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -411,6 +411,7 @@ namespace InputAction
ENABLE_HIGHLIGHT,
DISABLE_HIGHLIGHT,
DONT_REMOVE_NAME,
+ REMOVE_NAME,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index dad0f0cc1..244400d1b 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3476,6 +3476,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"dontremovename",
+ false},
+ {"keyRemoveName",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::removeName,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "removename",
false}
};