added in-game key shortcuts for toggling free_move and fast_move (default K and J)
authorPerttu Ahola <celeron55@gmail.com>
Fri, 17 Jun 2011 20:55:21 +0000 (23:55 +0300)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 17 Jun 2011 20:55:21 +0000 (23:55 +0300)
src/defaultsettings.cpp
src/game.cpp

index e57157a8238449f7fe0f4221f1ef59fa8b71c513..8ae5694e544581c3ccd33b5fa722a89e2d0c8e93 100644 (file)
@@ -40,6 +40,8 @@ void set_default_settings()
        g_settings.setDefault("keymap_inventory", "KEY_KEY_I");
        g_settings.setDefault("keymap_chat", "KEY_KEY_T");
        g_settings.setDefault("keymap_rangeselect", "KEY_KEY_R");
+       g_settings.setDefault("keymap_freemove", "KEY_KEY_K");
+       g_settings.setDefault("keymap_fastmove", "KEY_KEY_J");
        // Some (temporary) keys for debugging
        g_settings.setDefault("keymap_special1", "KEY_KEY_E");
        g_settings.setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
index eef27c805ec6a1f39432e2a9e41252983b98e9de..09f06f4f6140bbfb7b8e5b05906ad0df877e500b 100644 (file)
@@ -1190,6 +1190,32 @@ void the_game(
                                        &g_menumgr, dest,
                                        L""))->drop();
                }
+               else if(input->wasKeyDown(getKeySetting("keymap_freemove")))
+               {
+                       if(g_settings.getBool("free_move"))
+                       {
+                               g_settings.set("free_move","false");
+                               chat_lines.push_back(ChatLine(L"free_move disabled"));
+                       }
+                       else
+                       {
+                               g_settings.set("free_move","true");
+                               chat_lines.push_back(ChatLine(L"free_move enabled"));
+                       }
+               }
+               else if(input->wasKeyDown(getKeySetting("keymap_fastmove")))
+               {
+                       if(g_settings.getBool("fast_move"))
+                       {
+                               g_settings.set("fast_move","false");
+                               chat_lines.push_back(ChatLine(L"fast_move disabled"));
+                       }
+                       else
+                       {
+                               g_settings.set("fast_move","true");
+                               chat_lines.push_back(ChatLine(L"fast_move enabled"));
+                       }
+               }
 
                // Item selection with mouse wheel
                {