Slip in 10 more piece types
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 20 Oct 2015 12:43:27 +0000 (14:43 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 20 Oct 2015 12:43:27 +0000 (14:43 +0200)
Five new piece type without a defined image are added to increase the
length to the unpromoted series from 11 to 16. They all map behind
the Lion, which remains the 11th piece. Five promoted types are added
as well, just before King. No images are defined for these pieces (yet),
not even image-file names, so they can only be used with the 'Tile'
fallback and a user-defined inscription.

common.h
draw.c

index ff2b34c..fb2f52c 100644 (file)
--- a/common.h
+++ b/common.h
@@ -293,18 +293,24 @@ typedef enum {
     WhiteFerz, WhiteAlfil, WhiteAngel, WhiteMarshall, WhiteWazir, WhiteMan,
     WhiteCannon, WhiteNightrider, WhiteCardinal, WhiteDragon, WhiteGrasshopper,
     WhiteSilver, WhiteFalcon, WhiteLance, WhiteCobra, WhiteUnicorn, WhiteLion,
+    WhiteWolf, WhiteOx, WhiteBoar, WhiteHelmet, WhiteViking,
     WhiteTokin, WhiteClaw, WhitePCardinal, WhitePDragon, WhiteCat,
     WhitePSword, WhiteMonarch, WhiteMother, WhiteNothing, WhitePRook, WhitePDagger,
     WhiteDolphin, WhiteStag, WhiteHorned, WhiteEagle, WhiteSword,
-    WhiteCrown, WhiteHCrown, WhiteHorse, WhiteDrunk, WhitePBishop, WhiteKing,
+    WhiteCrown, WhiteHCrown, WhiteHorse, WhiteDrunk, WhitePBishop,
+    WhiteP1, WhiteP2, WhiteP3, WhiteP4, WhiteP5, 
+    WhiteKing,
     BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen,
     BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan,
     BlackCannon, BlackNightrider, BlackCardinal, BlackDragon, BlackGrasshopper,
     BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackLion,
+    BlackWolf, BlackOx, BlackBoar, BlackHelmet, BlackViking,
     BlackTokin, BlackClaw, BlackPCardinal, BlackPDragon, BlackCat,
     BlackPSword, BlackMonarch, BlackMother, BlackNothing, BlackPRook, BlackPDagger,
     BlackDolphin, BlackStag, BlackHorned, BlackEagle, BlackSword,
-    BlackCrown, BlackHCrown, BlackHorse, BlackDrunk, BlackPBishop, BlackKing,
+    BlackCrown, BlackHCrown, BlackHorse, BlackDrunk, BlackPBishop,
+    BlackP1, BlackP2, BlackP3, BlackP4, BlackP5,
+    BlackKing,
     EmptySquare, DarkSquare,
     NoRights, // [HGM] gamestate: for castling rights hidden in board[CASTLING]
     ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/
diff --git a/draw.c b/draw.c
index fccfeb6..1ac50c6 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -288,12 +288,15 @@ CreatePNGBoard (char *s, int kind)
 char *pngPieceNames[] = // must be in same order as internal piece encoding
 { "Pawn", "Knight", "Bishop", "Rook", "Queen", "Advisor", "Elephant", "Archbishop", "Marshall", "Gold", "Commoner",
   "Canon", "Nightrider", "CrownedBishop", "CrownedRook", "Crown", "Chancellor", "Hawk", "Lance", "Cobra", "Unicorn", "Lion",
+  "Tile", "Tile", "Tile", "Tile", "Tile",
   "GoldPawn", "Claw", "PromoHorse", "PromoDragon", "GoldLance", "PromoSword", "Prince", "Phoenix", "Kylin", "PromoRook", "PromoHSword",
-  "Dolphin", "Sword", "Leopard", "HSword", "GoldSilver", "Princess", "HCrown", "Knight", "Elephant", "PromoBishop", "King",
+  "Dolphin", "Sword", "Leopard", "HSword", "GoldSilver", "Princess", "HCrown", "Knight", "Elephant", "PromoBishop",
+  "Tile", "Tile", "Tile", "Tile", "Tile", "King",
   "Claw", "GoldKnight", "GoldLance", "GoldSilver", NULL
 };
 
 char *backupPiece[] = { "Princess", NULL, NULL, NULL, NULL, NULL, NULL,
+                        NULL, NULL, NULL, NULL, NULL,
                        NULL, NULL, NULL, NULL, NULL, NULL, "King", "Queen", "Lion" }; // pieces that map on other when not kanji
 
 RsvgHandle *
@@ -365,7 +368,8 @@ ScaleOnePiece (int color, int piece)
 
   if(!pngPieceImages[color][piece]) { // we still did not manage to acquire a piece bitmap
     static int warned = 0;
-    if(!(svgPieces[color][piece] = LoadSVG(svgDir, color, piece, 0)) && !warned) { // try to fall back on installed svg 
+    if(!(svgPieces[color][piece] = LoadSVG(svgDir, color, piece, 0)) // try to fall back on installed svg 
+       && !warned && strcmp(pngPieceNames[piece], "Tile")) {         // but do not complain about missing 'Tile'
       char *msg = _("No default pieces installed!\nSelect your own using '-pieceImageDirectory'.");
       printf("%s\n", msg); // give up
       DisplayError(msg, 0);