From a03b32846af3daaa135b85cf9d971b71cb313dae Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 13 Jun 2016 16:57:45 -0400 Subject: [PATCH 1/2] Modify DFHack to handle new produce() prototype. Major thanks to lethosor, and ragundo for their help in this Signed-off-by: Michael Casadevall --- library/modules/Items.cpp | 5 +++-- plugins/add-spatter.cpp | 4 ++-- plugins/createitem.cpp | 4 ++-- plugins/diggingInvaders/assignJob.cpp | 4 ++-- plugins/eventful.cpp | 7 ++++--- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/library/modules/Items.cpp b/library/modules/Items.cpp index 4c224a0d6..79bed0f89 100644 --- a/library/modules/Items.cpp +++ b/library/modules/Items.cpp @@ -1375,8 +1375,9 @@ int32_t Items::createItem(df::item_type item_type, int16_t item_subtype, int16_t df::enums::game_type::game_type type = *df::global::gametype; prod->produce(unit, &out_products, &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); + df::historical_entity::find(unit->civ_id), 0, + ((type == df::enums::game_type::DWARF_MAIN) || (type == df::enums::game_type::DWARF_RECLAIM)) ? df::world_site::find(df::global::ui->site_id) : NULL, + 0); if ( out_items.size() != 1 ) return -1; diff --git a/plugins/add-spatter.cpp b/plugins/add-spatter.cpp index 45d636d7c..1e835b8b6 100644 --- a/plugins/add-spatter.cpp +++ b/plugins/add-spatter.cpp @@ -249,7 +249,7 @@ struct product_hook : improvement_product { std::vector *in_reag, std::vector *in_items, int32_t quantity, df::job_skill skill, - df::historical_entity *entity, df::world_site *site) + df::historical_entity *entity, int32_t unk, df::world_site *site, void* unk2) ) { if (auto product = products[this]) { @@ -295,7 +295,7 @@ struct product_hook : improvement_product { return; } - INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, site); + INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, unk, site, unk2); } }; diff --git a/plugins/createitem.cpp b/plugins/createitem.cpp index 156176bbe..e65d19793 100644 --- a/plugins/createitem.cpp +++ b/plugins/createitem.cpp @@ -86,8 +86,8 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it building = df::building::find(dest_building); prod->produce(unit, &out_products, &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); + df::historical_entity::find(unit->civ_id), 0, + (World::isFortressMode()) ? df::world_site::find(ui->site_id) : NULL, 0); if (!out_items.size()) return false; // if we asked to make shoes and we got twice as many as we asked, then we're okay diff --git a/plugins/diggingInvaders/assignJob.cpp b/plugins/diggingInvaders/assignJob.cpp index b7ca6f161..6e3874cbf 100644 --- a/plugins/diggingInvaders/assignJob.cpp +++ b/plugins/diggingInvaders/assignJob.cpp @@ -257,8 +257,8 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map in_reag; vector in_items; prod->produce(firstInvader, &out_products, &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)); + df::historical_entity::find(firstInvader->civ_id), 0, + df::world_site::find(df::global::ui->site_id), 0); if ( out_items.size() != 1 ) { out.print("%s, %d: wrong size: %d.\n", __FILE__, __LINE__, out_items.size()); diff --git a/plugins/eventful.cpp b/plugins/eventful.cpp index 57bd0ed7f..45b94510c 100644 --- a/plugins/eventful.cpp +++ b/plugins/eventful.cpp @@ -298,12 +298,12 @@ struct product_hook : item_product { std::vector *in_reag, std::vector *in_items, int32_t quantity, df::job_skill skill, - df::historical_entity *entity, df::world_site *site) + df::historical_entity *entity, int32_t unk, df::world_site *site, void* unk2) ) { color_ostream_proxy out(Core::getInstance().getConsole()); auto product = products[this]; if ( !product ) { - INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, site); + INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, unk, site, unk2); return; } df::reaction* this_reaction=product->react; @@ -314,7 +314,8 @@ struct product_hook : item_product { return; size_t out_item_count = out_items->size(); - INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, site); + + INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, unk, site, unk2); if ( out_items->size() == out_item_count ) return; //if it produced something, call the scripts From 90c7dc41ecd04da426157b8a18532b377834bed8 Mon Sep 17 00:00:00 2001 From: Michael Casadevall Date: Mon, 13 Jun 2016 17:10:58 -0400 Subject: [PATCH 2/2] Update where library/xml to point to current master Signed-off-by: Michael Casadevall --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index fc914791d..e57ddb652 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit fc914791dede6811f238ffaa4609690203aaa13a +Subproject commit e57ddb652423680698756ecfc84fdcf7fb840948