summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
788e035)
Replace direct actions by key.
static char keyTable[KT_numKeys+1];
enum {
static char keyTable[KT_numKeys+1];
enum {
CT_MAX
};
static char *cmds[] = {
CT_MAX
};
static char *cmds[] = {
void handle_cmd(char cmd, char *arg)
{
switch (cmd) {
void handle_cmd(char cmd, char *arg)
{
switch (cmd) {
+ case CT_quit:
+ ShowPause(me);
+ refresh();
+ gameStatus = 0;
+ return;
+ case CT_pause:
+ Players[me].flags ^= SCF_paused;
+ if (Game.started > 1)
+ Message(Players[me].flags & SCF_paused
+ ? "You paused the game" : "You unpaused the game");
+ else
+ Message(Players[me].flags & SCF_paused
+ ? "You are not ready" : "You are ready");
+ checkPaused();
+ if (game == GT_classicTwo)
+ SendPacket(me, NP_pause, 0, NULL);
+ ShowPause(me);
+ changed = 1;
+ return;
Messagetype(key, strlen(chatText) - 1, chatText);
return;
case KT_quit:
Messagetype(key, strlen(chatText) - 1, chatText);
return;
case KT_quit:
- ShowPause(me);
- refresh();
- gameStatus = 0;
- return;
+ return handle_cmd(CT_quit, NULL);
}
if (Players[me].alive <= 0) return;
// actions available while in game
switch (key) {
case KT_pause:
}
if (Players[me].alive <= 0) return;
// actions available while in game
switch (key) {
case KT_pause:
- Players[me].flags ^= SCF_paused;
- if (Game.started > 1)
- Message(Players[me].flags & SCF_paused
- ? "You paused the game" : "You unpaused the game");
- else
- Message(Players[me].flags & SCF_paused
- ? "You are not ready" : "You are ready");
- checkPaused();
- if (game == GT_classicTwo)
- SendPacket(me, NP_pause, 0, NULL);
- ShowPause(me);
- changed = 1;
- return;
+ return handle_cmd(CT_pause, NULL);