MCPcopy Create free account
hub / github.com/DFHack/dfhack / find_reactions

Function find_reactions

plugins/eventful.cpp:428–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428static bool find_reactions(color_ostream &out)
429{
430 reactions.clear();
431
432 auto &rlist = df::reaction::get_vector();
433
434 for (size_t i = 0; i < rlist.size(); i++)
435 {
436 reactions[rlist[i]->code].react = rlist[i];
437 }
438
439 for (auto it = reactions.begin(); it != reactions.end(); ++it)
440 {
441 auto &prod = it->second.react->products;
442 auto &out_prod = it->second.products;
443
444 for (size_t i = 0; i < prod.size(); i++)
445 {
446 auto itprod = strict_virtual_cast<item_product>(prod[i]);
447 if (!itprod) continue;
448
449 out_prod.push_back(ProductInfo());
450 parse_product(out, out_prod.back(), it->second.react, itprod);
451 }
452
453 for (size_t i = 0; i < out_prod.size(); i++)
454 {
455 if (out_prod[i].isValid())
456 products[out_prod[i].product] = &out_prod[i];
457 }
458 }
459
460 return !products.empty();
461}
462
463static void enable_hooks(bool enable)
464{

Callers 1

world_specific_hooksFunction · 0.70

Calls 8

ProductInfoClass · 0.70
parse_productFunction · 0.70
clearMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
isValidMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected