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
[Bug] Player name has no length limit #2124
Comments
For info: Original game only allowed 8 characters. |
Can confirm now. |
I'm not exactly sure why this bug happens. The actual check made works properly but the keypress is still registered and added to the textbox. |
This is an age-old problem when dealing with variable-width fonts. The biggest problem comes from the extremes such as "WWWWWWWW" (8 characters) or "iiiiiiiiiiiiiiiiiiiiiiiii" (25 characters) that take up roughly the same width in fonts used by the game. Both actually fit very neatly into the status and end-of-year dialogues. This means that there are a few options, which all have their own drawbacks:
Or, if we're able to calculate the width of a string before painting it:
This is mainly just food for thought on a low priority issue. |
I actually think we have have some code somewhere that already checks the pixel length of a line, for text-wrapping. |
We do yes, though I can't say it's an intuitive approach. Regardless of what we do with the dialog we'll have config.txt files that violate the length limit. Regardless of the limit we pick here for entry we should work on hiding overflow. That's particularly necessary because the user can pick their own fonts and change them at any time. |
Describe the issue
Names that are too long are accepted and used
Steps to Reproduce
In the New Game screen enter a long name (over 15 characters)
Start game
Look at name, eg Progress Report. The name isn't clipped and may continue beyond the space for it.
Expected Behavior
It's refused, or clipped.
System Information
3e7b389 current master
Additional Info
CorsixTH/CorsixTH/Lua/dialogs/resizables/new_game.lua
Lines 117 to 118 in dfa5af9
CorsixTH/CorsixTH/Lua/window.lua
Line 1027 in 81db333
The text was updated successfully, but these errors were encountered: