Fix WB font-based piece rendering on variant switch
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 5 Jan 2011 16:31:37 +0000 (17:31 +0100)
committerArun Persaud <arun@nubati.net>
Tue, 11 Jan 2011 05:22:04 +0000 (21:22 -0800)
The piece bitmaps were only created from the font characters when the
number of ranks or files changed, because it was done in
InitDrawingSizes(). This caused missing pieces when changing to a
variant on the same board that used other pieces. Now InitDrawingSizes()
is called for any variant switch.

backend.c

index cd53ac6..b48ea5f 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -5303,8 +5303,8 @@ InitPosition(redraw)
     int i, j, pawnRow, overrule,
     oldx = gameInfo.boardWidth,
     oldy = gameInfo.boardHeight,
-    oldh = gameInfo.holdingsWidth,
-    oldv = gameInfo.variant;
+    oldh = gameInfo.holdingsWidth;
+    static int oldv;
 
     if(appData.icsActive) shuffleOpenings = FALSE; // [HGM] shuffle: in ICS mode, only shuffle on ICS request
 
@@ -5566,18 +5566,12 @@ InitPosition(redraw)
 
     if(oldx != gameInfo.boardWidth ||
        oldy != gameInfo.boardHeight ||
+       oldv != gameInfo.variant ||
        oldh != gameInfo.holdingsWidth
-#ifdef GOTHIC
-       || oldv == VariantGothic ||        // For licensing popups
-       gameInfo.variant == VariantGothic
-#endif
-#ifdef FALCON
-       || oldv == VariantFalcon ||
-       gameInfo.variant == VariantFalcon
-#endif
                                          )
             InitDrawingSizes(-2 ,0);
 
+    oldv = gameInfo.variant;
     if (redraw)
       DrawPosition(TRUE, boards[currentMove]);
 }