home · contact · privacy
Add "look" mode to query things on any cell via new THINGS_HERE command.
[plomrogue] / src / client / control.c
index 536c5675bb3e78f7a13af556612031151e778421..76d69ac4562b9b0dc39211fffd1d47767815f9ac 100644 (file)
@@ -17,7 +17,9 @@
 #include "keybindings.h" /* get_command_to_keycode(), get_keycode_to_command(),
                           * mod_selected_keyb(), move_keyb_selection()
                           */
-#include "map.h" /* map_scroll(), map_center(), toggle_autofocus() */
+#include "map.h" /* map_scroll(), map_center(), toggle_autofocus(),
+                  * 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(),
@@ -97,6 +99,8 @@ static uint8_t try_0args(struct Command * command, char * match, void (* f) ())
     return 0;
 }
 
+
+
 static uint8_t try_1args(struct Command * command, char * match,
                              void (* f) (char), char c)
 {
@@ -110,10 +114,6 @@ static uint8_t try_1args(struct Command * command, char * match,
 
 
 
-/* If "command" fits pattern "keyb_XY" with Y a proper keybinding list ID char
- * and X one of "u" (for "up"), "d" (for "down") or "m" (for "modify"), move up
- * or down or modify entry in the selected keybinding list.
- */
 static uint8_t try_kb_manip(char * command)
 {
     char * cmp = "keyb_";
@@ -148,7 +148,6 @@ static uint8_t try_client_commands(struct Command * command)
             || try_1args(command, "cyc_win_b", cycle_active_win, 'b')
             || try_1args(command, "scrl_r", scroll_v_screen, '+')
             || try_1args(command, "scrl_l", scroll_v_screen, '-')
-            || try_1args(command, "to_a_keywin", toggle_window, 'a')
             || try_1args(command, "to_g_keywin", toggle_window, '0')
             || try_1args(command, "to_wg_keywin", toggle_window, '1')
             || try_1args(command, "to_wk_keywin", toggle_window, '2')
@@ -156,6 +155,7 @@ static uint8_t try_client_commands(struct Command * command)
             || try_1args(command, "to_infowin", toggle_window, 'i')
             || try_1args(command, "to_inv", toggle_window, 'c')
             || try_1args(command, "to_logwin", toggle_window, 'l')
+            || try_1args(command, "to_terrain", toggle_window, 's')
             || try_0args(command, "winconf", toggle_winconfig)
             || try_1args(command, "grow_h", resize_active_win, '*')
             || try_1args(command, "shri_h", resize_active_win, '_')
@@ -168,6 +168,7 @@ static uint8_t try_client_commands(struct Command * command)
             || try_1args(command, "shift_b", shift_active_win, 'b')
             || try_0args(command, "reload_conf", reload_interface_conf)
             || try_0args(command, "save_conf", save_interface_conf)
+            || try_0args(command, "to_look", toggle_lookmode)
             || try_kb_manip(command->dsc_short));
 }
 
@@ -265,7 +266,7 @@ extern uint8_t try_key(uint16_t key)
     }
     if (command)
     {
-        if      (try_server_commands(command))
+        if (world.look && lookmode_nav(command->dsc_short))
         {
             return 1;
         }
@@ -273,6 +274,10 @@ extern uint8_t try_key(uint16_t key)
         {
             return 1;
         }
+        else if (try_server_commands(command))
+        {
+            return 1;
+        }
         else if (!strcmp("quit", command->dsc_short))
         {
             return 2;