summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmaz <Amaz1@users.noreply.github.com>2015-11-09 11:52:52 +0000
committerest31 <MTest31@outlook.com>2015-11-15 13:42:31 +0100
commite664abeb887fe74ff1966e93ed5201c6e19a5c31 (patch)
tree27123c2ece73632d762254b0d2b59c53ed7b0c26 /src
parent3f8eb5e0d0a7dd30bfd6b805d6c03e0f45182e9a (diff)
downloadminetest-e664abeb887fe74ff1966e93ed5201c6e19a5c31.tar.gz
minetest-e664abeb887fe74ff1966e93ed5201c6e19a5c31.tar.bz2
minetest-e664abeb887fe74ff1966e93ed5201c6e19a5c31.zip
Add a status text for autorun
Diffstat (limited to 'src')
-rw-r--r--src/game.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 1738517b5..e6a1a2256 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1496,6 +1496,7 @@ protected:
void toggleFast(float *statustext_time);
void toggleNoClip(float *statustext_time);
void toggleCinematic(float *statustext_time);
+ void toggleAutorun(float *statustext_time);
void toggleChat(float *statustext_time, bool *flag);
void toggleHud(float *statustext_time, bool *flag);
@@ -2618,10 +2619,8 @@ void Game::processKeyboardInput(VolatileRunFlags *flags,
if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_DROP])) {
dropSelectedItem();
- // Add WoW-style autorun by toggling continuous forward.
} else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_AUTORUN])) {
- bool autorun_setting = g_settings->getBool("continuous_forward");
- g_settings->setBool("continuous_forward", !autorun_setting);
+ toggleAutorun(statustext_time);
} else if (input->wasKeyDown(keycache.key[KeyCache::KEYMAP_ID_INVENTORY])) {
openInventory();
} else if (input->wasKeyDown(EscapeKey) || input->wasKeyDown(CancelKey)) {
@@ -2851,6 +2850,16 @@ void Game::toggleCinematic(float *statustext_time)
statustext = msg[cinematic];
}
+// Add WoW-style autorun by toggling continuous forward.
+void Game::toggleAutorun(float *statustext_time)
+{
+ static const wchar_t *msg[] = { L"autorun disabled", L"autorun enabled" };
+ bool autorun_enabled = !g_settings->getBool("continuous_forward");
+ g_settings->set("continuous_forward", bool_to_cstr(autorun_enabled));
+
+ *statustext_time = 0;
+ statustext = msg[autorun_enabled ? 1 : 0];
+}
void Game::toggleChat(float *statustext_time, bool *flag)
{