From d003da4b7bbf1b37f95c2e8e761fbe3e54b25c7a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Aug 2014 13:27:52 +0300 Subject: Move chat command /execute into actions. --- src/actions/commands.cpp | 18 ++++++++++++++++++ src/actions/commands.h | 1 + src/commands.cpp | 18 ------------------ src/commands.h | 5 +---- src/input/inputaction.h | 1 + src/input/inputactionmap.h | 9 +++++++++ 6 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp index 28b601ba2..dbf3ab3d4 100644 --- a/src/actions/commands.cpp +++ b/src/actions/commands.cpp @@ -556,4 +556,22 @@ impHandler(openUrl) return true; } +impHandler(execute) +{ + const size_t idx = event.args.find(" "); + std::string name; + std::string params; + if (idx == std::string::npos) + { + name = event.args; + } + else + { + name = event.args.substr(0, idx); + params = event.args.substr(idx + 1); + } + execFile(name, name, params, ""); + return true; +} + } // namespace Actions diff --git a/src/actions/commands.h b/src/actions/commands.h index 3b378931d..0a803e41c 100644 --- a/src/actions/commands.h +++ b/src/actions/commands.h @@ -58,6 +58,7 @@ namespace Actions decHandler(setDrop); decHandler(url); decHandler(openUrl); + decHandler(execute); } // namespace Actions #undef decHandler diff --git a/src/commands.cpp b/src/commands.cpp index 3cc659b0c..18747f24e 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -106,24 +106,6 @@ impHandler(hack) return true; } -impHandler(execute) -{ - const size_t idx = event.args.find(" "); - std::string name; - std::string params; - if (idx == std::string::npos) - { - name = event.args; - } - else - { - name = event.args.substr(0, idx); - params = event.args.substr(idx + 1); - } - execFile(name, name, params, ""); - return true; -} - impHandler(enableHighlight) { if (event.tab) diff --git a/src/commands.h b/src/commands.h index 5abfae4da..44afba028 100644 --- a/src/commands.h +++ b/src/commands.h @@ -52,7 +52,6 @@ struct CommandInfo final namespace Commands { decHandler(hack); - decHandler(execute); decHandler(testsdlfont); decHandler(enableHighlight); decHandler(disableHighlight); @@ -75,8 +74,7 @@ namespace Commands enum { - COMMAND_EXECUTE = 0, - COMMAND_TESTSDLFONT, + COMMAND_TESTSDLFONT = 0, COMMAND_ENABLEHIGHLIGHT, COMMAND_DISABLEHIGHLIGHT, COMMAND_DONTREMOVENAME, @@ -98,7 +96,6 @@ enum static const CommandInfo commands[] = { - {"execute", &Commands::execute, -1, true}, {"testsdlfont", &Commands::testsdlfont, -1, false}, {"enablehighlight", &Commands::enableHighlight, -1, false}, {"disablehighlight", &Commands::disableHighlight, -1, false}, diff --git a/src/input/inputaction.h b/src/input/inputaction.h index 0a9e8ec21..c0c91d7f8 100644 --- a/src/input/inputaction.h +++ b/src/input/inputaction.h @@ -406,6 +406,7 @@ namespace InputAction DUMP_MODS, URL, OPEN_URL, + EXECUTE, TOTAL }; } // namespace InputAction diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h index d40a0ae99..0e16c866c 100644 --- a/src/input/inputactionmap.h +++ b/src/input/inputactionmap.h @@ -3423,6 +3423,15 @@ static const InputActionData inputActionData[InputAction::TOTAL] = { InputAction::NO_VALUE, 50, InputCondition::INGAME, "open", + true}, + {"keyExecute", + InputType::UNKNOWN, InputAction::NO_VALUE, + InputType::UNKNOWN, InputAction::NO_VALUE, + Input::GRP_DEFAULT, + &Actions::execute, + InputAction::NO_VALUE, 50, + InputCondition::INGAME, + "execute", true} }; -- cgit v1.2.3-60-g2f50