Skip to content

Commit b4dfaa3

Browse files
SmallJokerest31
authored andcommittedMay 30, 2015
Only retrieve always_fly_fast setting once
1 parent addf3ee commit b4dfaa3

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
 

Diff for: ‎src/localplayer.cpp

+8-10
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,8 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
8686
bool noclip = m_gamedef->checkLocalPrivilege("noclip") &&
8787
g_settings->getBool("noclip");
8888
bool free_move = noclip && fly_allowed && g_settings->getBool("free_move");
89-
if(free_move)
90-
{
91-
position += m_speed * dtime;
89+
if (free_move) {
90+
position += m_speed * dtime;
9291
setPosition(position);
9392
m_sneak_node_exists = false;
9493
return;
@@ -408,11 +407,12 @@ void LocalPlayer::applyControl(float dtime)
408407
// When aux1_descends is enabled the fast key is used to go down, so fast isn't possible
409408
bool fast_climb = fast_move && control.aux1 && !g_settings->getBool("aux1_descends");
410409
bool continuous_forward = g_settings->getBool("continuous_forward");
410+
bool always_fly_fast = g_settings->getBool("always_fly_fast");
411411

412412
// Whether superspeed mode is used or not
413413
bool superspeed = false;
414414

415-
if(g_settings->getBool("always_fly_fast") && free_move && fast_move)
415+
if (always_fly_fast && free_move && fast_move)
416416
superspeed = true;
417417

418418
// Old descend control
@@ -470,7 +470,7 @@ void LocalPlayer::applyControl(float dtime)
470470
if(free_move)
471471
{
472472
// In free movement mode, sneak descends
473-
if(fast_move && (control.aux1 || g_settings->getBool("always_fly_fast")))
473+
if (fast_move && (control.aux1 || always_fly_fast))
474474
speedV.Y = -movement_speed_fast;
475475
else
476476
speedV.Y = -movement_speed_walk;
@@ -517,11 +517,9 @@ void LocalPlayer::applyControl(float dtime)
517517
}
518518
if(control.jump)
519519
{
520-
if(free_move)
521-
{
522-
if(g_settings->getBool("aux1_descends") || g_settings->getBool("always_fly_fast"))
523-
{
524-
if(fast_move)
520+
if (free_move) {
521+
if (g_settings->getBool("aux1_descends") || always_fly_fast) {
522+
if (fast_move)
525523
speedV.Y = movement_speed_fast;
526524
else
527525
speedV.Y = movement_speed_walk;

0 commit comments

Comments
 (0)
Please sign in to comment.