math_parser/eoc: migrate arith. weather to math #65298
Merged
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.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
Port another
arithmetic
function tomath
.weather
was used recently for #64954 and it's a small enough target.Describe the solution
Move the code from
arithmetic
tomath
.Use Kelvin for temperature to match internal representation.
Add temperature conversion functions.
Fix the calculations and conditions for fog/mist: ported from EOC to
jmath_function
. Added reference for the formula we used and re-converted it to Celsius. Fixed the conditions for mist to better match reality.Describe alternatives you've considered
Continuing to use Fahrenheit: Temperature is internally already Kelvin so it makes more sense to expose it to EOCs in the same unit. Weather aspects use a mixed bag of undocumented metric and non-metric units atm and I'd rather port them all to SI if possible.
Testing
Existing test unit.
Both mist and fog still occur in game. Mist/fog no longer occur by default on a fresh game simply because
dew_point_factor
hasn't been calculated yet.Additional context
I promised I'd do this for #64954 but I got sidetracked IRL. Better late than never though.