Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for freezing bugs - part 2 #24905

Merged
merged 8 commits into from Aug 17, 2018

Conversation

Projects
None yet
6 participants
@nexusmrsep
Copy link
Contributor

commented Aug 17, 2018

Resolves #24875 (this was solved only partially)
Resolves #24893
Resolves #24898

This patch solves few problems:

  1. As play-testing by @chaosvolt showed, previous patch #24880 removed only a part of the problem of multiple opposite flags. This patch removes the second part of the problem, and my play-testing showed that flags don't multiply when heating frozen food or crafting hot food.
  2. As @jakub-niscior noticed in #24893, liquids in containers couldn't be reheated for use. This PR solves this problem.
  3. As @Xhuis noticed in #24898, MUSHY and No_FROST flag feedback needed some clarification and spelling errors removal.
  4. I'm still not entirely satisfied with the speed of cooling/freezing. For now I have done two things to bring it towards sane values.
  • One is adding (cold) state to all food not only to those that have EATEN_COLD flag. This new (cold) state activates before freezing, so its equal to more time before food realy starts to freeze. Flags now go HOT-->COLD-->FROZEN. If item is not HOT, it goes from normal to COLD then to FROZEN. From FROZEN in above freezing temperatures items go to COLD, and in low temperature (between freezing and refrigerator temperature) it will stay COLD, and above that it will get back to normal.
  • Second is lowering temperature difference influence on cooling quickness and increasing temperature of defrosted food.
    There might be more tweaks in this topic, but removing bugs gets priority over that.
  1. Fixes activation of non-food comestibles (bandages, meds) on spawn. This should prevent suffix (active) from being added. It might not prevent existing (active) meds, and deactivating them via code would endanger further implementation of active meds. Rotation of items in game should fix that eventually.

nexusmrsep added some commits Aug 17, 2018

@stk2008

This comment has been minimized.

Copy link

commented Aug 17, 2018

Yes thank you cant wait for merge :0

src/map.cpp Outdated
@@ -4580,11 +4580,11 @@ void map::apply_in_fridge( item &it, int temp )
{
unsigned int diff_freeze = abs(temp - FREEZING_TEMPERATURE);
diff_freeze = diff_freeze < 1 ? 1 : diff_freeze;
diff_freeze = diff_freeze > 10 ? 10 : diff_freeze;
diff_freeze = diff_freeze > 5 ? 5 : diff_freeze;

This comment has been minimized.

Copy link
@Night-Pryanik

Night-Pryanik Aug 17, 2018

Member

You can use std::min( 5, diff_freeze ) for this and std::max( 1, diff_freeze ) above. The same for diff_cold below.

This comment has been minimized.

Copy link
@nexusmrsep

nexusmrsep Aug 17, 2018

Author Contributor

would it be better performance wise?

This comment has been minimized.

Copy link
@Night-Pryanik

Night-Pryanik Aug 17, 2018

Member

Honestly, I don't know. For me it's just more clear and readable. Need consulting from more competent guys.

This comment has been minimized.

Copy link
@ZhilkinSerg

ZhilkinSerg Aug 17, 2018

Contributor

would it be better performance wise?

It won't be more slow, but much more readable.

if( food_item->has_flag( "NO_FREEZE" ) && !food_item->rotten() ) {
info.emplace_back( "DESCRIPTION", _( "* Quality of this food suffers when it's <neutral>frozen.</neutral>." ) );
if( food_item->has_flag( "NO_FREEZE" ) && !food_item->rotten() && !food_item->has_flag( "MUSHY" ) ) {
info.emplace_back( "DESCRIPTION", _( "* Quality of this food suffers when it's <neutral>frozen, and it becames mushy after defrosting</neutral>." ) );

This comment has been minimized.

Copy link
@Xhuis

Xhuis Aug 17, 2018

Contributor

This is still an error. Here's a suggestion:
(...), and it will become mushy after thawing out.

nexusmrsep added some commits Aug 17, 2018

src/map.cpp Outdated
@@ -4579,12 +4579,12 @@ void map::make_active( item_location &loc )
void map::apply_in_fridge( item &it, int temp )
{
unsigned int diff_freeze = abs(temp - FREEZING_TEMPERATURE);
diff_freeze = diff_freeze < 1 ? 1 : diff_freeze;
diff_freeze = diff_freeze > 5 ? 5 : diff_freeze;
diff_freeze = std::max( 1, diff_freeze );

This comment has been minimized.

Copy link
@ZhilkinSerg

ZhilkinSerg Aug 17, 2018

Contributor

You can't put int and unsigned int together.

image

This comment has been minimized.

Copy link
@nexusmrsep

nexusmrsep Aug 17, 2018

Author Contributor

just noticed that in a compiler, sorry

@ZhilkinSerg ZhilkinSerg merged commit b8ef478 into CleverRaven:master Aug 17, 2018

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
gorgon-ghprb Build finished.
Details

@nexusmrsep nexusmrsep deleted the nexusmrsep:temp_fix_no_2 branch Aug 18, 2018

diff_cold = diff_cold < 1 ? 1 : diff_cold;
diff_cold = diff_cold > 10 ? 10 : diff_cold;
diff_freeze = std::max( static_cast<unsigned int>(1), diff_cold );
diff_freeze = std::min( static_cast<unsigned int>(5), diff_cold );

This comment has been minimized.

Copy link
@Brambor

Brambor Aug 19, 2018

Contributor

Sorry for bothering. These two lines seems wierd as the above one keeps diff_cold and those two change to diff_freeze. I'm writing this just so that it can be double-checked.

This comment has been minimized.

Copy link
@nexusmrsep

nexusmrsep Aug 19, 2018

Author Contributor

You are right and fix is included in PR #24971 waiting to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.