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

Method findCreature

library/modules/Materials.cpp:276–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

274}
275
276bool MaterialInfo::findCreature(const std::string& token, const std::string& subtoken)
277{
278 if (token.empty() || subtoken.empty())
279 return decode(-1);
280 auto& raws = world->raws;
281 for (size_t i = 0; i < raws.creatures.all.size(); i++)
282 {
283 df::creature_raw* p = raws.creatures.all[i];
284 if (p->creature_id != token)
285 continue;
286
287 for (size_t j = 0; j < p->material.size(); j++)
288 if (p->material[j]->id == subtoken)
289 return decode(CREATURE_BASE + j, i);
290
291 break;
292 }
293 return decode(-1);
294}
295
296bool MaterialInfo::findProduct(df::material* material, const std::string& name)
297{

Callers

nothing calls this directly

Calls 3

decodeFunction · 0.50
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected