| 166 | typedef df::item_constructed interpose_base; |
| 167 | |
| 168 | DEFINE_VMETHOD_INTERPOSE(bool, isImprovable, (df::job *job, int16_t mat_type, int32_t mat_index)) |
| 169 | { |
| 170 | ReactionInfo *info; |
| 171 | |
| 172 | if (job && job->job_type == job_type::CustomReaction && |
| 173 | (info = find_reaction(job->reaction_name)) != NULL) |
| 174 | { |
| 175 | if (!contaminants || contaminants->empty()) |
| 176 | return true; |
| 177 | |
| 178 | item_table table; |
| 179 | index_items(table, job, info); |
| 180 | |
| 181 | for (size_t i = 0; i < info->products.size(); i++) |
| 182 | { |
| 183 | auto &product = info->products[i]; |
| 184 | |
| 185 | int mattype, matindex; |
| 186 | auto material = find_item(info->products[i].material, table); |
| 187 | |
| 188 | find_material(&mattype, &matindex, material, product.material); |
| 189 | |
| 190 | if (mattype < 0 || has_contaminant(this, mattype, matindex) >= 50) |
| 191 | return false; |
| 192 | } |
| 193 | |
| 194 | return true; |
| 195 | } |
| 196 | |
| 197 | return INTERPOSE_NEXT(isImprovable)(job, mat_type, mat_index); |
| 198 | } |
| 199 | }; |
| 200 | |
| 201 | IMPLEMENT_VMETHOD_INTERPOSE(item_hook, isImprovable); |
nothing calls this directly
no test coverage detected