From f48b14563a3e2d4a5a2c50090b11d9e6dfd434b8 Mon Sep 17 00:00:00 2001 From: magnus Date: Thu, 17 Sep 2026 15:05:35 -0500 Subject: [PATCH 1/3] showmood: report bar/cloth/thread requirements in items, not raw units A mood job states a bar, cloth or thread requirement in raw units (150 to a bar, 10000 to a bolt, 15000 to a spool), and one item's whole dimension counts against it. A quantity below one item's worth -- "3" units of metal bars is what a smith's mood actually rolls -- was printed verbatim, so the report read "got 1 of 3" for a mood that already had every bar it needed and had moved on to its next requirement. Convert with a ceiling divide (minimum 1), and add the thread divisor. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01WUrAgtuoK3TPwGbD2hwGeV --- docs/changelog.txt | 1 + plugins/showmood.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 904fcc86fb..245826b38a 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -59,6 +59,7 @@ Template for new versions: ## New Features ## Fixes +- `showmood`: a bar/cloth/thread requirement below one item's worth (e.g. "3" units of metal bars) is now reported as needing 1 item instead of the raw unit count, and thread is converted at 15000 units per spool ## Misc Improvements diff --git a/plugins/showmood.cpp b/plugins/showmood.cpp index 977c767aeb..369d7adcbd 100644 --- a/plugins/showmood.cpp +++ b/plugins/showmood.cpp @@ -277,12 +277,20 @@ command_result df_showmood (color_ostream &out, vector & parameters) divisor = 150; else if (item->item_type == item_type::CLOTH) divisor = 10000; + else if (item->item_type == item_type::THREAD) + divisor = 15000; for (size_t j = 0; j < job->items.size(); j++) { if (job->items[j]->job_item_idx == int32_t(i)) count_got += 1; } - out.print(", got {} of {}\n", count_got, - item->quantity < divisor ? item->quantity : item->quantity/divisor); + // quantity is in raw units (150 to a bar, 10000 to a bolt); an item's whole + // dimension counts against it, so any quantity below one item's worth is + // satisfied by a single item. It used to be printed verbatim in that case, + // reporting "got 1 of 3" for a mood that had all the bars it needed. + int needed = (item->quantity + divisor - 1) / divisor; + if (needed < 1) + needed = 1; + out.print(", got {} of {}\n", count_got, needed); } } } From ef12bd06f624ab90dfe5e711c32a06f4277b8680 Mon Sep 17 00:00:00 2001 From: magnus Date: Thu, 17 Sep 2026 15:19:59 -0500 Subject: [PATCH 2/3] showmood: shorter changelog line and comment --- docs/changelog.txt | 2 +- plugins/showmood.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 245826b38a..5463e3a9bb 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -59,7 +59,7 @@ Template for new versions: ## New Features ## Fixes -- `showmood`: a bar/cloth/thread requirement below one item's worth (e.g. "3" units of metal bars) is now reported as needing 1 item instead of the raw unit count, and thread is converted at 15000 units per spool +- `showmood`: bars, cloth, and thread accurately report they need 1 item instead of 3, due to material sizes. ## Misc Improvements diff --git a/plugins/showmood.cpp b/plugins/showmood.cpp index 369d7adcbd..d469683e18 100644 --- a/plugins/showmood.cpp +++ b/plugins/showmood.cpp @@ -283,10 +283,7 @@ command_result df_showmood (color_ostream &out, vector & parameters) if (job->items[j]->job_item_idx == int32_t(i)) count_got += 1; } - // quantity is in raw units (150 to a bar, 10000 to a bolt); an item's whole - // dimension counts against it, so any quantity below one item's worth is - // satisfied by a single item. It used to be printed verbatim in that case, - // reporting "got 1 of 3" for a mood that had all the bars it needed. + // quantity requested is in raw units (150 to a bar, 10000 to a bolt) int needed = (item->quantity + divisor - 1) / divisor; if (needed < 1) needed = 1; From 30acb4d1f33768ca1838eca6c6ac804b80dd0bcc Mon Sep 17 00:00:00 2001 From: magnus Date: Thu, 17 Sep 2026 15:20:51 -0500 Subject: [PATCH 3/3] showmood: drop the redundant minimum --- plugins/showmood.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/showmood.cpp b/plugins/showmood.cpp index d469683e18..4ffdb3907f 100644 --- a/plugins/showmood.cpp +++ b/plugins/showmood.cpp @@ -285,8 +285,6 @@ command_result df_showmood (color_ostream &out, vector & parameters) } // quantity requested is in raw units (150 to a bar, 10000 to a bolt) int needed = (item->quantity + divisor - 1) / divisor; - if (needed < 1) - needed = 1; out.print(", got {} of {}\n", count_got, needed); } }