From ddbae5789635a63fcf36a84056f9df4bc8b6adaa Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 5 Mar 2007 08:00:28 +0100 Subject: [PATCH] global key handling in own function --- client.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/client.c b/client.c index 9c228d8..6110445 100644 --- a/client.c +++ b/client.c @@ -21,6 +21,7 @@ #include "netris.h" #include +#include #include #include #include @@ -425,21 +426,28 @@ void OneGame(void) if (!(p = strchr(keyTable, tolower(key)))) return; key = p - keyTable; - // global actions (always possible, even if not playing) + bool handle_key(char key) + { switch (key) { case KT_redraw: clear(); InitFields(); // ScheduleFullRedraw(); refresh(); - return; + return 1; case KT_say: chatMode = 1; Messagetype(key, strlen(chatText) - 1, chatText); - return; + return 1; case KT_quit: - return handle_cmd(CT_quit, NULL); + handle_cmd(CT_quit, NULL); + return 1; + default: + return 0; } + } + // global actions (always possible, even if not playing) + if (handle_key(key)) return; if (Players[me].alive <= 0) return; // actions available while in game -- 2.30.0