Skip to content

Commit

Permalink
Merge pull request CleverRaven#70516 from Ramza13/fix-auto-consume-bugs
Browse files Browse the repository at this point in the history
Fixes for auto consume issue
  • Loading branch information
Maleclypse authored Dec 30, 2023
2 parents ab02717 + a4a90b8 commit ff71dff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3519,9 +3519,9 @@ int get_auto_consume_moves( Character &you, const bool food )
}

if( best_comestible ) {
int consume_moves = -Pickup::cost_to_move_item( you,
*best_comestible ) * std::max( rl_dist( you.pos(),
here.getlocal( best_comestible.position() ) ), 1 );
//The moves it takes you to walk there and back.
int consume_moves = 2 * you.run_cost( 100, false ) * std::max( rl_dist( you.pos(),
here.getlocal( best_comestible.position() ) ), 1 );
consume_moves += to_moves<int>( you.get_consume_time( *best_comestible ) );

you.consume( best_comestible );
Expand Down
2 changes: 2 additions & 0 deletions src/player_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,15 @@ void player_activity::do_turn( Character &you )
!no_food_nearby_for_auto_consume ) {
int consume_moves = get_auto_consume_moves( you, true );
moves_left += consume_moves;
moves_total += consume_moves;
if( consume_moves == 0 ) {
no_food_nearby_for_auto_consume = true;
}
}
if( you.get_thirst() > 130 && !no_drink_nearby_for_auto_consume ) {
int consume_moves = get_auto_consume_moves( you, false );
moves_left += consume_moves;
moves_total += consume_moves;
if( consume_moves == 0 ) {
no_drink_nearby_for_auto_consume = true;
}
Expand Down

0 comments on commit ff71dff

Please sign in to comment.