From a61503f5b1282ccca63355c9838489cda6f69797 Mon Sep 17 00:00:00 2001 From: adamaxis <44177929+adamaxis@users.noreply.github.com> Date: Sat, 18 May 2024 03:33:20 +0000 Subject: [PATCH] Near-infinite loop fix for when crafter cannot continue (fixes #70530) (#73820) * Near-infinite loop fix for when crafter cannot continue. * Update src/activity_actor.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Update src/activity_actor.cpp Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: Draper, Daniel Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- src/activity_actor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index 37c226d912e09..aa1fae9883e08 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -3652,6 +3652,7 @@ void craft_activity_actor::do_turn( player_activity &act, Character &crafter ) const int assistants = crafter.available_assistant_count( craft.get_making() ); if( crafting_speed <= 0.0f ) { + craft.erase_var( "crafter" ); crafter.cancel_activity(); return; } @@ -3724,6 +3725,7 @@ void craft_activity_actor::do_turn( player_activity &act, Character &crafter ) if( !crafter.craft_consume_tools( craft, five_percent_steps, false ) ) { // So we don't skip over any tool comsuption craft.item_counter -= craft.item_counter % 500'000 + 1; + craft.erase_var( "crafter" ); crafter.cancel_activity(); return; }