EditBoard: restructure loop for consistency.
authorYann Dirson <ydirson@free.fr>
Sat, 15 Feb 2014 22:03:27 +0000 (23:03 +0100)
committerYann Dirson <ydirson@free.fr>
Sun, 16 Feb 2014 15:07:38 +0000 (16:07 +0100)
gnushogi/cursesdsp.c
gnushogi/rawdsp.c

index 21a061b..213c008 100644 (file)
@@ -476,7 +476,7 @@ Curses_EditBoard(void)
     printw("Enter piece & location: ");
     a = black;
 
-    do
+    while(1)
     {
         gotoXY(TAB, 6);
         printw("Editing: %s", ColorStr[a]);
@@ -485,6 +485,9 @@ Curses_EditBoard(void)
         FLUSH_SCANW("%s", s);
         found = 0;
 
+        if (s[0] == '.')
+            break;
+
         if (s[0] == '#')
         {
             for (sq = 0; sq < NO_SQUARES; sq++)
@@ -549,7 +552,6 @@ Curses_EditBoard(void)
             DrawPiece(sq);
         }
     }
-    while (s[0] != '.');
 
     for (sq = 0; sq < NO_SQUARES; sq++)
         Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);
index d4ac301..287e578 100644 (file)
@@ -349,11 +349,14 @@ Raw_EditBoard(void)
 
     a = black;
 
-    do
+    while(1)
     {
         scanf("%s", s);
         found = 0;
 
+        if (s[0] == '.')
+            break;
+
         if (s[0] == '#')
         {
             for (sq = 0; sq < NO_SQUARES; sq++)
@@ -413,7 +416,6 @@ Raw_EditBoard(void)
                 color[sq] = neutral;
         }
     }
-    while (s[0] != '.');
 
     for (sq = 0; sq < NO_SQUARES; sq++)
         Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);