Fix sending of S-Chess gating moves to ICS
[xboard.git] / xboard.c
index 0424641..ecf421c 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -1686,7 +1686,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     int i;
     static Dimension oldWidth, oldHeight;
     static VariantClass oldVariant;
-    static int oldDual = -1;
+    static int oldDual = -1, oldMono = -1;
 
     if(!formWidget) return;
 
@@ -1765,7 +1765,7 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
     // [HGM] pieces: tailor piece bitmaps to needs of specific variant
     // (only for xpm)
 
-    if(gameInfo.variant == oldVariant) return; // and only if variant changed
+  if(gameInfo.variant != oldVariant) { // and only if variant changed
 
     if(useImages) {
       for(i=0; i<4; i++) {
@@ -1833,9 +1833,12 @@ void InitDrawingSizes(BoardSize boardSize, int flags)
        }
       }
     }
+  }
 #if HAVE_LIBXPM
+  if(appData.monoMode == oldMono)
     CreateAnimVars();
 #endif
+  oldMono = appData.monoMode;
 }
 #endif
 
@@ -1943,7 +1946,7 @@ CreateAnyPieces()
 #if HAVE_LIBXPM
     if (appData.monoMode && // [HGM] no sense to go on to certain doom
        (appData.bitmapDirectory == NULL || appData.bitmapDirectory[0] == NULLCHAR))
-           appData.bitmapDirectory = DEF_BITMAP_DIR;
+           appData.bitmapDirectory = strdup(DEF_BITMAP_DIR);
 
     if (appData.bitmapDirectory[0] != NULLCHAR) {
       CreatePieces();
@@ -4639,6 +4642,12 @@ void DrawSquare(row, column, piece, do_flash)
        }
     }
     if(!partnerUp && marker[row][column]) {
+       if(appData.monoMode) {
+           XFillArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? darkSquareGC : lightSquareGC,
+                   x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
+           XDrawArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? lightSquareGC : darkSquareGC,
+                   x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
+       } else
        XFillArc(xDisplay, xBoardWindow, marker[row][column] == 2 ? prelineGC : highlineGC,
                x + squareSize/4, y+squareSize/4, squareSize/2, squareSize/2, 0, 64*360);
     }
@@ -8897,7 +8906,7 @@ void SquareToPos(int rank, int file, int *x, int *y)
 /* Draw an arrow between two points using current settings */
 void DrawArrowBetweenPoints( int s_x, int s_y, int d_x, int d_y )
 {
-    XPoint arrow[7];
+    XPoint arrow[8];
     double dx, dy, j, k, x, y;
 
     if( d_x == s_x ) {
@@ -8994,6 +9003,7 @@ void DrawArrowBetweenPoints( int s_x, int s_y, int d_x, int d_y )
     }
 
     XFillPolygon(xDisplay, xBoardWindow, highlineGC, arrow, 7, Nonconvex, CoordModeOrigin);
+    if(appData.monoMode) arrow[7] = arrow[0], XDrawLines(xDisplay, xBoardWindow, darkSquareGC, arrow, 8, CoordModeOrigin);
 //    Polygon( hdc, arrow, 7 );
 }