TODO: does this actually catch anything above the bad_flag check?
| 459 | |
| 460 | // TODO: does this actually catch anything above the bad_flag check? |
| 461 | static bool is_valid_item(df::item *item) { |
| 462 | for (size_t i = 0; i < item->general_refs.size(); i++) { |
| 463 | df::general_ref *ref = item->general_refs[i]; |
| 464 | |
| 465 | switch (ref->getType()) { |
| 466 | case general_ref_type::CONTAINED_IN_ITEM: |
| 467 | return false; |
| 468 | |
| 469 | case general_ref_type::UNIT_HOLDER: |
| 470 | return false; |
| 471 | |
| 472 | case general_ref_type::BUILDING_HOLDER: |
| 473 | return false; |
| 474 | |
| 475 | default: |
| 476 | break; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | for (size_t i = 0; i < item->specific_refs.size(); i++) { |
| 481 | df::specific_ref *ref = item->specific_refs[i]; |
| 482 | |
| 483 | if (ref->type == specific_ref_type::JOB) { |
| 484 | // Ignore any items assigned to a job |
| 485 | return false; |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | return true; |
| 490 | } |
| 491 | |
| 492 | struct BadFlags |
| 493 | { |