In this particular case that solution is not a good idea. Since the different return values depend on what the user does. The four return values are: "pressed enter", "pressed escape", "edit box does not have focus" and "default" (edit box has focus and user pressed any other key than enter and escape). So having OpenTTD assert on some user behaviour is not a good idea. (But thanks for pointing the method/solution out.)Roujin wrote:If the other two values should actually never occur in those statements, "default: NOT_REACHED();" is a better way to go.Zuu wrote:The first two blocks I guess is because I've exchanged constant values {0, 1, 2} with an enum since I introduce a fourth value. Adding "default: break;" to those switch-case statements could probably silence the warnings.
[...]
planetmaker:
Looks like you've used default: NOT_REACHED(); in your fix. Try pressing any other key than enter and escape when you have the edit box of the sign list window in focus. That should yeild return value "default" which would assert your fix.
Through I see that I have forgot to replace 1,2 with HEBR_ENTER and HEBR_ESCAPE in the OnKeyPress of that window in the Filter Sign List patch.