Skip to content

Commit

Permalink
fix proficiency precision lost in EoC (#70383)
Browse files Browse the repository at this point in the history
* fix prof train precision lost

Co-authored-by: inogenous <[email protected]>

* Update src/math_parser_diag.cpp

Co-authored-by: andrei <[email protected]>

---------

Co-authored-by: inogenous <[email protected]>
Co-authored-by: andrei <[email protected]>
  • Loading branch information
3 people authored Dec 24, 2023
1 parent 8051970 commit 0b5bf5d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/math_parser_diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,20 +627,19 @@ std::function<double( dialogue & )> proficiency_eval( char scope,
time_duration raw = d.actor( beta )->proficiency_practiced_time( prof );
std::string const format = fmt_val.str( d );
if( format == "percent" ) {
return static_cast<int>( raw * 100 / prof->time_to_learn() );
return raw * 100.0 / prof->time_to_learn();
} else if( format == "permille" ) {
return static_cast<int>( raw * 1000 / prof->time_to_learn() );
return static_cast<double>( raw * 1000 / prof->time_to_learn() );
} else if( format == "total_time_required" ) {
return to_turns<int>( prof->time_to_learn() );
return to_turns<double>( prof->time_to_learn() );
} else if( format == "time_left" ) {
return to_turns<int>( prof->time_to_learn() - raw );
return to_turns<double>( prof->time_to_learn() - raw );
} else {
if( format != "time_spent" ) {
debugmsg( R"(Unknown format type "%s" for proficiency, assumning "time_spent")", format );
}
return to_turns<int>( raw );
return to_turns<double>( raw );
}
return 0;
};
}

Expand Down

0 comments on commit 0b5bf5d

Please sign in to comment.