diff options
author | SmallJoker <mk939@ymail.com> | 2015-05-30 22:24:49 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-05-30 22:29:36 +0200 |
commit | b4dfaa3a7a9251cdb0f0867fc29240c808268b1b (patch) | |
tree | 834129e3a321b3e0ce352895cc0975daadf56ac0 /src | |
parent | addf3ee16559a0e1173bae1e59d9bdbd54e3526c (diff) | |
download | minetest-b4dfaa3a7a9251cdb0f0867fc29240c808268b1b.tar.gz minetest-b4dfaa3a7a9251cdb0f0867fc29240c808268b1b.tar.bz2 minetest-b4dfaa3a7a9251cdb0f0867fc29240c808268b1b.zip |
Only retrieve always_fly_fast setting once
Diffstat (limited to 'src')
-rw-r--r-- | src/localplayer.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index e533dc605..d06015e06 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -86,9 +86,8 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d, bool noclip = m_gamedef->checkLocalPrivilege("noclip") && g_settings->getBool("noclip"); bool free_move = noclip && fly_allowed && g_settings->getBool("free_move"); - if(free_move) - { - position += m_speed * dtime; + if (free_move) { + position += m_speed * dtime; setPosition(position); m_sneak_node_exists = false; return; @@ -408,11 +407,12 @@ void LocalPlayer::applyControl(float dtime) // When aux1_descends is enabled the fast key is used to go down, so fast isn't possible bool fast_climb = fast_move && control.aux1 && !g_settings->getBool("aux1_descends"); bool continuous_forward = g_settings->getBool("continuous_forward"); + bool always_fly_fast = g_settings->getBool("always_fly_fast"); // Whether superspeed mode is used or not bool superspeed = false; - if(g_settings->getBool("always_fly_fast") && free_move && fast_move) + if (always_fly_fast && free_move && fast_move) superspeed = true; // Old descend control @@ -470,7 +470,7 @@ void LocalPlayer::applyControl(float dtime) if(free_move) { // In free movement mode, sneak descends - if(fast_move && (control.aux1 || g_settings->getBool("always_fly_fast"))) + if (fast_move && (control.aux1 || always_fly_fast)) speedV.Y = -movement_speed_fast; else speedV.Y = -movement_speed_walk; @@ -517,11 +517,9 @@ void LocalPlayer::applyControl(float dtime) } if(control.jump) { - if(free_move) - { - if(g_settings->getBool("aux1_descends") || g_settings->getBool("always_fly_fast")) - { - if(fast_move) + if (free_move) { + if (g_settings->getBool("aux1_descends") || always_fly_fast) { + if (fast_move) speedV.Y = movement_speed_fast; else speedV.Y = movement_speed_walk; |