diff --git a/src/activity_handlers.cpp b/src/activity_handlers.cpp index 2c65052a7b5d2..d0289e105c72f 100644 --- a/src/activity_handlers.cpp +++ b/src/activity_handlers.cpp @@ -2673,7 +2673,7 @@ void activity_handlers::craft_do_turn( player_activity *act, player *p ) } // item_counter represents the percent progress relative to the base batch time - // stored precise to 2 decimal places ( e.g. 67.32 percent would be stored as 6732 ) + // stored precise to 5 decimal places ( e.g. 67.32 percent would be stored as 6732000 ) // Base moves for batch size with no speed modifier or assistants // Must ensure >= 1 so we don't divide by 0; @@ -2683,13 +2683,14 @@ void activity_handlers::craft_do_turn( player_activity *act, player *p ) // Delta progress in moves adjusted for current crafting speed const double delta_progress = p->get_moves() * base_total_moves / cur_total_moves; // Current progress in moves - const double current_progress = craft->item_counter * base_total_moves / 10000.0 + delta_progress; + const double current_progress = craft->item_counter * base_total_moves / 10000000.0 + + delta_progress; // Current progress as a percent of base_total_moves to 2 decimal places - craft->item_counter = current_progress / base_total_moves * 10000.0; + craft->item_counter = round( current_progress / base_total_moves * 10000000.0 ); p->set_moves( 0 ); // if item_counter has reached 100% or more - if( craft->item_counter >= 10000 ) { + if( craft->item_counter >= 10000000 ) { p->cancel_activity(); item craft_copy = p->i_rem( craft ); p->complete_craft( craft_copy ); diff --git a/src/item.cpp b/src/item.cpp index 38f8119b59e80..c85695cfa6e34 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -2121,7 +2121,7 @@ std::string item::info( std::vector &info, const iteminfo_query *parts } else { if( is_craft() ) { const std::string desc = _( "This is an in progress %s. It is %d percent complete." ); - const int percent_progress = item_counter / 100; + const int percent_progress = item_counter / 100000; info.push_back( iteminfo( "DESCRIPTION", string_format( desc, making->result_name(), percent_progress ) ) ); @@ -2989,7 +2989,7 @@ std::string item::tname( unsigned int quantity, bool with_prefix, unsigned int t if( charges > 1 ) { ret << " (" << charges << ")"; } - const int percent_progress = item_counter / 100; + const int percent_progress = item_counter / 100000; ret << " (" << percent_progress << "%)"; maintext = ret.str(); } else if( contents.size() == 1 ) {