Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved diving code before the check for terrain's "climbality" #37594

Merged
merged 1 commit into from
Jan 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9930,6 +9930,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;
Expand Down Expand Up @@ -10041,33 +10068,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<map> tmp_map_ptr;
Expand Down