{ "level", 1, 0, 'l' },
{ "nick", 1, 0, 'n' },
{ "team", 1, 0, 't' },
- { "dropmode", 2, 0, 'd' },
{ "color", 2, 0, 'C' },
{ "slowterm", 2, 0, 'S' },
{ "keys", 1, 0, 'k' },
" -t, --team <team>\tJoin a team (don't receive lines from your teammates)\n"
" -l, --level <lvl>\tBegin at a higher level (can be used as handicap)\n"
" -k, --keys <keys>\tRemap keys (default is \"%s\" for cursors)\n"
- " -d, --dropmode\tDrops go into drop mode\n"
- " -D, --instadrop\tInstant drop\n"
"\n"
" -r, --robot <cmd>\tExecute program to control the game instead of keyboard\n"
" -F, --fair-robot\tUse fair robot interface\n"
case 't': //team
Players[0].team = atoi(value);
break;
- case 'd': //dropmode
- Sets.dropmode = value ? atoi(value) : 1;
- break;
case 'C': //color
Sets.color = value && strcasecmp(value, "0") ? 1 : 0;
break;
void OneGame(void)
{
- int changed = 0;
+ bool changed = 0;
short gameStatus = 2; //2=loop; 1=new piece; 0=quit
- int chatMode = 0;
+ bool chatMode = 0;
char chatText[MSG_WIDTH] = "\0";
void handle_cmd(char cmd, char *arg)
if (!(p = strchr(keyTable, tolower(key)))) return;
key = p - keyTable;
- bool handle_key(char key)
+ void handle_keycmd(char key)
{
switch (key) {
case KT_redraw:
InitFields();
// ScheduleFullRedraw();
refresh();
- return 1;
+ return;
case KT_say:
chatMode = 1;
Messagetype(key, strlen(chatText) - 1, chatText);
- return 1;
+ return;
case KT_quit:
handle_cmd(CT_quit, NULL);
- return 1;
+ return;
case KT_pause:
handle_cmd(CT_pause, NULL);
- return 1;
- default:
- return 0;
+ return;
}
- }
- // global actions (always possible, even if not playing)
- if (handle_key(key)) return;
if (Players[me].alive <= 0 || paused) return;
// actions only available while actually playing
changed = 1;
break;
}
- return;
+ }
+ handle_keycmd(key);
} //GameKey
int oldPaused = 0;
strncpy(Players[0].name, userName, 16); //sizeof(Player.name)
Players[0].name[16] = 0;
Players[0].alive = 1;
- Players[0].dropmode = 0;
} //set defaults
// if (getopt(argc, argv, "f:") == 'f')
// else
ReadConf(CONFIG_FILE);
while ((ch = getopt_long(
- argc, argv, "hHRk:c:n:odDSCap:i:l:t:", options, NULL
+ argc, argv, "hHRk:c:n:oSCap:i:l:t:", options, NULL
)) != -1)
HandleOption(ch, optarg);
if (optind < argc) {