Skip to content

Commit

Permalink
Fix for Ceiling(). (#5637)
Browse files Browse the repository at this point in the history
# About the pull request

Somebody mentioned seeing incorrect numbers for "you need to play X more
xeno hours to unlock prefix/postfix". Turns out, `time_left_until()` is
defined as `Ceiling(target_time - current time)`, which translates to
`-round( - target_time - current time)`, or in other words,
`round(target_time + current_time)`.
In general, any byond macro involving doing math on the argument should
probably have that argument bracketed every time it appears to avoid
precisely this nonsense.

# Explain why it's good for the game

Is fix.


# Changelog
:cl:
fix: Some cases of calculations for "time remaining until something" no
longer display incorrect results.
/:cl:
  • Loading branch information
Segrain committed Feb 3, 2024
1 parent a086f93 commit 598eacc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/__HELPERS/#maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GLOBAL_LIST_INIT(sqrtTable, list(1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 4,

// MATH DEFINES

#define Ceiling(x) (-round(-x))
#define Ceiling(x) (-round(-(x)))
#define CLAMP01(x) (clamp(x, 0, 1))

// cotangent
Expand Down

0 comments on commit 598eacc

Please sign in to comment.