Skip to content

Commit

Permalink
Moved diving code before the check for "climbality"
Browse files Browse the repository at this point in the history
  • Loading branch information
Night-Pryanik committed Jan 31, 2020
1 parent 3045555 commit 1503af9
Showing 1 changed file with 27 additions and 27 deletions.
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

0 comments on commit 1503af9

Please sign in to comment.