Skip to content

Commit

Permalink
act_read minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Saicchi committed Jul 9, 2021
1 parent e9fc036 commit de4a778
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
7 changes: 5 additions & 2 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,11 @@ void read_activity_actor::do_turn( player_activity &act, Character &who )
who.mod_stamina( -1 );
}

add_msg_debug( debugmode::DF_ACT_READ, "reading time = %s",
to_string( time_duration::from_moves( moves_total ) ) );
// do not spam the message log
if( calendar::once_every( 5_minutes ) ) {
add_msg_debug( debugmode::DF_ACT_READ, "reading time = %s",
to_string( time_duration::from_moves( act.moves_left ) ) );
}
} else {
who.moves = 0;
}
Expand Down
12 changes: 7 additions & 5 deletions src/activity_actor_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,11 +441,13 @@ class read_activity_actor : public activity_actor
bool player_readma( avatar &you ); // Martial arts book
bool npc_read( npc &learner );

// TODO: RESUMABLE
// virtual bool can_resume_with_internal( const activity_actor &,
// const Character & ) const {
// return false;
// }
bool can_resume_with_internal( const activity_actor &other,
const Character & ) const override {
const read_activity_actor &actor = static_cast<const read_activity_actor &>( other );
return continuous == actor.continuous &&
learner_id == actor.learner_id &&
book->typeId() == actor.book->typeId();
}
};

class move_items_activity_actor : public activity_actor
Expand Down
3 changes: 2 additions & 1 deletion src/avatar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ bool avatar::read( item_location &book )

bool continuous = false;
const int time_taken = time_to_read( *book, *reader );
add_msg_debug( debugmode::DF_ACT_READ, "avatar::read: time_taken = %d", time_taken );
add_msg_debug( debugmode::DF_ACT_READ, "avatar::read time_taken = %s",
to_string( time_duration::from_moves( time_taken ) ) );

// If the player hasn't read this book before, skim it to get an idea of what's in it.
if( !has_identified( book->typeId() ) ) {
Expand Down

0 comments on commit de4a778

Please sign in to comment.