Make ESC key stop trying to sleep #37716
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
SUMMARY: Interface "Make ESC key stop trying to sleep"
Purpose of change
To make the behavior of the Escape key in the "You have trouble sleeping" menu more consistent with other popup menus for actions.
In most other popup prompts in the game, pressing ESC cancels whatever was being attempted, and generally prevents any further actions or time passing. Unlike these, the "You have trouble sleeping" prompt would continue trying to sleep and cause more time to pass when ESC was pressed.
Describe the solution
One line is added to the
case
statement for this menu, causing aUILIST_CANCEL
result to be caught along with case1
("S"), instead of falling through the end with case2
("c") and causing the sleep attempt to be repeated.Describe alternatives you've considered
I considered also adding some indicator to the menu about what ESC would do, but I don't see that in any other menus.
Testing
Loaded a debugging world, tried to sleep several times while not sleepy, and ensured that ESC canceled the action as expected. Other keypresses continue to work as expected.
Additional context
This has bothered me since I first started playing Cataclysm and it was about time I did something about it. I doubt I am the only one surprised / annoyed by it.
This screenshot shows the affected menu and how the behavior changed: