summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-27 15:45:07 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-27 15:45:07 +0300
commitabdc57a4acfa490ee34985b56b2d985266ccc7e4 (patch)
tree8016393684c2e03dc0722dea98c44ff3e31d0ea5
parent0b9105af0ae2b85a0a3ea5364d8a854d107ce34a (diff)
downloadmanaverse-abdc57a4acfa490ee34985b56b2d985266ccc7e4.tar.gz
manaverse-abdc57a4acfa490ee34985b56b2d985266ccc7e4.tar.bz2
manaverse-abdc57a4acfa490ee34985b56b2d985266ccc7e4.tar.xz
manaverse-abdc57a4acfa490ee34985b56b2d985266ccc7e4.zip
Move chat command /enableaway 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 aae31db26..905d7a2fb 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -634,4 +634,16 @@ impHandler(disableAway)
return false;
}
+impHandler(enableAway)
+{
+ if (event.tab)
+ {
+ event.tab->setNoAway(false);
+ if (chatWindow)
+ chatWindow->saveState();
+ return true;
+ }
+ return false;
+}
+
} // namespace Actions
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 140877eb5..02514ece0 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -64,6 +64,7 @@ namespace Actions
decHandler(dontRemoveName);
decHandler(removeName);
decHandler(disableAway);
+ decHandler(enableAway);
} // namespace Actions
#undef decHandler
diff --git a/src/commands.cpp b/src/commands.cpp
index 3a7bf28a2..50219ebde 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -106,18 +106,6 @@ impHandler(hack)
return true;
}
-impHandler(enableAway)
-{
- if (event.tab)
- {
- event.tab->setNoAway(false);
- if (chatWindow)
- chatWindow->saveState();
- return true;
- }
- return false;
-}
-
impHandler(testParticle)
{
if (localPlayer)
diff --git a/src/commands.h b/src/commands.h
index b2e2dabc4..42a466b07 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -52,7 +52,6 @@ struct CommandInfo final
namespace Commands
{
decHandler(hack);
- decHandler(enableAway);
decHandler(testParticle);
decHandler(createItems);
decHandler(talkRaw);
@@ -68,8 +67,7 @@ namespace Commands
enum
{
- COMMAND_ENABLEAWAY = 0,
- COMMAND_TEST_PARTICLE,
+ COMMAND_TEST_PARTICLE = 0,
COMMAND_CREATEITEMS,
COMMAND_TALKRAW,
COMMAND_TALKPET,
@@ -84,7 +82,6 @@ enum
static const CommandInfo commands[] =
{
- {"enableaway", &Commands::enableAway, -1, false},
{"testparticle", &Commands::testParticle, -1, true},
{"createitems", &Commands::createItems, -1, false},
{"talkraw", &Commands::talkRaw, -1, true},
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index c06c98540..41135f962 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -1480,8 +1480,8 @@ void PopupMenu::handleLink(const std::string &link,
}
else if (link == "enable away" && mTab)
{
- if (commandHandler)
- commandHandler->invokeCommand(COMMAND_ENABLEAWAY, mTab);
+ inputManager.executeChatCommand(InputAction::ENABLE_AWAY,
+ std::string(), mTab);
}
else if (link == "chat clipboard" && mTab)
{
diff --git a/src/input/inputaction.h b/src/input/inputaction.h
index cfeef44c1..2cd802ce0 100644
--- a/src/input/inputaction.h
+++ b/src/input/inputaction.h
@@ -413,6 +413,7 @@ namespace InputAction
DONT_REMOVE_NAME,
REMOVE_NAME,
DISABLE_AWAY,
+ ENABLE_AWAY,
TOTAL
};
} // namespace InputAction
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index d2d09c770..f3ce27a76 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -3494,6 +3494,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = {
InputAction::NO_VALUE, 50,
InputCondition::INGAME,
"disableaway",
+ false},
+ {"keyEnableAway",
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ InputType::UNKNOWN, InputAction::NO_VALUE,
+ Input::GRP_DEFAULT,
+ &Actions::enableAway,
+ InputAction::NO_VALUE, 50,
+ InputCondition::INGAME,
+ "enableaway",
false}
};