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.
This commit is contained in:
Bill Currie 2013-02-02 15:22:09 +09:00
parent bc12567572
commit 9047c3e4ad
2 changed files with 14 additions and 6 deletions

View file

@ -474,11 +474,15 @@ C_KeyEvent (knum_t key, short unicode, qboolean down)
return; return;
} }
case key_game: case key_game:
case key_demo:
Menu_Enter (); Menu_Enter ();
return; return;
default: case key_unfocused:
Sys_Error ("Bad con_keydest"); return;
case key_last:
break; // should not happen, so hit error
} }
Sys_Error ("Bad con_keydest");
} else if (key == key_toggleconsole) { } else if (key == key_toggleconsole) {
ToggleConsole_f (); ToggleConsole_f ();
return; return;

View file

@ -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 // if not a consolekey, send to the interpreter no matter what mode is
switch (key_dest) { switch (key_dest) {
case key_game: case key_game:
case key_demo:
Key_Game (key, unicode); Key_Game (key, unicode);
break; return;
case key_message: case key_message:
case key_menu: case key_menu:
case key_console: case key_console:
Key_Console (key, unicode); Key_Console (key, unicode);
break; return;
default: case key_unfocused:
Sys_Error ("Bad key_dest"); return;
case key_last:
break; // should not happen, so hit the error
} }
Sys_Error ("Bad key_dest");
} }
VISIBLE void VISIBLE void