src/main.c

changeset 26
e0a76ee1bb2b
parent 23
824c9522ce66
child 29
c6a1ad6cf749
--- a/src/main.c	Tue Apr 01 12:30:25 2014 +0200
+++ b/src/main.c	Tue Apr 01 14:04:00 2014 +0200
@@ -40,7 +40,7 @@
     uint8_t timeunit = 60;
     size_t len;
     
-    for (char opt ; (opt = getopt(argc, argv, "a:bhp:rt:")) != -1 ;) {
+    for (char opt ; (opt = getopt(argc, argv, "a:bhp:rst:")) != -1 ;) {
         switch (opt) {
         case 'b':
             settings->gameinfo.servercolor = BLACK;
@@ -48,6 +48,9 @@
         case 'r':
             settings->gameinfo.servercolor = rand() & 1 ? WHITE : BLACK;
             break;
+        case 's':
+            settings->singlemachine = 1;
+            break;
         case 't':
         case 'a':
             len = strlen(optarg);
@@ -150,10 +153,9 @@
             "  -a <time>     Specifies the time to add after each move\n"
             "  -b            Server plays black pieces (default: white)\n"
             "  -r            Distribute color randomly\n"
+            "  -s            Single machine mode\n"
             "  -t <time>     Specifies time limit (default: no limit)\n"
             "\nNotes\n"
-            "White pieces are displayed as uppercase and black pieces as "
-            "lowercase letters.\n"
             "The time unit for -a is seconds and for -t minutes by default. To "
             "specify\nseconds for the -t option, use the s suffix.\n"
             "Example: -t 150s\n"
@@ -173,6 +175,11 @@
     }
     atexit(leavescr);
     
-    return is_server(&settings) ? server_run(&settings) : client_run(&settings);
+    if (settings.singlemachine) {
+        game_start_singlemachine(&settings);
+    } else {
+        return is_server(&settings) ?
+            server_run(&settings) : client_run(&settings);
+    }
 }
 

mercurial