From b26af4580d566700ca0c7321f2bb5dbf15a73f58 Mon Sep 17 00:00:00 2001 From: Valiant Date: Tue, 22 Oct 2024 12:57:50 +0400 Subject: [PATCH] Do not exit early from `handle_failure` function is there's `breakable` field isn't defined for furniture/terrain Instead, make all calculations for bashing furniture/terrain on failure only if `breakable` field is defined, and print failure message regardless of that check. --- src/activity_actor.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index 6ac06a507caf1..6a808456efb12 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -5941,23 +5941,21 @@ void prying_activity_actor::handle_prying( Character &who ) }; auto handle_failure = [&]( const pry_data & pdata ) -> void { - if( !pdata.breakable ) + if( pdata.breakable ) { - return; - } - - int difficulty = pdata.difficulty; - difficulty -= tool->get_quality( qual_PRY ) - pdata.prying_level; - - /** @EFFECT_MECHANICS reduces chance of breaking when prying */ - const int dice_mech = dice( 2, static_cast( round( who.get_skill_level( skill_mechanics ) ) ) ); - /** @ARM_STR reduces chance of breaking when prying */ - const int dice_str = dice( 2, who.get_arm_str() ); - - if( dice( 4, difficulty ) > dice_mech + dice_str ) - { - // bash will always succeed - here.bash( target, 0, false, true ); + int difficulty = pdata.difficulty; + difficulty -= tool->get_quality( qual_PRY ) - pdata.prying_level; + + /** @EFFECT_MECHANICS reduces chance of breaking when prying */ + const int dice_mech = dice( 2, + static_cast( round( who.get_skill_level( skill_mechanics ) ) ) ); + /** @ARM_STR reduces chance of breaking when prying */ + const int dice_str = dice( 2, who.get_arm_str() ); + + if( dice( 4, difficulty ) > dice_mech + dice_str ) { + // bash will always succeed + here.bash( target, 0, false, true ); + } } if( !data->prying_data().failure.empty() )