| 274 | } |
| 275 | |
| 276 | bool 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 | |
| 296 | bool MaterialInfo::findProduct(df::material* material, const std::string& name) |
| 297 | { |