Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upAdjust recalc_hp to avoid migrating hp levels #28692
Conversation
kevingranade
force-pushed the
kevingranade-fix-sts-instant-death
branch
from
05a9345
to
afae3ff
Mar 14, 2019
KorGgenT
added
[C++]
<Bugfix>
labels
Mar 14, 2019
Rivet-the-Zombie
merged commit 5b6a055
into
master
Mar 14, 2019
This comment has been minimized.
This comment has been minimized.
|
This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there: |
ZhilkinSerg
deleted the
kevingranade-fix-sts-instant-death
branch
Mar 20, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
kevingranade commentedMar 14, 2019
Looks like cumulative rounding errors in recalc_hp were causing characters using the new JSON-based STS to suddenly die.
Summary
SUMMARY: NonePurpose of change
Fixes #28680
It seems there was a latent rounding error in Character::recalc_hp(), but it was never triggered before because it was only called on character creation.
Describe the solution
Most importantly, this avoids updating hp levels if the max hp has not changed, this should prevent the bug on it's own.
Additionally, I changed the interpolation of current HP to be a bit more generous, taking the ceiling of the interpolated value instead of the (implicit) floor. In order to prevent out-of range HP values, I also clamped the value between 1 and the new max HP.
Describe alternatives you've considered
Remove STS because it's terrible.
Additional context
Introduced by #28637