DLAY temp changing

  • Synergy
    26th Mar 2015 Member 0 Permalink

    So I just noticed that the DLAY tmp on something I was making changed. At first they changed from say 120 to 119.85. And then it changed to 119. Took me ages to figure out why my decoder stopped working suddenly...

     

    Is this normal? And does disabling heat simulation prevent this?

  • jacob1
    26th Mar 2015 Developer 0 Permalink
    I tried making DLAY with a temp (and tmp) of 120, after saving it as a stamp and quitting TPT, it was still exactly 120C. Although 1200C did decrease to 1199.85C.

    I'd say that is definitely a bug. Electronics rely on values being exact and this makes the delay decrease by one when resaved.

    So hmm ... either it can be fixed by adding .15f to (high) temperatures when loading, or adding in a check to DLAY which accounts for the .15f temperature loss.

    Also no, turning off heat sim wouldn't fix it. It is just a property of how saves are saved.
    Edited once by jacob1. Last: 26th Mar 2015
  • Synergy
    27th Mar 2015 Member 0 Permalink

    It's strange because all of the other DLAYs that change to xxx.85 remain like that. None of them change all the way to .00. Only this one damn piece of DLAY at 148.

     

    I will pm you the save. There is one piece of DLAY in particular that keeps changing from 148 to 147. As said, it will go from 148 to 147.85 and then after a day or two, I open the save and it's suddenly 147. I forgot about it, and this thread, until it tricked me again today, and I spend 20 minutes looking for the bug. 

     

    In the save, the DLAY I am talking about is in the very bottom right corner. There is a line of DLAY ranging from temp 4 to about 200. 

    Edited once by Synergy. Last: 27th Mar 2015
  • jacob1
    27th Mar 2015 Developer 0 Permalink
    Interesting ... here is the part of the code causing this bug: https://github.com/simtr/The-Powder-Toy/blob/master/src/client/GameSave.cpp#L1889-L1902

    Basically if the temperature is >= 21C and < 148C it saves it in a format that takes 1 byte (these temperatures always load as .0), else it saves it in a format that takes 2 bytes (these temperatures always load as .85). The 1 byte format is used for 147C to 148C, which when loaded loads as 147C. The two byte format is used for 148C to 148.85C, which when loaded loads as 147.85C.

    So by resaving twice it goes from 148C -> 147.85C -> 147C.

    Perhaps if you set it to 148.85C it will work properly? If not, there isn't any way to save DLAY with a temperature of 148 due to this bug.
    Edited 2 times by jacob1. Last: 27th Mar 2015
  • Synergy
    27th Mar 2015 Member 0 Permalink

    I will try this. If it doesn't work, hopefully I can get an extra frame from semiconductors. If I can't I am screwed lol. Should be alright though, now that I think about it. Thanks for the help :)