summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-03-04 20:09:24 +0100
committerBardur Arantsson <bardur@scientician.net>2012-03-29 20:41:39 +0200
commitcbf8457017b6c92fba7853066af8a90c870e6c8f (patch)
tree29a511f7ea262910031e89306cc9d3f062667166 /src/util.c
parent4d6770696a172bae4ef18a00cb1e59f06e641faf (diff)
Refactor: Remove duplicate keymap handling code.
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/util.c b/src/util.c
index 34084d71..546d11d8 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3648,18 +3648,8 @@ void request_command(int shopping)
cptr act;
- /* Roguelike */
- if (rogue_like_commands)
- {
- mode = KEYMAP_MODE_ROGUE;
- }
-
- /* Original */
- else
- {
- mode = KEYMAP_MODE_ORIG;
- }
-
+ /* Keymap mode */
+ mode = get_keymap_mode();
/* No command yet */
command_cmd = 0;
@@ -3978,17 +3968,8 @@ int get_keymap_dir(char ch)
}
else
{
- /* Roguelike */
- if (rogue_like_commands)
- {
- mode = KEYMAP_MODE_ROGUE;
- }
-
- /* Original */
- else
- {
- mode = KEYMAP_MODE_ORIG;
- }
+ /* Keymap mode */
+ mode = get_keymap_mode();
/* Extract the action (if any) */
act = keymap_act[mode][(byte)(ch)];
@@ -4730,3 +4711,15 @@ void del_timer(timer_type *t_ptr)
else
cmsg_print(TERM_VIOLET, "Unknown timer!");
}
+
+int get_keymap_mode()
+{
+ if (rogue_like_commands)
+ {
+ return KEYMAP_MODE_ROGUE;
+ }
+ else
+ {
+ return KEYMAP_MODE_ORIG;
+ }
+}