Skip to content

Commit

Permalink
Set rot when all components are rotten
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Apr 1, 2024
1 parent df6c8e3 commit be175bd
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 be175bd

Please sign in to comment.