| 1036 | } |
| 1037 | |
| 1038 | static void map_job_items(color_ostream &out) |
| 1039 | { |
| 1040 | for (size_t i = 0; i < constraints.size(); i++) |
| 1041 | { |
| 1042 | constraints[i]->item_amount = 0; |
| 1043 | constraints[i]->item_count = 0; |
| 1044 | constraints[i]->item_inuse_amount = 0; |
| 1045 | constraints[i]->item_inuse_count = 0; |
| 1046 | } |
| 1047 | |
| 1048 | meltable_count = 0; |
| 1049 | |
| 1050 | // Precompute a bitmask with the bad flags |
| 1051 | df::item_flags bad_flags; |
| 1052 | bad_flags.whole = 0; |
| 1053 | |
| 1054 | #define F(x) bad_flags.bits.x = true; |
| 1055 | F(dump); F(forbid); F(garbage_collect); |
| 1056 | F(hostile); F(on_fire); F(rotten); F(trader); |
| 1057 | F(in_building); F(construction); F(artifact); |
| 1058 | #undef F |
| 1059 | |
| 1060 | bool dry_buckets = isOptionEnabled(CF_DRYBUCKETS); |
| 1061 | |
| 1062 | std::vector<df::item*> &items = world->items.other[items_other_id::IN_PLAY]; |
| 1063 | |
| 1064 | for (size_t i = 0; i < items.size(); i++) |
| 1065 | { |
| 1066 | df::item *item = items[i]; |
| 1067 | |
| 1068 | if (item->flags.whole & bad_flags.whole) |
| 1069 | continue; |
| 1070 | |
| 1071 | df::item_type itype = item->getType(); |
| 1072 | int16_t isubtype = item->getSubtype(); |
| 1073 | int16_t imattype = item->getActualMaterial(); |
| 1074 | int32_t imatindex = item->getActualMaterialIndex(); |
| 1075 | |
| 1076 | bool is_invalid = false; |
| 1077 | |
| 1078 | // don't count worn items |
| 1079 | if (item->getWear() >= 1) |
| 1080 | is_invalid = true; |
| 1081 | |
| 1082 | // Special handling |
| 1083 | switch (itype) { |
| 1084 | case item_type::BUCKET: |
| 1085 | if (dry_buckets && !item->flags.bits.in_job) |
| 1086 | dryBucket(item); |
| 1087 | break; |
| 1088 | |
| 1089 | case item_type::THREAD: |
| 1090 | if (item->flags.bits.spider_web) |
| 1091 | continue; |
| 1092 | if (item->getTotalDimension() < 15000) |
| 1093 | is_invalid = true; |
| 1094 | break; |
| 1095 |
no test coverage detected