@@ -166,17 +166,6 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
166166 out.print (" not yet claimed a workshop but will want" );
167167 out.print (" the following items:\n " );
168168
169- // total amount of stuff fetched so far
170- int count_got = 0 ;
171- for (size_t i = 0 ; i < job->items .size (); i++)
172- {
173- df::item_type type = job->job_items [i]->item_type ;
174- if (type == item_type::BAR || type == item_type::CLOTH )
175- count_got += job->items [i]->item ->getTotalDimension ();
176- else
177- count_got += 1 ;
178- }
179-
180169 for (size_t i = 0 ; i < job->job_items .size (); i++)
181170 {
182171 df::job_item *item = job->job_items [i];
@@ -279,13 +268,21 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
279268 }
280269 }
281270
282- // total amount of stuff fetched for this requirement
283- // XXX may fail with cloth/thread/bars if need 1 and fetch 2
284- int got = count_got;
285- if (got > item->quantity )
286- got = item->quantity ;
287- out.print (" , quantity %i (got %i)\n " , item->quantity , got);
288- count_got -= got;
271+ // count how many items of this type the crafter already collected
272+ {
273+ int count_got = 0 ;
274+ for (size_t j = 0 ; j < job->items .size (); j++)
275+ {
276+ if (job->items [j]->job_item_idx == i)
277+ {
278+ if (item->item_type == item_type::BAR || item->item_type == item_type::CLOTH )
279+ count_got += job->items [j]->item ->getTotalDimension ();
280+ else
281+ count_got += 1 ;
282+ }
283+ }
284+ out.print (" , quantity %i (got %i)\n " , item->quantity , count_got);
285+ }
289286 }
290287 }
291288 if (!found)
0 commit comments