From 8580b120b87df21419aad11376ba6ca6dcfee5d0 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 6 Dec 2014 07:24:15 +0100
Subject: [PATCH] Client: Remove redundant map scrolling code.

---
 confclient/commands                | 12 ----------
 confclient/interface_conf          |  4 ----
 confclient/single_wins/info        |  4 ----
 confclient/single_wins/inventory   |  4 ----
 confclient/single_wins/log         |  4 ----
 confclient/single_wins/map         |  4 ----
 confclient/single_wins/things_here |  4 ----
 src/client/control.c               |  8 ++-----
 src/client/map.c                   | 36 +-----------------------------
 src/client/map.h                   |  5 -----
 10 files changed, 3 insertions(+), 82 deletions(-)

diff --git a/confclient/commands b/confclient/commands
index 70c61b5..865cc3e 100644
--- a/confclient/commands
+++ b/confclient/commands
@@ -146,18 +146,6 @@ DESCRIPTION 'reload interface config'
 COMMAND save_conf
 DESCRIPTION 'save interface config'
 
-COMMAND map_u
-DESCRIPTION 'map up'
-
-COMMAND map_d
-DESCRIPTION 'map down'
-
-COMMAND map_l
-DESCRIPTION 'map left'
-
-COMMAND map_r
-DESCRIPTION 'map right'
-
 COMMAND to_inv
 DESCRIPTION 'window inventory'
 
diff --git a/confclient/interface_conf b/confclient/interface_conf
index 69dac92..0055141 100644
--- a/confclient/interface_conf
+++ b/confclient/interface_conf
@@ -105,8 +105,4 @@ KEY 99 move_c
 KEY 120 move_x
 KEY 115 move_s
 KEY 119 move_w
-KEY 259 map_u
-KEY 258 map_d
-KEY 260 map_l
-KEY 261 map_r
 KEY 108 to_look
diff --git a/confclient/single_wins/info b/confclient/single_wins/info
index 462f6a7..9e899fd 100644
--- a/confclient/single_wins/info
+++ b/confclient/single_wins/info
@@ -115,9 +115,5 @@ KEY 99 move_c
 KEY 120 move_x
 KEY 115 move_s
 KEY 119 move_w
-KEY 259 map_u
-KEY 258 map_d
-KEY 260 map_l
-KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
diff --git a/confclient/single_wins/inventory b/confclient/single_wins/inventory
index 2a24b67..03ef22e 100644
--- a/confclient/single_wins/inventory
+++ b/confclient/single_wins/inventory
@@ -113,9 +113,5 @@ KEY 99 move_c
 KEY 120 move_x
 KEY 115 move_s
 KEY 119 move_w
-KEY 259 map_u
-KEY 258 map_d
-KEY 260 map_l
-KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
diff --git a/confclient/single_wins/log b/confclient/single_wins/log
index 0b92f77..6e046a9 100644
--- a/confclient/single_wins/log
+++ b/confclient/single_wins/log
@@ -115,9 +115,5 @@ KEY 99 move_c
 KEY 120 move_x
 KEY 115 move_s
 KEY 119 move_w
-KEY 259 map_u
-KEY 258 map_d
-KEY 260 map_l
-KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
diff --git a/confclient/single_wins/map b/confclient/single_wins/map
index 6d6a399..3b736bd 100644
--- a/confclient/single_wins/map
+++ b/confclient/single_wins/map
@@ -51,10 +51,6 @@ NAME 'Map'
 BREAK 0
 WIDTH 0
 HEIGHT 0
-KEY 259 map_u
-KEY 258 map_d
-KEY 260 map_l
-KEY 261 map_r
 
 WINDOW 0
 NAME 'Set global keys'
diff --git a/confclient/single_wins/things_here b/confclient/single_wins/things_here
index 4936331..2abc3e5 100644
--- a/confclient/single_wins/things_here
+++ b/confclient/single_wins/things_here
@@ -116,9 +116,5 @@ KEY 99 move_c
 KEY 120 move_x
 KEY 115 move_s
 KEY 119 move_w
-KEY 259 map_u
-KEY 258 map_d
-KEY 260 map_l
-KEY 261 map_r
 KEY 46 map_c
 KEY 70 to_autofocus
diff --git a/src/client/control.c b/src/client/control.c
index 13e57dd..55dbd9e 100644
--- a/src/client/control.c
+++ b/src/client/control.c
@@ -17,7 +17,7 @@
 #include "keybindings.h" /* get_command_to_keycode(), get_keycode_to_command(),
                           * mod_selected_keyb(), move_keyb_selection()
                           */
-#include "map.h" /* map_scroll(),toggle_lookmode(),lookmode_nav()*/
+#include "map.h" /* toggle_lookmode(), lookmode_nav()*/
 #include "wincontrol.h" /* shift_active_win(), resize_active_win(),
                          * toggle_win_size_type(), toggle_window(),
                          * cycle_active_win(), scroll_v_screen(),
@@ -134,11 +134,7 @@ static uint8_t try_kb_manip(char * command)
 
 static uint8_t try_client_commands(struct Command * command)
 {
-    return (   try_1args(command, "map_u", map_scroll, '8')
-            || try_1args(command, "map_d", map_scroll, '2')
-            || try_1args(command, "map_r", map_scroll, '6')
-            || try_1args(command, "map_l", map_scroll, '4')
-            || try_1args(command, "inv_u", nav_inventory, 'u')
+    return (   try_1args(command, "inv_u", nav_inventory, 'u')
             || try_1args(command, "inv_d", nav_inventory, 'd')
             || try_1args(command, "cyc_win_f", cycle_active_win, 'f')
             || try_1args(command, "cyc_win_b", cycle_active_win, 'b')
diff --git a/src/client/map.c b/src/client/map.c
index f8ff061..ab8148d 100644
--- a/src/client/map.c
+++ b/src/client/map.c
@@ -12,42 +12,8 @@
 #include <string.h> /* strlen(), strncmp() */
 #include "../common/try_malloc.h" /* try_malloc() */
 #include "../common/rexit.h" /* exit_trouble() */
-//#include "../common/yx_uint8.h" /* yx_uint8 */
 #include "io.h" /* send() */
-#include "windows.h" /* struct Win, center_offset(), get_win_by_id() */
-#include "world.h" /* for global world */
-
-
-
-extern void map_scroll(char d)
-{
-    struct Win * win = get_win_by_id('m');
-    uint16_t offset;
-    if (('8' == d || '2' == d) && world.map.length > win->frame_size.y)
-    {
-        offset = center_offset(win->center.y,
-                               world.map.length, win->frame_size.y);
-        win->center.y = offset + (win->frame_size.y / 2);
-        if ('2' == d && win->center.y < world.map.length - 1)
-        {
-            win->center.y++;
-            return;
-        }
-        win->center.y = win->center.y - ('8' == d && win->center.y > 0);
-    }
-    else if (('4' == d || '6' == d) && (world.map.length*2) > win->frame_size.x)
-    {
-        offset = center_offset(win->center.x,
-                               world.map.length*2, win->frame_size.x);
-        win->center.x = offset + (win->frame_size.x / 2);
-        if ('6' == d && win->center.x < (world.map.length * 2) - 1)
-        {
-            win->center.x++;
-            return;
-        }
-        win->center.x = win->center.x - ('4' == d && win->center.x > 0);
-    }
-}
+#include "world.h" /* for world */
 
 
 
diff --git a/src/client/map.h b/src/client/map.h
index cfba067..8a36750 100644
--- a/src/client/map.h
+++ b/src/client/map.h
@@ -13,11 +13,6 @@
 #include <stdint.h> /* uint8_t */
 
 
-/* Try changing map window's focus into direction "d" (north = "N" etc.). Unset
- * world.focus_each_turn.
- */
-extern void map_scroll(char d);
-
 /* Toggle world.look (moving look cursor instead of player over map). */
 extern void toggle_lookmode();
 
-- 
2.30.2