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
Setting resolution really small in openttd.cfg crashes the game #8869
Comments
This may be related to #6220, which was closed because of inactivity.
Edit: I was able to reproduce this on Windows. A similar crash occurs if OpenTTD is started with the vertical resolution being 12 pixels or less (13 pixels and up is safe, horizontal resolution does not matter, and a 0 in either axis resets to default) |
Nope; they are not really relevant here. The backtrace is all that is important. And a
Nope, this is properly clamped. It is only a problem with the config.
Ironically, and this is often a misconception, running with Additionally, 1.9 does not crash. So I guess this is a nice regression :) |
Likely cause, according to the backtrace: Line 2127 in fe451b8
This calls function Clamp(a, min, max) , which has the following assertion that gets triggered:OpenTTD/src/core/math_func.hpp Line 79 in 9b800a9
The assertion is triggered because Clamp is called with a min of 0 and a max of _screen.height - MIN_VISIBLE_TITLE_BAR , where _screen.height is 12 or less. MIN_VISIBLE_TITLE_BAR is 13 as per the following line, which makes max negative, and thus triggers the assertion because 0 can never be less than or equal to a negative number.Line 2058 in fe451b8
|
Nice analysis! I can think off two solutions:
I was sure we did 2), but clearly we do not :D Possibly there are other solutions. |
The game UI is designed for a minimum resolution of 640x480 so I think it would be appropriate to clamp the settings to that on load. |
Version of OpenTTD
1.11.0-RC1
Expected result
No crash, even if a user is being silly.
Actual result
Crash.
Steps to reproduce
In your config, set:
resolution = 1,1
Start the game
Enjoy the crash!
Backtrace
The text was updated successfully, but these errors were encountered: