use boolean type where appropriate
[netris.git] / client.c
index 788684cf0282be3be353b3c9dc90adc0d025907c..98b9542719c67ccc89796eec14e62935ffc7fac3 100644 (file)
--- a/client.c
+++ b/client.c
@@ -41,7 +41,6 @@ static struct option options[] = {
        { "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' },
@@ -134,8 +133,6 @@ void Usage(void)
                "  -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"
@@ -170,9 +167,6 @@ void HandleOption(char tag, char *value)
        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;
@@ -331,9 +325,9 @@ void CheckClears(int scr)
 
 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)
@@ -426,7 +420,7 @@ void OneGame(void)
                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:
@@ -434,23 +428,18 @@ void OneGame(void)
                        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
@@ -499,7 +488,8 @@ void OneGame(void)
                        changed = 1;
                        break;
                }
-               return;
+       }
+               handle_keycmd(key);
        } //GameKey
 
        int oldPaused = 0;
@@ -805,7 +795,6 @@ int main(int argc, char **argv)
                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')
@@ -813,7 +802,7 @@ int main(int argc, char **argv)
 //     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) {