summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-05-23 23:03:45 +0300
committerAndrei Karas <akaras@inbox.ru>2017-05-23 23:03:45 +0300
commitcea367c529bd8400a44fab3f580d43120457e1b9 (patch)
treef33d4393865bdf2f6bff041002243583605f1de4 /src
parent7863473dc201f4a497669cbf69875eb6e9389273 (diff)
downloadmv-cea367c529bd8400a44fab3f580d43120457e1b9.tar.gz
mv-cea367c529bd8400a44fab3f580d43120457e1b9.tar.bz2
mv-cea367c529bd8400a44fab3f580d43120457e1b9.tar.xz
mv-cea367c529bd8400a44fab3f580d43120457e1b9.zip
Add chat command for send any number of pritable chars to input.
Diffstat (limited to 'src')
-rw-r--r--src/actions/chat.cpp19
-rw-r--r--src/actions/chat.h1
-rw-r--r--src/dyetool/actions/chat.cpp1
-rw-r--r--src/enums/input/inputaction.h1
-rw-r--r--src/input/inputactionmap.h6
5 files changed, 28 insertions, 0 deletions
diff --git a/src/actions/chat.cpp b/src/actions/chat.cpp
index d8743e06a..4f69b31b8 100644
--- a/src/actions/chat.cpp
+++ b/src/actions/chat.cpp
@@ -780,4 +780,23 @@ impHandler(sendMouseKey)
return true;
}
+impHandler(sendChars)
+{
+ if (!guiInput)
+ return false;
+
+ const std::string args = event.args;
+ if (args.empty())
+ return false;
+
+ const size_t sz = args.size();
+ for (size_t f = 0; f < sz; f ++)
+ {
+ guiInput->simulateKey(CAST_S32(args[f]),
+ InputAction::NO_VALUE);
+ }
+
+ return true;
+}
+
} // namespace Actions
diff --git a/src/actions/chat.h b/src/actions/chat.h
index 5d4f1c02d..0e3c362a7 100644
--- a/src/actions/chat.h
+++ b/src/actions/chat.h
@@ -64,6 +64,7 @@ namespace Actions
decHandler(translate);
decHandler(sendGuiKey);
decHandler(sendMouseKey);
+ decHandler(sendChars);
} // namespace Actions
#undef decHandler
diff --git a/src/dyetool/actions/chat.cpp b/src/dyetool/actions/chat.cpp
index bf57c1c49..ece0e42b9 100644
--- a/src/dyetool/actions/chat.cpp
+++ b/src/dyetool/actions/chat.cpp
@@ -64,5 +64,6 @@ impHandlerVoid(guildNotice)
impHandlerVoid(translate)
impHandlerVoid(sendGuiKey)
impHandlerVoid(sendMouseKey)
+impHandlerVoid(sendChars)
} // namespace Actions
diff --git a/src/enums/input/inputaction.h b/src/enums/input/inputaction.h
index 9b1d2e99a..f838bf092 100644
--- a/src/enums/input/inputaction.h
+++ b/src/enums/input/inputaction.h
@@ -694,6 +694,7 @@ enumStart(InputAction)
MOVE_PRIORITY_ATTACK_DOWN,
SHOW_ITEMS,
COMMAND_SEND_MOUSE_KEY,
+ COMMAND_SEND_CHARS,
TOTAL
}
enumEnd(InputAction);
diff --git a/src/input/inputactionmap.h b/src/input/inputactionmap.h
index bc18cd7a4..b49b36904 100644
--- a/src/input/inputactionmap.h
+++ b/src/input/inputactionmap.h
@@ -5654,6 +5654,12 @@ static const InputActionData inputActionData
"mousekey|sendmousekey",
UseArgs_true,
Protected_true},
+ {"keyCommandSendChars",
+ defaultAction(&Actions::sendChars),
+ InputCondition::ENABLED,
+ "sendchar|sendchars|charsend",
+ UseArgs_true,
+ Protected_true},
};
#undef defaultAction