|
|
@ -425,7 +425,6 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
int size = world->raws.creatures.all[race]->adultsize;
|
|
|
|
int size = world->raws.creatures.all[race]->adultsize;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto tt = jobTypeMap.find(o->job_type);
|
|
|
|
auto tt = jobTypeMap.find(o->job_type);
|
|
|
|
if (tt == jobTypeMap.end())
|
|
|
|
if (tt == jobTypeMap.end())
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -441,6 +440,21 @@ public:
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static df::manager_order * get_existing_order(df::job_type ty, int16_t sub, int32_t hfid, df::job_material_category mcat) {
|
|
|
|
|
|
|
|
for (auto order : world->manager_orders) {
|
|
|
|
|
|
|
|
if (order->job_type == ty &&
|
|
|
|
|
|
|
|
order->item_type == df::item_type::NONE &&
|
|
|
|
|
|
|
|
order->item_subtype == sub &&
|
|
|
|
|
|
|
|
order->mat_type == -1 &&
|
|
|
|
|
|
|
|
order->mat_index == -1 &&
|
|
|
|
|
|
|
|
order->hist_figure_id == hfid &&
|
|
|
|
|
|
|
|
order->material_category.whole == mcat.whole &&
|
|
|
|
|
|
|
|
order->frequency == df::manager_order::T_frequency::OneTime)
|
|
|
|
|
|
|
|
return order;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int place_orders()
|
|
|
|
int place_orders()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int ordered = 0;
|
|
|
|
int ordered = 0;
|
|
|
@ -532,21 +546,29 @@ public:
|
|
|
|
}
|
|
|
|
}
|
|
|
|
supply[m] -= c;
|
|
|
|
supply[m] -= c;
|
|
|
|
|
|
|
|
|
|
|
|
auto order = new df::manager_order;
|
|
|
|
auto order = get_existing_order(ty, sub, sizes[size], m.job_material);
|
|
|
|
order->job_type = ty;
|
|
|
|
if (order) {
|
|
|
|
order->item_type = df::item_type::NONE;
|
|
|
|
if (order->amount_total > 0) {
|
|
|
|
order->item_subtype = sub;
|
|
|
|
order->amount_left += c;
|
|
|
|
order->mat_type = -1;
|
|
|
|
order->amount_total += c;
|
|
|
|
order->mat_index = -1;
|
|
|
|
}
|
|
|
|
order->amount_left = c;
|
|
|
|
} else {
|
|
|
|
order->amount_total = c;
|
|
|
|
order = new df::manager_order;
|
|
|
|
order->status.bits.validated = false;
|
|
|
|
order->job_type = ty;
|
|
|
|
order->status.bits.active = false;
|
|
|
|
order->item_type = df::item_type::NONE;
|
|
|
|
order->id = world->manager_order_next_id++;
|
|
|
|
order->item_subtype = sub;
|
|
|
|
order->hist_figure_id = sizes[size];
|
|
|
|
order->mat_type = -1;
|
|
|
|
order->material_category = m.job_material;
|
|
|
|
order->mat_index = -1;
|
|
|
|
|
|
|
|
order->amount_left = c;
|
|
|
|
world->manager_orders.push_back(order);
|
|
|
|
order->amount_total = c;
|
|
|
|
|
|
|
|
order->status.bits.validated = false;
|
|
|
|
|
|
|
|
order->status.bits.active = false;
|
|
|
|
|
|
|
|
order->id = world->manager_order_next_id++;
|
|
|
|
|
|
|
|
order->hist_figure_id = sizes[size];
|
|
|
|
|
|
|
|
order->material_category = m.job_material;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
world->manager_orders.push_back(order);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
INFO(cycle).print("tailor: added order #%d for %d %s %s, sized for %s\n",
|
|
|
|
INFO(cycle).print("tailor: added order #%d for %d %s %s, sized for %s\n",
|
|
|
|
order->id,
|
|
|
|
order->id,
|
|
|
|