From 1e3f85e023dbfff32087a7586539fa1e9338a3be Mon Sep 17 00:00:00 2001 From: Eric <52087122+Ramza13@users.noreply.github.com> Date: Mon, 30 Dec 2019 21:47:21 -0500 Subject: [PATCH] Options to allow previous behavior around prompt for dangerous terrain (#36037) * Add new options to always prompt fo rdangerous terrain and only while crouching. * Changed default to legacy behavior --- src/game.cpp | 24 ++++++++++++++++++------ src/options.cpp | 8 +++++--- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/src/game.cpp b/src/game.cpp index 0d7457525d324..a41fdd9cce361 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -8949,16 +8949,28 @@ bool game::walk_move( const tripoint &dest_loc ) u.set_underwater( false ); if( !shifting_furniture && !pushing && is_dangerous_tile( dest_loc ) ) { - if( !u.movement_mode_is( CMM_RUN ) ) { - std::vector harmful_stuff = get_dangerous_tile( dest_loc ); + std::vector harmful_stuff = get_dangerous_tile( dest_loc ); + if( get_option( "DANGEROUS_TERRAIN_WARNING_PROMPT" ) == "ALWAYS" && + !prompt_dangerous_tile( dest_loc ) ) { + return true; + } else if( get_option( "DANGEROUS_TERRAIN_WARNING_PROMPT" ) == "RUNNING" && + ( !u.movement_mode_is( CMM_RUN ) || !prompt_dangerous_tile( dest_loc ) ) ) { + add_msg( m_warning, + _( "Stepping into that %1$s looks risky. Run into it if you wish to enter anyway." ), + enumerate_as_string( harmful_stuff ) ); + return true; + } else if( get_option( "DANGEROUS_TERRAIN_WARNING_PROMPT" ) == "CROUCHING" && + ( !u.movement_mode_is( CMM_CROUCH ) || !prompt_dangerous_tile( dest_loc ) ) ) { + add_msg( m_warning, + _( "Stepping into that %1$s looks risky. Crouch and move into it if you wish to enter anyway." ), + enumerate_as_string( harmful_stuff ) ); + return true; + } else if( get_option( "DANGEROUS_TERRAIN_WARNING_PROMPT" ) == "NEVER" && + !u.movement_mode_is( CMM_RUN ) ) { add_msg( m_warning, _( "Stepping into that %1$s looks risky. Run into it if you wish to enter anyway." ), enumerate_as_string( harmful_stuff ) ); return true; - } else if( !get_option( "DANGEROUS_RUNNING" ) ) { - if( !prompt_dangerous_tile( dest_loc ) ) { - return true; - } } } // Used to decide whether to print a 'moving is slow message diff --git a/src/options.cpp b/src/options.cpp index 7c016b57f738c..df472bb059c3b 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -1140,9 +1140,11 @@ void options_manager::add_options_general() false ); - add( "DANGEROUS_RUNNING", "general", translate_marker( "Dangerous running" ), - translate_marker( "If true, the player will not be prevented from moving into known hazardous tiles while running." ), - false + add( "DANGEROUS_TERRAIN_WARNING_PROMPT", "general", + translate_marker( "Dangerous terrain warning prompt" ), + translate_marker( "Always: You will be prompted to move onto dangerous tiles. Running: You will only be able to move onto dangerous tiles while running and will be prompted. Crouching: You will only be able to move onto a dangerous tile while crouching and will be prompted. Never: You will not be able to move onto a dangerous tile unless running and will not be warned or prompted." ), + { { "ALWAYS", to_translation( "Always" ) }, { "RUNNING", translate_marker( "Running" ) }, { "CROUCHING", translate_marker( "Crouching" ) }, { "NEVER", translate_marker( "Never" ) } }, + "ALWAYS" ); mOptionsSort["general"]++;