summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-05 16:09:36 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-05 16:09:36 +0000
commit239ee7d1040f90fbdcad52e7f41017574df5a865 (patch)
tree47c6a682f16249185a848016b955a765ea402906 /crawl-ref/source
parent542219cbf26c0e4d3dfec1548bd33870763d4d46 (diff)
downloadcrawl-ref-239ee7d1040f90fbdcad52e7f41017574df5a865.tar.gz
crawl-ref-239ee7d1040f90fbdcad52e7f41017574df5a865.zip
Minor typesafety fix.
Added description for '!' and '@' to targeting help. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7137 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/cio.cc4
-rw-r--r--crawl-ref/source/cio.h4
-rw-r--r--crawl-ref/source/command.cc4
-rw-r--r--crawl-ref/source/enum.h16
-rw-r--r--crawl-ref/source/macro.h18
5 files changed, 26 insertions, 20 deletions
diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc
index fe4bbf23ac..dd21bf6caa 100644
--- a/crawl-ref/source/cio.cc
+++ b/crawl-ref/source/cio.cc
@@ -27,9 +27,9 @@ static keycode_type _numpad2vi(keycode_type key)
}
#endif
-int unmangle_direction_keys(int keyin, int km, bool fake_ctrl, bool fake_shift)
+int unmangle_direction_keys(int keyin, KeymapContext keymap,
+ bool fake_ctrl, bool fake_shift)
{
- const KeymapContext keymap = static_cast<KeymapContext>(km);
#ifdef UNIX
// Kludging running and opening as two character sequences
// for Unix systems. This is an easy way out... all the
diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h
index 38e8b8a2ba..b8d5420d39 100644
--- a/crawl-ref/source/cio.h
+++ b/crawl-ref/source/cio.h
@@ -10,9 +10,11 @@
#define CIO_H
#include "AppHdr.h"
+#include "enum.h"
#include "externs.h"
#include "defines.h"
#include "directn.h"
+
#include <cctype>
#include <string>
#include <vector>
@@ -50,7 +52,7 @@ int c_getch();
// Converts a key to a direction key, converting keypad and other sequences
// to vi key sequences (shifted/control key directions are also handled). Non
// direction keys (hopefully) pass through unmangled.
-int unmangle_direction_keys(int keyin, int keymap = 0,
+int unmangle_direction_keys(int keyin, KeymapContext keymap = KC_DEFAULT,
bool fake_ctrl = true, bool fake_shift = true);
void get_input_line( char *const buff, int len );
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc
index 35b03c0ade..dcdb6e831e 100644
--- a/crawl-ref/source/command.cc
+++ b/crawl-ref/source/command.cc
@@ -746,8 +746,10 @@ static const char *targeting_help_1 =
"<h>Targeting (zapping wands, casting spells, etc.):\n"
"The keys from examine surroundings also work here.\n"
"In addition, you can use:\n"
- "<w>!</w> : fire at target (<w>Enter</w>, <w>Del</w>, <w>Space</w>)\n"
+ "<w>Enter</w> : fire at target (<w>Space</w>, <w>Del</w>)\n"
"<w>.</w> : fire at target and stop there (may hit submerged creatures)\n"
+ "<w>!</w> : fire at target, ignoring range\n"
+ "<w>@</w> : fire at target and stop there, ignoring range\n"
"<w>p</w> : fire at Previous target (also <w>f</w>)\n"
"<w>:</w> : show/hide beam path\n"
"<w>Shift-Dir</w> : shoot straight-line beam\n"
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index f68fd730de..cdf74670c9 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1372,6 +1372,22 @@ enum job_type
JOB_UNKNOWN = 100
};
+enum KeymapContext {
+ KC_DEFAULT, // For no-arg getchm(), must be zero.
+ KC_LEVELMAP, // When in the 'X' level map
+ KC_TARGETING, // Only during 'x' and other targeting modes
+ KC_CONFIRM, // When being asked y/n/q questions
+ KC_MENU, // For menus
+
+#ifdef USE_TILE
+ KC_TILE, // For context_for_command()
+#endif
+
+ KC_CONTEXT_COUNT, // Must always be the last real context
+
+ KC_NONE
+};
+
// This order is *critical*. Don't mess with it (see mon_enchant)
enum kill_category
{
diff --git a/crawl-ref/source/macro.h b/crawl-ref/source/macro.h
index be3a51d974..2765136fac 100644
--- a/crawl-ref/source/macro.h
+++ b/crawl-ref/source/macro.h
@@ -11,6 +11,8 @@
#include <deque>
+#include "enum.h"
+
#ifndef MACRO_CC
#undef getch
@@ -18,22 +20,6 @@
#endif
-enum KeymapContext {
- KC_DEFAULT, // For no-arg getchm(), must be zero.
- KC_LEVELMAP, // When in the 'X' level map
- KC_TARGETING, // Only during 'x' and other targeting modes
- KC_CONFIRM, // When being asked y/n/q questions
- KC_MENU, // For menus
-
-#ifdef USE_TILE
- KC_TILE, // For context_for_command()
-#endif
-
- KC_CONTEXT_COUNT, // Must always be the last real context
-
- KC_NONE
-};
-
class key_recorder;
typedef bool (*key_recorder_callback)(key_recorder *recorder,
int &ch, bool reverse);