summaryrefslogtreecommitdiff
path: root/plugins/showmood.cpp
diff options
context:
space:
mode:
authorjj2012-08-09 17:07:20 +0200
committerjj2012-08-09 17:07:20 +0200
commit8f4c39d3f5ef22ce4065741e1d0cccde20497493 (patch)
treebadb20f077029a3f15d6f8c4621ec48e9994079d /plugins/showmood.cpp
parent7a03f93dbd4f1a3af2d8c367b4cba22d675d2a82 (diff)
downloaddfhack-8f4c39d3f5ef22ce4065741e1d0cccde20497493.tar.gz
dfhack-8f4c39d3f5ef22ce4065741e1d0cccde20497493.tar.bz2
dfhack-8f4c39d3f5ef22ce4065741e1d0cccde20497493.tar.xz
showmood: fix fetched/needed quantity calculation
Diffstat (limited to 'plugins/showmood.cpp')
-rw-r--r--plugins/showmood.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/showmood.cpp b/plugins/showmood.cpp
index 10d7b52c..0b3fa8a9 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 <string> & 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 <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)
got = item->quantity;
out.print(", quantity %i (got %i)\n", item->quantity, got);