summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-16 02:04:14 +0100
committerJohanna Ploog <j-p-e-g@users.sourceforge.net>2010-01-16 02:04:14 +0100
commite398d71d3e5f02d79806554df21de9e29fb627ef (patch)
treee29fbd10f1233c4a31624f51aa09bce6bc2afd49 /crawl-ref
parent91c7e659794944626fd763ea3123d52ee9d2b836 (diff)
downloadcrawl-ref-e398d71d3e5f02d79806554df21de9e29fb627ef.tar.gz
crawl-ref-e398d71d3e5f02d79806554df21de9e29fb627ef.zip
Add pseudocommand CMD_NO_CMD_DEFAULT for overriding the vi keys.
CMD_NO_CMD is handled specially in many different ways, but the new command's sole purpose is to allow key bindings involving invalid commands, so as to override the vi keys for players who don't need them, don't want to replace them with other keys, but are worried about typos making their character walk into a fatal ambush.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/cmd-name.h1
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/macro.cc7
-rw-r--r--crawl-ref/source/main.cc1
4 files changed, 6 insertions, 4 deletions
diff --git a/crawl-ref/source/cmd-name.h b/crawl-ref/source/cmd-name.h
index 239d4d540a..2bfd0c393c 100644
--- a/crawl-ref/source/cmd-name.h
+++ b/crawl-ref/source/cmd-name.h
@@ -1,5 +1,6 @@
// Generated by util/cmd-name.pl
+{CMD_NO_CMD_DEFAULT, "CMD_NO_CMD_DEFAULT"},
{CMD_MOVE_NOWHERE, "CMD_MOVE_NOWHERE"},
{CMD_MOVE_LEFT, "CMD_MOVE_LEFT"},
{CMD_MOVE_DOWN, "CMD_MOVE_DOWN"},
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 011a4615dc..30725b416e 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -439,6 +439,7 @@ enum cloud_type
enum command_type
{
CMD_NO_CMD = 1000,
+ CMD_NO_CMD_DEFAULT, // hack to allow assignment of keys to CMD_NO_CMD
CMD_MOVE_NOWHERE,
CMD_MOVE_LEFT,
CMD_MOVE_DOWN,
diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc
index f2fd7cad82..5c9b2a9030 100644
--- a/crawl-ref/source/macro.cc
+++ b/crawl-ref/source/macro.cc
@@ -1243,19 +1243,18 @@ static std::string _special_keys_to_string(int key)
std::string cmd = "";
- int newkey = key;
if (shift)
{
- newkey -= (CK_SHIFT_UP - CK_UP);
+ key -= (CK_SHIFT_UP - CK_UP);
cmd = "Shift-";
}
else if (ctrl)
{
- newkey -= (CK_CTRL_UP - CK_UP);
+ key -= (CK_CTRL_UP - CK_UP);
cmd = "Ctrl-";
}
- switch (newkey)
+ switch (key)
{
case CK_ENTER: cmd += "Enter"; break;
case CK_BKSP: cmd += "Backspace"; break;
diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc
index 3d9e0694b2..7d74fef068 100644
--- a/crawl-ref/source/main.cc
+++ b/crawl-ref/source/main.cc
@@ -853,6 +853,7 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false)
return (true);
case CMD_NO_CMD:
+ case CMD_NO_CMD_DEFAULT:
mpr("Unknown command, not repeating.");
return (false);