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

Method findProduct

library/modules/Materials.cpp:296–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296bool MaterialInfo::findProduct(df::material* material, const std::string& name)
297{
298 if (!material || name.empty())
299 return decode(-1);
300
301 auto& pids = material->reaction_product.id;
302 for (size_t i = 0; i < pids.size(); i++)
303 if ((*pids[i]) == name)
304 return decode(material->reaction_product.material, i);
305
306 return decode(-1);
307}
308
309std::string MaterialInfo::getToken() const
310{

Callers 1

find_materialFunction · 0.80

Calls 3

decodeFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected