Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f4c39d

Browse files
author
jj
committed
showmood: fix fetched/needed quantity calculation
1 parent 7a03f93 commit 8f4c39d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

plugins/showmood.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "df/world.h"
1313
#include "df/job.h"
1414
#include "df/job_item.h"
15+
#include "df/job_item_ref.h"
1516
#include "df/general_ref.h"
1617
#include "df/builtin_mats.h"
1718
#include "df/inorganic_raw.h"
@@ -165,7 +166,10 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
165166
out.print("not yet claimed a workshop but will want");
166167
out.print(" the following items:\n");
167168

168-
int count_got = job->items.size(), got;
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+
count_got += job->items[i]->item->getTotalDimension();
169173

170174
for (size_t i = 0; i < job->job_items.size(); i++)
171175
{
@@ -269,7 +273,9 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
269273
}
270274
}
271275

272-
got = count_got;
276+
// total amount of stuff fetched for this requirement
277+
// XXX may fail with cloth/thread/bars if need 1 and fetch 2
278+
int got = count_got;
273279
if (got > item->quantity)
274280
got = item->quantity;
275281
out.print(", quantity %i (got %i)\n", item->quantity, got);

0 commit comments

Comments
 (0)