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

Correctly handle liquid's birthday when stored into standing tanks #63760

Merged
merged 2 commits into from
Feb 25, 2023
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
4 changes: 3 additions & 1 deletion src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3641,12 +3641,14 @@ void iexamine::keg( Character &you, const tripoint &examp )
std::vector<itype_id> drink_types;
std::vector<std::string> drink_names;
std::vector<double> drink_rot;
std::vector<time_point> drink_bday;
for( item *&drink : drinks_inv ) {
auto found_drink = std::find( drink_types.begin(), drink_types.end(), drink->typeId() );
if( found_drink == drink_types.end() ) {
drink_types.push_back( drink->typeId() );
drink_names.push_back( item::nname( drink->typeId() ) );
drink_rot.push_back( drink->get_relative_rot() );
drink_bday.push_back( drink->birthday() );
} else {
auto rot_iter = std::next( drink_rot.begin(), std::distance( drink_types.begin(), found_drink ) );
// Yep, worst rot wins.
Expand Down Expand Up @@ -3676,7 +3678,7 @@ void iexamine::keg( Character &you, const tripoint &examp )
//Store liquid chosen in the keg
itype_id drink_type = drink_types[ drink_index ];
int charges_held = you.charges_of( drink_type );
item drink( drink_type, calendar::turn_zero );
item drink( drink_type, drink_bday[ drink_index ] );
drink.set_relative_rot( drink_rot[ drink_index ] );
drink.charges = 0;
bool keg_full = false;
Expand Down