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

Fixes player::suffer() for the time change #31430

Merged
merged 2 commits into from
Jun 14, 2019
Merged

Fixes player::suffer() for the time change #31430

merged 2 commits into from
Jun 14, 2019

Conversation

AndrewMcKinney
Copy link
Contributor

Summary

SUMMARY: Infrastructure "Fixes player::suffer() for time change"
fixes #31315

almost all one_in() calls now contain a to_turns() call. This makes the code far more readable and fixes the frequency issues after the time change.

Describe alternatives you've considered

Continuing using magic numbers in the code, but multiplying them by 6.

I also considered adding a modifier in player::suffer() that would scale all of those numbers.

Additional context

none

src/player.cpp Outdated
@@ -5226,7 +5226,7 @@ void player::suffer()
}
}

if( has_trait( trait_SHARKTEETH ) && one_in( 14400 ) ) {
if( has_trait( trait_SHARKTEETH ) && one_in( to_turns<int>( 24_hours ) ) ) { //originaly 14400
Copy link
Member

@anothersimulacrum anothersimulacrum Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment seems unnecessary.

Copy link
Contributor Author

@AndrewMcKinney AndrewMcKinney Jun 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is unnecessary, I had those around so I could see what the original values were. I must have missed one.

@ZhilkinSerg ZhilkinSerg added <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Time / Turns / Duration / Date Issues concerning any activities being too fast or too slow. Also issues about time and date ingame labels Jun 14, 2019
@ZhilkinSerg ZhilkinSerg merged commit d938ca2 into CleverRaven:master Jun 14, 2019
@jbytheway
Copy link
Contributor

Would it be cleaner to have a one_turn_in function that's like one_in but takes a time argument?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Time / Turns / Duration / Date Issues concerning any activities being too fast or too slow. Also issues about time and date ingame
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Genetic Downward Spiral happens too often
5 participants