| 686 | } |
| 687 | |
| 688 | static void generate_control(color_ostream &out) { |
| 689 | map<int, int> fullUnitList; |
| 690 | map<int, int> missingArmor; |
| 691 | map<int, int> missingShoes; |
| 692 | map<int, int> missingHelms; |
| 693 | map<int, int> missingGloves; |
| 694 | map<int, int> missingPants; |
| 695 | |
| 696 | Units::forCitizens([&](auto unit) { |
| 697 | fullUnitList[unit->race]++; |
| 698 | int numArmor = 0, numShoes = 0, numHelms = 0, numGloves = 0, numPants = 0; |
| 699 | for (auto itemId : unit->owned_items) |
| 700 | { |
| 701 | auto item = Items::findItemByID(itemId); |
| 702 | if (!item) { |
| 703 | DEBUG(cycle, out).print("autoclothing: Invalid inventory item ID: {}\n", itemId); |
| 704 | continue; |
| 705 | } |
| 706 | else if (item->getWear() >= 1) |
| 707 | continue; |
| 708 | switch (item->getType()) |
| 709 | { |
| 710 | case df::item_type::ARMOR: |
| 711 | numArmor++; |
| 712 | break; |
| 713 | case df::item_type::SHOES: |
| 714 | numShoes++; |
| 715 | break; |
| 716 | case df::item_type::HELM: |
| 717 | numHelms++; |
| 718 | break; |
| 719 | case df::item_type::GLOVES: |
| 720 | numGloves++; |
| 721 | break; |
| 722 | case df::item_type::PANTS: |
| 723 | numPants++; |
| 724 | break; |
| 725 | default: |
| 726 | break; |
| 727 | } |
| 728 | } |
| 729 | if (numArmor == 0) |
| 730 | missingArmor[unit->race]++; |
| 731 | if (numShoes < 2) |
| 732 | missingShoes[unit->race]++; |
| 733 | if (numHelms == 0) |
| 734 | missingHelms[unit->race]++; |
| 735 | if (numGloves < 2) |
| 736 | missingGloves[unit->race]++; |
| 737 | if (numPants == 0) |
| 738 | missingPants[unit->race]++; |
| 739 | DEBUG(control, out) << DF2CONSOLE(Units::getReadableName(unit)) << |
| 740 | " has " << numArmor << " armor, " << numShoes << " shoes, " << numHelms << |
| 741 | " helms, " << numGloves << " gloves, " << numPants << " pants" << endl; |
| 742 | }); |
| 743 | |
| 744 | if (missingArmor.empty() && missingShoes.empty() && missingHelms.empty() && |
| 745 | missingGloves.empty() && missingPants.empty()) |
no test coverage detected