[8561] Catastrophically failing at crafting Cooked Liver and Cracklins does not consume components

As the title says. Trying to cook cooked liver or cracklins at skill level 1 has a chance of failing and destroying some ingredients. Currently though, there is no risk of that happening.

I don’t know if this is more widespread (does it only effect failing creating components with only one initial ingredient? Does it only fail for food items?), but those two recipes have been confirmed to be the ones that I have tested, and don’t have time for more testing ATM.

1 Like

tl;dr: Change Line 446 of crafting.cpp from

if( cou > 0 && one_in( 2 ) ) {
to
if( cou > 0 || one_in( 2 ) ) {

I did a bit more research just now, and it is definitely broken. After cooking 20 lards at skill level 0 and 1, I never consumed any fat. After crafting 5 upgraded solar panels at skill level 0, I consumed the following: 1 solar panel, 30 copper wires, 8 amplifier circuits, 8 solar cells, 2 power converters, and no solder.

According to the comments though (line 444/445 of crafting.cpp)

    // Each component currently has 50% chance of not being consumed
    // Skip first item so failed craft with one item recipe always loses component

I don’t know how to compile and test exactly what is wrong, but it is certainly not working as intended. My hunch? Line 446 reads:

if( cou > 0 && one_in( 2 ) ) {

But if the comments are correct, it should read:

if( cou > 0 || one_in( 2 ) ) {

Currently, I think that it is never consuming the first thing in the inventory list, instead of always consuming the first thing in the inventory list.

make a pull request on the github if you’re confident it fixes is

I am not confident it fixes it (can’t compile it from source code), and haven’t got a github account etc., so someone else with github / a version that they can compile can go ahead and do that. That is my best guess from eyeballing the code.

I don’t have any time to test today, but I’ll compile and upload you a build with that exact change and you can report back, if testing goes well, I’ll make a PR

Windows x64 is fine right?

Yip, Windows x64 is what I am using. Thanks!

alright, paste this exe into the newest build and tell me if it’s fixed
I don’t see why it wouldn’t work in the build you’re using though.
https://mega.nz/#!OZERyKyJ!kGB14X9F1Qo9GlwQPQQebprkhCOMxFvzquYJduwdd10

Unfortunately it doesn’t look like that is the correct version at all… it is much too small, even when I compared it to the curses version at http://dev.narc.ro/cataclysm/jenkins-latest/Windows_x64/Curses/. Maybe someone else will have more success testing it, but I have stayed up much too late, so I won’t be able to test it.

Some day I might spend some time working out how to compile it on my machine, and work out github. But for now I just report the bugs and suggest fixes. I don’t have time for much else >.>

That’s alright, I’ll put a PR up, seems like it fixes the issue, or at least the failure seems to consume some fat some times, but none other times if I start with a high cooking skill, debug it to zero, fail to craft lard.

But you did say it wasn’t consuming any on failure before, so I guess it works?

Edit:


here