Skip to content

Commit

Permalink
Merge pull request #72777 from RenechCDDA/die_cookslike_DIE
Browse files Browse the repository at this point in the history
Set rot when all components are rotten
  • Loading branch information
I-am-Erk authored Apr 3, 2024
2 parents 229f590 + be175bd commit 1143055
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,14 @@ static void inherit_rot_from_components( item &it )
const time_duration shortest_lifespan = get_shortest_lifespan_from_components( it );
if( shortest_lifespan > 0_turns && shortest_lifespan < it.get_shelf_life() ) {
it.set_rot( it.get_shelf_life() - shortest_lifespan );
return;
}
} else {
const item *most_rotten = get_most_rotten_component( it );
if( most_rotten ) {
it.set_relative_rot( most_rotten->get_relative_rot() );
}
// Fallthrough: shortest_lifespan <= 0_turns (all components are rotten)
}

const item *most_rotten = get_most_rotten_component( it );
if( most_rotten ) {
it.set_relative_rot( most_rotten->get_relative_rot() );
}
}

Expand Down

0 comments on commit 1143055

Please sign in to comment.