diff --git a/src/game.cpp b/src/game.cpp index 4047562927426..18438d776815b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -9931,6 +9931,33 @@ void game::vertical_move( int movez, bool force ) } } + // > and < are used for diving underwater. + if( m.has_flag( "SWIMMABLE", u.pos() ) && m.has_flag( TFLAG_DEEP_WATER, u.pos() ) ) { + if( movez == -1 ) { + if( u.is_underwater() ) { + add_msg( m_info, _( "You are already underwater!" ) ); + return; + } + if( u.worn_with_flag( "FLOTATION" ) ) { + add_msg( m_info, _( "You can't dive while wearing a flotation device." ) ); + return; + } + u.set_underwater( true ); + ///\EFFECT_STR increases breath-holding capacity while diving + u.oxygen = 30 + 2 * u.str_cur; + add_msg( _( "You dive underwater!" ) ); + } else { + if( u.swim_speed() < 500 || u.shoe_type_count( "swim_fins" ) ) { + u.set_underwater( false ); + add_msg( _( "You surface." ) ); + } else { + add_msg( m_info, _( "You try to surface but can't!" ) ); + } + } + u.moves -= 100; + return; + } + // Force means we're going down, even if there's no staircase, etc. bool climbing = false; int move_cost = 100; @@ -10042,33 +10069,6 @@ void game::vertical_move( int movez, bool force ) u.moves -= 100; } - // > and < are used for diving underwater. - if( m.has_flag( "SWIMMABLE", u.pos() ) && m.has_flag( TFLAG_DEEP_WATER, u.pos() ) ) { - if( movez == -1 ) { - if( u.is_underwater() ) { - add_msg( m_info, _( "You are already underwater!" ) ); - return; - } - if( u.worn_with_flag( "FLOTATION" ) ) { - add_msg( m_info, _( "You can't dive while wearing a flotation device." ) ); - return; - } - u.set_underwater( true ); - ///\EFFECT_STR increases breath-holding capacity while diving - u.oxygen = 30 + 2 * u.str_cur; - add_msg( _( "You dive underwater!" ) ); - } else { - if( u.swim_speed() < 500 || u.shoe_type_count( "swim_fins" ) ) { - u.set_underwater( false ); - add_msg( _( "You surface." ) ); - } else { - add_msg( m_info, _( "You try to surface but can't!" ) ); - } - } - u.moves -= 100; - return; - } - // Shift the map up or down std::unique_ptr tmp_map_ptr;