summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 15:29:50 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 15:29:50 +0300
commitb3f08b33aff591346efb4a94c4cfccdd7b120e9f (patch)
tree34501eda3aeacaa09f385d59a00237b9f1d89b3d
parent9de5536077107f36185c1132cd0cbcdbeefffabb (diff)
downloadmanaplus-b3f08b33aff591346efb4a94c4cfccdd7b120e9f.tar.gz
manaplus-b3f08b33aff591346efb4a94c4cfccdd7b120e9f.tar.bz2
manaplus-b3f08b33aff591346efb4a94c4cfccdd7b120e9f.tar.xz
manaplus-b3f08b33aff591346efb4a94c4cfccdd7b120e9f.zip
Move chat command /dontremovename into actions.
-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 9c34b9a5a..27d80bf00 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -598,4 +598,16 @@ impHandler(disableHighlight)
return false;
}
+impHandler(dontRemoveName)
+{
+ if (event.tab)
+ {
+ event.tab->setRemoveNames(false);
+ if (chatWindow)
+ chatWindow->saveState();
+ return true;
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index e06663660..a00c844a0 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -61,6 +61,7 @@ namespace Actions
decHandler(execute);
decHandler(enableHighlight);
decHandler(disableHighlight);
+ decHandler(dontRemoveName);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index de2d03475..e7a6a2682 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -106,18 +106,6 @@ impHandler(hack)
return true;
}
-impHandler(dontRemoveName)
-{
- if (event.tab)
- {
- event.tab->setRemoveNames(false);
- if (chatWindow)
- chatWindow->saveState();
- return true;
- }
- return false;
-}
-
impHandler(removeName)
{
if (event.tab)
diff --git a/src/commands.h b/src/commands.h
index c94d802f3..3fc566412 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(hack);
- decHandler(dontRemoveName);
decHandler(removeName);
decHandler(disableAway);
decHandler(enableAway);
@@ -71,8 +70,7 @@ namespace Commands
enum
{
- COMMAND_DONTREMOVENAME = 0,
- COMMAND_REMOVENAME,
+ COMMAND_REMOVENAME = 0,
COMMAND_DISABLEAWAY,
COMMAND_ENABLEAWAY,
COMMAND_TEST_PARTICLE,
@@ -90,7 +88,6 @@ enum
static const CommandInfo commands[] =
{
- {"", &Commands::dontRemoveName, -1, false},
{"", &Commands::removeName, -1, false},
{"disableaway", &Commands::disableAway, -1, false},
{"enableaway", &Commands::enableAway, -1, false},
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 501b1e0ff..7a8285cc0 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1465,8 +1465,8 @@ void PopupMenu::handleLink(const std::string &link,
}
else if (link == "dont remove name" && mTab)
{
- if (commandHandler)
- commandHandler->invokeCommand(COMMAND_DONTREMOVENAME, mTab);
+ inputManager.executeChatCommand(InputAction::DONT_REMOVE_NAME,
+ std::string(), mTab);
}
else if (link == "remove name" && mTab)
{
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index 510e42793..cdfe410fa 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -410,6 +410,7 @@ namespace InputAction
TEST_SDL_FONT,
ENABLE_HIGHLIGHT,
DISABLE_HIGHLIGHT,
+ DONT_REMOVE_NAME,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index d395d83b0..dad0f0cc1 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3467,6 +3467,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"disablehighlight",
+ false},
+ {"keyDontRemoveName",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::dontRemoveName,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "dontremovename",
false}
};