Update structures and fix various issues with plugins producing items

reaction_product::produce() takes a new unidentified vector<void*>*.
Passing a reference to an empty vector appears to work.
develop
lethosor 2015-12-18 18:40:11 -05:00
parent 347a112aa1
commit 55d5706a21
6 changed files with 16 additions and 9 deletions

@ -1369,9 +1369,10 @@ int32_t Items::createItem(df::item_type item_type, int16_t item_subtype, int16_t
vector<df::item*> out_items;
vector<df::reaction_reagent*> in_reag;
vector<df::item*> in_items;
vector<void*> unk;
df::enums::game_type::game_type type = *df::global::gametype;
prod->produce(unit, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
prod->produce(unit, &unk, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
df::historical_entity::find(unit->civ_id),
((type == df::enums::game_type::DWARF_MAIN) || (type == df::enums::game_type::DWARF_RECLAIM)) ? df::world_site::find(df::global::ui->site_id) : NULL);
if ( out_items.size() != 1 )

@ -1 +1 @@
Subproject commit 6e2e8731d2c10a4a5394046ae48cc0cd16e9a049
Subproject commit 36f94c0fcf09f0985595c7b9c9ad0c7170beed2d

@ -243,7 +243,9 @@ struct product_hook : improvement_product {
DEFINE_VMETHOD_INTERPOSE(
void, produce,
(df::unit *unit, std::vector<df::item*> *out_items,
(df::unit *unit,
std::vector<void*> *unk,
std::vector<df::item*> *out_items,
std::vector<df::reaction_reagent*> *in_reag,
std::vector<df::item*> *in_items,
int32_t quantity, df::job_skill skill,
@ -293,7 +295,7 @@ struct product_hook : improvement_product {
return;
}
INTERPOSE_NEXT(produce)(unit, out_items, in_reag, in_items, quantity, skill, entity, site);
INTERPOSE_NEXT(produce)(unit, unk, out_items, in_reag, in_items, quantity, skill, entity, site);
}
};

@ -73,6 +73,7 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it
vector<df::item *> out_items;
vector<df::reaction_reagent *> in_reag;
vector<df::item *> in_items;
vector<void*> unk;
bool is_gloves = (prod->item_type == item_type::GLOVES);
bool is_shoes = (prod->item_type == item_type::SHOES);
@ -83,7 +84,7 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it
if (dest_building != -1)
building = df::building::find(dest_building);
prod->produce(unit, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
prod->produce(unit, &unk, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
df::historical_entity::find(unit->civ_id),
(World::isFortressMode()) ? df::world_site::find(ui->site_id) : NULL);
if (!out_items.size())

@ -255,7 +255,8 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df:
vector<df::item*> out_items;
vector<df::reaction_reagent*> in_reag;
vector<df::item*> in_items;
prod->produce(firstInvader, &out_items, &in_reag, &in_items, 1, df::job_skill::NONE,
vector<void*> unk;
prod->produce(firstInvader, &unk, &out_items, &in_reag, &in_items, 1, df::job_skill::NONE,
df::historical_entity::find(firstInvader->civ_id),
df::world_site::find(df::global::ui->site_id));

@ -309,7 +309,9 @@ struct product_hook : item_product {
DEFINE_VMETHOD_INTERPOSE(
void, produce,
(df::unit *unit, std::vector<df::item*> *out_items,
(df::unit *unit,
std::vector<void*> *unk,
std::vector<df::item*> *out_items,
std::vector<df::reaction_reagent*> *in_reag,
std::vector<df::item*> *in_items,
int32_t quantity, df::job_skill skill,
@ -318,7 +320,7 @@ struct product_hook : item_product {
color_ostream_proxy out(Core::getInstance().getConsole());
auto product = products[this];
if ( !product ) {
INTERPOSE_NEXT(produce)(unit, out_items, in_reag, in_items, quantity, skill, entity, site);
INTERPOSE_NEXT(produce)(unit, unk, out_items, in_reag, in_items, quantity, skill, entity, site);
return;
}
df::reaction* this_reaction=product->react;
@ -329,7 +331,7 @@ struct product_hook : item_product {
return;
size_t out_item_count = out_items->size();
INTERPOSE_NEXT(produce)(unit, out_items, in_reag, in_items, quantity, skill, entity, site);
INTERPOSE_NEXT(produce)(unit, unk, out_items, in_reag, in_items, quantity, skill, entity, site);
if ( out_items->size() == out_item_count )
return;
//if it produced something, call the scripts