From 8f4c39d3f5ef22ce4065741e1d0cccde20497493 Mon Sep 17 00:00:00 2001 From: jj Date: Thu, 9 Aug 2012 17:07:20 +0200 Subject: [PATCH] showmood: fix fetched/needed quantity calculation --- plugins/showmood.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/showmood.cpp b/plugins/showmood.cpp index 10d7b52c2..0b3fa8a99 100644 --- a/plugins/showmood.cpp +++ b/plugins/showmood.cpp @@ -12,6 +12,7 @@ #include "df/world.h" #include "df/job.h" #include "df/job_item.h" +#include "df/job_item_ref.h" #include "df/general_ref.h" #include "df/builtin_mats.h" #include "df/inorganic_raw.h" @@ -165,7 +166,10 @@ command_result df_showmood (color_ostream &out, vector & parameters) out.print("not yet claimed a workshop but will want"); out.print(" the following items:\n"); - int count_got = job->items.size(), got; + // total amount of stuff fetched so far + int count_got = 0; + for (size_t i = 0; i < job->items.size(); i++) + count_got += job->items[i]->item->getTotalDimension(); for (size_t i = 0; i < job->job_items.size(); i++) { @@ -269,7 +273,9 @@ command_result df_showmood (color_ostream &out, vector & parameters) } } - got = count_got; + // total amount of stuff fetched for this requirement + // XXX may fail with cloth/thread/bars if need 1 and fetch 2 + int got = count_got; if (got > item->quantity) got = item->quantity; out.print(", quantity %i (got %i)\n", item->quantity, got);