Skip to content

Commit

Permalink
squashing commits with rebase
Browse files Browse the repository at this point in the history
change progress string formatting

Co-authored-by: Binrui Dong <[email protected]>

replace unecessary if

Co-authored-by: Binrui Dong <[email protected]>

code clarity changes

Co-authored-by: Binrui Dong <[email protected]>

no translation for msg_debug

Co-authored-by: Binrui Dong <[email protected]>

remove right curly brace

Co-authored-by: Binrui Dong <[email protected]>
  • Loading branch information
Saicchi and BrettDong committed Jan 7, 2021
1 parent f76dbe4 commit 96a07cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
19 changes: 5 additions & 14 deletions src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,7 @@ void read_activity_actor::start( player_activity &act, Character &who )
( who.is_npc() || query_yn( _( "Wield the %s and start reading?" ), book->tname() ) ) ) {

if( !who.wield( *book ) ) {
add_msg( m_bad, "%s", who.can_wield( *book ).c_str() );
add_msg( m_bad, who.can_wield( *book ).c_str() );
act.set_to_null();
return;
}
Expand Down Expand Up @@ -2772,17 +2772,8 @@ void read_activity_actor::read_book( Character &learner,
min_ex = learner.adjust_for_focus( min_ex );
max_ex = learner.adjust_for_focus( max_ex );

if( max_ex < 2 ) {
max_ex = 2;
}

if( max_ex > 10 ) {
max_ex = 10;
}

if( max_ex < min_ex ) {
max_ex = min_ex;
}
max_ex = clamp( max_ex, 2, 10 );
max_ex = std::max( min_ex, max_ex );

min_ex *= ( originalSkillLevel + 1 ) * penalty;
min_ex = std::max( min_ex, 1 );
Expand Down Expand Up @@ -2962,7 +2953,7 @@ bool read_activity_actor::player_readma( avatar &you )

int difficulty = std::max( 1, style_to_learn->learn_difficulty );
difficulty = std::max( 1, 20 + difficulty * 2 - you.get_skill_level( skill_used ) * 2 );
add_msg_debug( _( "Chance to learn one in: %d" ), difficulty );
add_msg_debug( "Chance to learn one in: %d", difficulty );

if( one_in( difficulty ) ) {
// learn martial art
Expand Down Expand Up @@ -3138,7 +3129,7 @@ std::string read_activity_actor::get_progress_message( const player_activity & )
you.has_identified( book->typeId() ) ) {
const SkillLevel &skill_level = you.get_skill_level_object( skill );
//~ skill_name current_skill_level -> next_skill_level (% to next level)
return string_format( pgettext( "reading progress", "%s %d -> %d (%d%%)" ),
return string_format( pgettext( "reading progress", "%1$s %2$d -> %3$d (%4$d%%)" ),
skill.obj().name(),
skill_level.level(),
skill_level.level() + 1,
Expand Down
4 changes: 1 addition & 3 deletions src/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,9 +945,7 @@ void npc::do_npc_read()

book = book.obtain( *npc_character );
if( can_read( *book, fail_reasons ) ) {
if( get_player_view().sees( pos() ) ) {
add_msg( m_info, _( "%s starts reading." ), disp_name() );
}
add_msg_if_player_sees( pos(), _( "%s starts reading." ), disp_name() );

// NPCs can't read to other NPCs yet
const int time_taken = time_to_read( *book, *this );
Expand Down

0 comments on commit 96a07cc

Please sign in to comment.