Skip to content
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

Reduce liquid volume per turn by a factor of 6 #34234

Merged
merged 4 commits into from
Sep 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1330,9 +1330,9 @@ void activity_handlers::fill_liquid_do_turn( player_activity *act, player *p )
break;
}

static const auto volume_per_turn = units::from_liter( 4 );
const int charges_per_turn = std::max( 1, liquid.charges_per_volume( volume_per_turn ) );
liquid.charges = std::min( charges_per_turn, liquid.charges );
static const units::volume volume_per_second = units::from_liter( 4 / 6 );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You changed this to 1 liter per second. 4 / 6 is 1 in C++ (both operands are integers, so integer division is performed). If you wan't floating points, you have to explicitly make one operand a floating point value: ( 4. / 6 )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's 0 actually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh my brain, I should have noticed that but for some reason I thought it was ok because of the units interface.

const int charges_per_second = std::max( 1, liquid.charges_per_volume( volume_per_second ) );
liquid.charges = std::min( charges_per_second, liquid.charges );
const int original_charges = liquid.charges;
if( liquid.has_temperature() && liquid.specific_energy < 0 ) {
liquid.set_item_temperature( std::max( temp_to_kelvin( g->weather.get_temperature( p->pos() ) ),
Expand Down