showmood: fix fetched/needed quantity calculation

develop
jj 2012-08-09 17:07:20 +02:00
parent 7a03f93dbd
commit 8f4c39d3f5
1 changed files with 8 additions and 2 deletions

@ -12,6 +12,7 @@
#include "df/world.h" #include "df/world.h"
#include "df/job.h" #include "df/job.h"
#include "df/job_item.h" #include "df/job_item.h"
#include "df/job_item_ref.h"
#include "df/general_ref.h" #include "df/general_ref.h"
#include "df/builtin_mats.h" #include "df/builtin_mats.h"
#include "df/inorganic_raw.h" #include "df/inorganic_raw.h"
@ -165,7 +166,10 @@ command_result df_showmood (color_ostream &out, vector <string> & parameters)
out.print("not yet claimed a workshop but will want"); out.print("not yet claimed a workshop but will want");
out.print(" the following items:\n"); 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++) for (size_t i = 0; i < job->job_items.size(); i++)
{ {
@ -269,7 +273,9 @@ command_result df_showmood (color_ostream &out, vector <string> & 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) if (got > item->quantity)
got = item->quantity; got = item->quantity;
out.print(", quantity %i (got %i)\n", item->quantity, got); out.print(", quantity %i (got %i)\n", item->quantity, got);