Skip to content

Commit

Permalink
Correctly handle liquid's birthday when stored into standing tanks (#…
Browse files Browse the repository at this point in the history
…63760)

* Handle the bday of liquid
  • Loading branch information
SurFlurer authored Feb 25, 2023
1 parent 60dc6bd commit 98ccdc6
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 98ccdc6

Please sign in to comment.