-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make constructions in progress display the progress percentage. #36020
Make constructions in progress display the progress percentage. #36020
Conversation
This project has a specific code style. See doc/CODE_STYLE.md. |
…ost other crafting.
a31ca01
to
3cb822b
Compare
@@ -104,8 +105,20 @@ cata::optional<std::string> player_activity::get_progress_message( const avatar | |||
type == activity_id( "ACT_CHOP_LOGS" ) || | |||
type == activity_id( "ACT_CHOP_PLANKS" ) | |||
) { | |||
const int percentage = ( ( moves_total - moves_left ) * 100 ) / moves_total; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int percentage = ( ( moves_total - moves_left ) * 100 ) / moves_total; | |
const int percentage = ( moves_total - moves_left ) * 100 / moves_total; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved this line I didn't add any additional parens.
Also, I prefer the explicit parens to the implicit depending on the order of operations.
if( type == activity_id( "ACT_BUILD" ) ) { | ||
partial_con *pc = g->m.partial_con_at( g->m.getlocal( u.activity.placement ) ); | ||
if( pc ) { | ||
int counter = std::min( pc->counter, 10000000 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why the next variable is const, bu this one isn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original percentage line above was const. I just copied that line and modified it.
I'm not a huge fan of const'ing everything under the sun so don't typically add it to variables I declare.
Summary
SUMMARY: Interface "Make constructions in progress display the progress percentage."
Purpose of change
Small display change to show percentage of completion for construction tasks.
Describe the solution
Updated player_activity::get_progress_message to get the counter from the partial construction being worked on.
Testing
Loaded up a game and made a charcoal kiln - verified the progress display includes the percentage now.