From be175bd3986829a2a45134a3f2189ca8be0f50da Mon Sep 17 00:00:00 2001 From: RenechCDDA <84619419+RenechCDDA@users.noreply.github.com> Date: Mon, 1 Apr 2024 15:58:57 -0400 Subject: [PATCH] Set rot when all components are rotten --- src/item.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/item.cpp b/src/item.cpp index 62fcc802f15ac..aa0b135f107a6 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -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() ); } }