git.shiar.nl
/
netris.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f281a88
)
global key handling in own function
author
Mischa POSLAWSKY
<netris@shiar.org>
Mon, 5 Mar 2007 07:00:28 +0000
(08:00 +0100)
committer
Mischa POSLAWSKY
<netris@shiar.org>
Mon, 5 Mar 2007 07:00:28 +0000
(08:00 +0100)
client.c
patch
|
blob
|
history
diff --git
a/client.c
b/client.c
index 9c228d857d4a756c4944689ca7b7fd420be88a51..61104458425e2bf52dccd79fc936f6f49d1ff0d0 100644
(file)
--- a/
client.c
+++ b/
client.c
@@
-21,6
+21,7
@@
#include "netris.h"
#include <stdlib.h>
#include "netris.h"
#include <stdlib.h>
+#include <stdbool.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
@@
-425,21
+426,28
@@
void OneGame(void)
if (!(p = strchr(keyTable, tolower(key)))) return;
key = p - keyTable;
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();
switch (key) {
case KT_redraw:
clear();
InitFields();
// ScheduleFullRedraw();
refresh();
- return;
+ return
1
;
case KT_say:
chatMode = 1;
Messagetype(key, strlen(chatText) - 1, chatText);
case KT_say:
chatMode = 1;
Messagetype(key, strlen(chatText) - 1, chatText);
- return;
+ return
1
;
case KT_quit:
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
if (Players[me].alive <= 0) return;
// actions available while in game