#include "netris.h"
#include <stdlib.h>
+#include <stdbool.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
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