Skip to content

Commit

Permalink
Options to allow previous behavior around prompt for dangerous terrain (
Browse files Browse the repository at this point in the history
#36037)

* Add new options to always prompt fo rdangerous terrain and only while crouching.
* Changed default to legacy behavior
  • Loading branch information
Ramza13 authored and kevingranade committed Dec 31, 2019
1 parent ab4acd2 commit 1e3f85e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
24 changes: 18 additions & 6 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> harmful_stuff = get_dangerous_tile( dest_loc );
std::vector<std::string> harmful_stuff = get_dangerous_tile( dest_loc );
if( get_option<std::string>( "DANGEROUS_TERRAIN_WARNING_PROMPT" ) == "ALWAYS" &&
!prompt_dangerous_tile( dest_loc ) ) {
return true;
} else if( get_option<std::string>( "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<std::string>( "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<std::string>( "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<bool>( "DANGEROUS_RUNNING" ) ) {
if( !prompt_dangerous_tile( dest_loc ) ) {
return true;
}
}
}
// Used to decide whether to print a 'moving is slow message
Expand Down
8 changes: 5 additions & 3 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"]++;
Expand Down

0 comments on commit 1e3f85e

Please sign in to comment.