Cataclysm-dda: Clean water is frozen when crafted.

Created on 21 May 2020  路  9Comments  路  Source: CleverRaven/Cataclysm-DDA

When crafting:
image

After putting inside container:
image

<Bug> Containers Temperature

Most helpful comment

This was a winter start game.

All 9 comments

This was a winter start game.

I noticed this in a basement but it was also a winter start.
But still I thought the basement was warm ennough not to freeze.

I also noticed that when filling water from a mini lake you get frozen water inside your container. Realistically it should take more than 1 second to freeze 60L of cold water.

image

The cause is same but separate.

Liquid item is created, for some reason it does not get its temperature set, and is then placed in container.

Another liquid item is created, again for some reason it does not get its temperature set, and is placed in the same container.

The combined temperature of the two liquids in same container are calculated from bad values resulting in nonsense temperatures.

At quick glance I don't see why the temperature is not set. The temperature setting part is still there.

The same no temperature being set probably happens in almost all instances where new items are created but it is only noticeable with liquids due to how their temperatures are combined in containers. For all other items the invalid temperature is overwritten immediately on next turn and the item is set to enviroment temperature.

So for the liquid from lakes:

iexamine::water_source calls map::water_from and a water item is created without temperature. After way too many calls to character, inventory and container code that I don't even try to follow fully this water without temperature gets in to inventory and causes problems.

So setting the temperature of this water would fix it? Nope.

Because the water that is added to the container is actually different water item.

In activity_handlers::fill_liquid_do_turn a water item is created with the right temperature.

But that isn't the water item that is added to the container either.

Then a chain of inventory code is called.
In this chain Character::pour_into calls item::fill_with. But instead of passing the item along it passes the item type(?) and a new item is created from it in here: https://github.com/CleverRaven/Cataclysm-DDA/blob/7545a5a3aede579a0092e887cb83a4d30de30fe8/src/item.cpp#L8221 This new item does not have temperature at all and causes problems (at least I think the problem this in here).

Here is partial fix: https://github.com/Hirmuolio/Cataclysm-DDA/pull/64/files
In it the created items get their missing temperatures and the debug message that warns about this being wrong has been added back in.

I don't know why a new item is created to be placed in the player inventory or how to fix that. @KorGgenT probably knows these parts better.

I think the right approach is to use std::shared_ptr and pass that along, instead of copying whole objects and recreating stuff on the fly. It would also use less memory. But I am not familiar with Cataclysm code base yet.

On the latest experimental, as you can see from my closed report, there is no "consume it" option since the liquid spawns as frozen

thought it could be a useful detail

I observe the same problem when making hot chocolate, and right after You pour hot chocolate (fresh) (hot) into the plastic bottle. it's frozen solid.

This issue has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/cooked-food-insta-freezing/24121/12

Was this page helpful?
0 / 5 - 0 ratings