diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-27 15:45:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-27 15:45:07 +0300 |
commit | abdc57a4acfa490ee34985b56b2d985266ccc7e4 (patch) | |
tree | 8016393684c2e03dc0722dea98c44ff3e31d0ea5 /src | |
parent | 0b9105af0ae2b85a0a3ea5364d8a854d107ce34a (diff) | |
download | manaplus-abdc57a4acfa490ee34985b56b2d985266ccc7e4.tar.gz manaplus-abdc57a4acfa490ee34985b56b2d985266ccc7e4.tar.bz2 manaplus-abdc57a4acfa490ee34985b56b2d985266ccc7e4.tar.xz manaplus-abdc57a4acfa490ee34985b56b2d985266ccc7e4.zip |
Move chat command /enableaway into actions.
Diffstat (limited to 'src')
-rw-r--r-- | src/actions/commands.cpp | 12 | ||||
-rw-r--r-- | src/actions/commands.h | 1 | ||||
-rw-r--r-- | src/commands.cpp | 12 | ||||
-rw-r--r-- | src/commands.h | 5 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 4 | ||||
-rw-r--r-- | src/input/inputaction.h | 1 | ||||
-rw-r--r-- | src/input/inputactionmap.h | 9 |
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} }; |