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
Conversation
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use std::min( 5, diff_freeze )
for this and std::max( 1, diff_freeze )
above. The same for diff_cold
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better performance wise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I don't know. For me it's just more clear and readable. Need consulting from more competent guys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be better performance wise?
It won't be more slow, but much more readable.
src/item.cpp
Outdated
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>." ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still an error. Here's a suggestion:
(...), and it will become mushy after thawing out.
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 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just noticed that in a compiler, sorry
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 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right and fix is included in PR #24971 waiting to be merged.
Resolves #24875 (this was solved only partially)
Resolves #24893
Resolves #24898
This patch solves few problems:
There might be more tweaks in this topic, but removing bugs gets priority over that.