Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a03b328

Browse files
committed
Modify DFHack to handle new produce() prototype. Major thanks to lethosor, and ragundo for their help in this
Signed-off-by: Michael Casadevall <[email protected]>
1 parent bcefb02 commit a03b328

5 files changed

Lines changed: 13 additions & 11 deletions

File tree

library/modules/Items.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,8 +1375,9 @@ int32_t Items::createItem(df::item_type item_type, int16_t item_subtype, int16_t
13751375

13761376
df::enums::game_type::game_type type = *df::global::gametype;
13771377
prod->produce(unit, &out_products, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
1378-
df::historical_entity::find(unit->civ_id),
1379-
((type == df::enums::game_type::DWARF_MAIN) || (type == df::enums::game_type::DWARF_RECLAIM)) ? df::world_site::find(df::global::ui->site_id) : NULL);
1378+
df::historical_entity::find(unit->civ_id), 0,
1379+
((type == df::enums::game_type::DWARF_MAIN) || (type == df::enums::game_type::DWARF_RECLAIM)) ? df::world_site::find(df::global::ui->site_id) : NULL,
1380+
0);
13801381
if ( out_items.size() != 1 )
13811382
return -1;
13821383

plugins/add-spatter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ struct product_hook : improvement_product {
249249
std::vector<df::reaction_reagent*> *in_reag,
250250
std::vector<df::item*> *in_items,
251251
int32_t quantity, df::job_skill skill,
252-
df::historical_entity *entity, df::world_site *site)
252+
df::historical_entity *entity, int32_t unk, df::world_site *site, void* unk2)
253253
) {
254254
if (auto product = products[this])
255255
{
@@ -295,7 +295,7 @@ struct product_hook : improvement_product {
295295
return;
296296
}
297297

298-
INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, site);
298+
INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, unk, site, unk2);
299299
}
300300
};
301301

plugins/createitem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ bool makeItem (df::reaction_product_itemst *prod, df::unit *unit, bool second_it
8686
building = df::building::find(dest_building);
8787

8888
prod->produce(unit, &out_products, &out_items, &in_reag, &in_items, 1, job_skill::NONE,
89-
df::historical_entity::find(unit->civ_id),
90-
(World::isFortressMode()) ? df::world_site::find(ui->site_id) : NULL);
89+
df::historical_entity::find(unit->civ_id), 0,
90+
(World::isFortressMode()) ? df::world_site::find(ui->site_id) : NULL, 0);
9191
if (!out_items.size())
9292
return false;
9393
// if we asked to make shoes and we got twice as many as we asked, then we're okay

plugins/diggingInvaders/assignJob.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df:
257257
vector<df::reaction_reagent*> in_reag;
258258
vector<df::item*> in_items;
259259
prod->produce(firstInvader, &out_products, &out_items, &in_reag, &in_items, 1, df::job_skill::NONE,
260-
df::historical_entity::find(firstInvader->civ_id),
261-
df::world_site::find(df::global::ui->site_id));
260+
df::historical_entity::find(firstInvader->civ_id), 0,
261+
df::world_site::find(df::global::ui->site_id), 0);
262262

263263
if ( out_items.size() != 1 ) {
264264
out.print("%s, %d: wrong size: %d.\n", __FILE__, __LINE__, out_items.size());

plugins/eventful.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,12 @@ struct product_hook : item_product {
298298
std::vector<df::reaction_reagent*> *in_reag,
299299
std::vector<df::item*> *in_items,
300300
int32_t quantity, df::job_skill skill,
301-
df::historical_entity *entity, df::world_site *site)
301+
df::historical_entity *entity, int32_t unk, df::world_site *site, void* unk2)
302302
) {
303303
color_ostream_proxy out(Core::getInstance().getConsole());
304304
auto product = products[this];
305305
if ( !product ) {
306-
INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, site);
306+
INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, unk, site, unk2);
307307
return;
308308
}
309309
df::reaction* this_reaction=product->react;
@@ -314,7 +314,8 @@ struct product_hook : item_product {
314314
return;
315315

316316
size_t out_item_count = out_items->size();
317-
INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, site);
317+
318+
INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, entity, unk, site, unk2);
318319
if ( out_items->size() == out_item_count )
319320
return;
320321
//if it produced something, call the scripts

0 commit comments

Comments
 (0)