| 217 | typedef improvement_product interpose_base; |
| 218 | |
| 219 | DEFINE_VMETHOD_INTERPOSE( |
| 220 | void, produce, |
| 221 | (df::unit *unit, |
| 222 | std::vector<df::reaction_product*> *out_products, |
| 223 | std::vector<df::item*> *out_items, |
| 224 | std::vector<df::reaction_reagent*> *in_reag, |
| 225 | std::vector<df::item*> *in_items, |
| 226 | int32_t quantity, df::job_skill skill, |
| 227 | int32_t quality, df::historical_entity *entity, df::world_site *site, std::vector<df::item *> *improv_items) |
| 228 | ) { |
| 229 | if (auto product = products[this]) |
| 230 | { |
| 231 | auto object = find_item(product->object, in_reag, in_items); |
| 232 | auto material = find_item(product->material, in_reag, in_items); |
| 233 | |
| 234 | if (object && (material || !product->material.reagent)) |
| 235 | { |
| 236 | using namespace df::enums::improvement_type; |
| 237 | |
| 238 | int mattype, matindex; |
| 239 | find_material(&mattype, &matindex, material, product->material); |
| 240 | |
| 241 | df::matter_state state = matter_state::Liquid; |
| 242 | |
| 243 | switch (improvement_type) |
| 244 | { |
| 245 | case COVERED: |
| 246 | if (flags.is_set(reaction_product_improvement_flags::GLAZED)) |
| 247 | state = matter_state::Solid; |
| 248 | break; |
| 249 | case BANDS: |
| 250 | state = matter_state::Paste; |
| 251 | break; |
| 252 | case SPIKES: |
| 253 | state = matter_state::Powder; |
| 254 | break; |
| 255 | default: |
| 256 | break; |
| 257 | } |
| 258 | |
| 259 | int rating = unit ? Units::getEffectiveSkill(unit, skill) : 0; |
| 260 | int size = int(probability*(1.0f + 0.06f*rating)); // +90% at legendary |
| 261 | |
| 262 | object->addContaminant( |
| 263 | mattype, matindex, state, |
| 264 | object->getTemperature(), |
| 265 | size, -1, |
| 266 | 0x8000 // not washed by water, and 'clean items' safe. |
| 267 | ); |
| 268 | } |
| 269 | |
| 270 | return; |
| 271 | } |
| 272 | |
| 273 | INTERPOSE_NEXT(produce)(unit, out_products, out_items, in_reag, in_items, quantity, skill, quality, entity, site, improv_items); |
| 274 | } |
| 275 | }; |
| 276 |
nothing calls this directly
no test coverage detected