From 9047c3e4ad3e70ae1ecda0377200c0522d8ad29c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 2 Feb 2013 15:22:09 +0900 Subject: [PATCH] Fix the invalid keydest errors. Once and for all: remove the default and move the Sys_Error outside the switch (changing appropriate breaks to returns). Now gcc will let me know when I forget to update the switch statements. --- libs/console/client.c | 8 ++++++-- libs/video/targets/keys.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/console/client.c b/libs/console/client.c index bd2fc4b29..f31ccada9 100644 --- a/libs/console/client.c +++ b/libs/console/client.c @@ -474,11 +474,15 @@ C_KeyEvent (knum_t key, short unicode, qboolean down) return; } case key_game: + case key_demo: Menu_Enter (); return; - default: - Sys_Error ("Bad con_keydest"); + case key_unfocused: + return; + case key_last: + break; // should not happen, so hit error } + Sys_Error ("Bad con_keydest"); } else if (key == key_toggleconsole) { ToggleConsole_f (); return; diff --git a/libs/video/targets/keys.c b/libs/video/targets/keys.c index e84f4a954..9adf25c4e 100644 --- a/libs/video/targets/keys.c +++ b/libs/video/targets/keys.c @@ -1149,16 +1149,20 @@ Key_Event (knum_t key, short unicode, qboolean down) // if not a consolekey, send to the interpreter no matter what mode is switch (key_dest) { case key_game: + case key_demo: Key_Game (key, unicode); - break; + return; case key_message: case key_menu: case key_console: Key_Console (key, unicode); - break; - default: - Sys_Error ("Bad key_dest"); + return; + case key_unfocused: + return; + case key_last: + break; // should not happen, so hit the error } + Sys_Error ("Bad key_dest"); } VISIBLE void