add option that disables board flip in solo games

Sat, 28 Mar 2026 14:01:14 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 28 Mar 2026 14:01:14 +0100
changeset 90
395542d915d7
parent 89
58b788fd10a7
child 91
c7b586c0ee36

add option that disables board flip in solo games

resolves #812

src/game.c file | annotate | diff | comparison | revisions
src/game.h file | annotate | diff | comparison | revisions
src/main.c file | annotate | diff | comparison | revisions
--- a/src/game.c	Sat Mar 28 12:57:05 2026 +0100
+++ b/src/game.c	Sat Mar 28 14:01:14 2026 +0100
@@ -529,7 +529,8 @@
     bool running;
     do {
         clear();
-        draw_board(&gamestate, curcol, settings->unicode);
+        uint8_t perspective = settings->disableflip ? WHITE : curcol;
+        draw_board(&gamestate, perspective, settings->unicode);
         running = !domove_singlemachine(&gamestate,
             &(settings->gameinfo), curcol);
         curcol = opponent_color(curcol);
--- a/src/game.h	Sat Mar 28 12:57:05 2026 +0100
+++ b/src/game.h	Sat Mar 28 14:01:14 2026 +0100
@@ -43,6 +43,7 @@
     char* serverhost; /* NULL, if we are about to start a server */
     char* continuepgn;
     bool singlemachine;
+    bool disableflip;
     bool unicode;
 } Settings;
 
--- a/src/main.c	Sat Mar 28 12:57:05 2026 +0100
+++ b/src/main.c	Sat Mar 28 14:01:14 2026 +0100
@@ -44,7 +44,7 @@
     uint8_t timeunit = 60;
     size_t len;
     
-    for (int opt ; (opt = getopt(argc, argv, "a:bc:hp:rsS:t:Uv")) != -1 ;) {
+    for (int opt ; (opt = getopt(argc, argv, "a:bc:Fhp:rsS:t:Uv")) != -1 ;) {
         switch (opt) {
         case 'c':
             settings->continuepgn = optarg;
@@ -56,10 +56,13 @@
             settings->gameinfo.servercolor = rand() & 1 ? WHITE : BLACK;
             break;
         case 's':
-            settings->singlemachine = 1;
+            settings->singlemachine = true;
+            break;
+        case 'F':
+            settings->disableflip = true;
             break;
         case 'U':
-            settings->unicode = 0;
+            settings->unicode = false;
             break;
         case 't':
         case 'a':
@@ -114,8 +117,10 @@
 "  -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"
+"\nHot seat\n"
+"  -s            Play a hot seat game (no client/server)\n"
+"  -F            Do not automatically flip the board in hot seat games\n"
 "\nNotes\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"

mercurial