ID:2518448
 
Resolved
clamp() didn't compile correctly with constant values.
BYOND Version:513.1492
Operating System:Linux
Web Browser:Chrome 78.0.3904.70
Applies to:Dream Maker
Status: Resolved (513.1493)

This issue has been resolved.
Descriptive Problem Summary:
If all three arguments to clamp() are constants, the server hits an illegal operation at runtime.

Numbered Steps to Reproduce Problem:
1. Call clamp() with all three arguments as constants (either literals or const vars)

Code Snippet (if applicable) to Reproduce Problem:
/world/New()
world.log << clamp(1, 2, 3)


Expected Results:
In the above case, 2

Actual Results:
BUG: Crashing due to an illegal operation!

Does the problem occur:
Every time? Or how often?
Every time.

When does the problem NOT occur?
When at least one of the args is not a constant.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Not tested, but it presumably has done this since clamp() was added.

Workarounds:
Don't do this. It's not useful anyway, since you could just replace it with the number you want.
Lummox JR resolved issue with message:
clamp() didn't compile correctly with constant values.