From fa1ce90bbcd27d332afebd9ecbd4e0ed662c4940 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Sun, 29 Sep 2013 23:21:32 +0200 Subject: [PATCH] Increase number of piece types to 44 SVG pieces are added for implementing Chu Shogi; the promoted versions for Chu are offset by 22 rather than the usual 11. --- Makefile.am | 12 +++ backend.c | 38 ++++++++++- common.h | 14 +++- draw.c | 9 ++- svg/BlackDolphin.svg | 104 +++++++++++++++++++++++++++ svg/BlackHCrown.svg | 129 ++++++++++++++++++++++++++++++++++ svg/BlackHSword.svg | 115 ++++++++++++++++++++++++++++++ svg/BlackLeopard.svg | 168 ++++++++++++++++++++++++++++++++++++++++++++ svg/BlackLion.svg | 172 +++++++++++++++++++++++++++++++++++++++++++++ svg/BlackPromoBishop.svg | 92 ++++++++++++++++++++++++ svg/BlackPromoDragon.svg | 109 +++++++++++++++++++++++++++++ svg/BlackPromoHSword.svg | 110 +++++++++++++++++++++++++++++ svg/BlackPromoHorse.svg | 88 +++++++++++++++++++++++ svg/BlackPromoRook.svg | 104 +++++++++++++++++++++++++++ svg/BlackPromoSword.svg | 108 ++++++++++++++++++++++++++++ svg/BlackSword.svg | 113 ++++++++++++++++++++++++++++++ svg/WhiteDolphin.svg | 105 ++++++++++++++++++++++++++++ svg/WhiteHCrown.svg | 129 ++++++++++++++++++++++++++++++++++ svg/WhiteHSword.svg | 107 ++++++++++++++++++++++++++++ svg/WhiteLeopard.svg | 169 ++++++++++++++++++++++++++++++++++++++++++++ svg/WhiteLion.svg | 173 ++++++++++++++++++++++++++++++++++++++++++++++ svg/WhitePromoBishop.svg | 84 ++++++++++++++++++++++ svg/WhitePromoDragon.svg | 100 ++++++++++++++++++++++++++ svg/WhitePromoHSword.svg | 102 +++++++++++++++++++++++++++ svg/WhitePromoHorse.svg | 80 +++++++++++++++++++++ svg/WhitePromoRook.svg | 94 +++++++++++++++++++++++++ svg/WhitePromoSword.svg | 100 ++++++++++++++++++++++++++ svg/WhiteSword.svg | 105 ++++++++++++++++++++++++++++ 28 files changed, 2829 insertions(+), 4 deletions(-) create mode 100644 svg/BlackDolphin.svg create mode 100644 svg/BlackHCrown.svg create mode 100644 svg/BlackHSword.svg create mode 100644 svg/BlackLeopard.svg create mode 100644 svg/BlackLion.svg create mode 100644 svg/BlackPromoBishop.svg create mode 100644 svg/BlackPromoDragon.svg create mode 100644 svg/BlackPromoHSword.svg create mode 100644 svg/BlackPromoHorse.svg create mode 100644 svg/BlackPromoRook.svg create mode 100644 svg/BlackPromoSword.svg create mode 100644 svg/BlackSword.svg create mode 100644 svg/WhiteDolphin.svg create mode 100644 svg/WhiteHCrown.svg create mode 100644 svg/WhiteHSword.svg create mode 100644 svg/WhiteLeopard.svg create mode 100644 svg/WhiteLion.svg create mode 100644 svg/WhitePromoBishop.svg create mode 100644 svg/WhitePromoDragon.svg create mode 100644 svg/WhitePromoHSword.svg create mode 100644 svg/WhitePromoHorse.svg create mode 100644 svg/WhitePromoRook.svg create mode 100644 svg/WhitePromoSword.svg create mode 100644 svg/WhiteSword.svg diff --git a/Makefile.am b/Makefile.am index 8646293..dd88170 100644 --- a/Makefile.am +++ b/Makefile.am @@ -132,6 +132,18 @@ dist_svg_DATA = svg/icon_white.svg svg/icon_black.svg \ svg/BlackQueen.svg svg/WhiteQueen.svg \ svg/BlackRook.svg svg/WhiteRook.svg \ svg/BlackUnicorn.svg svg/WhiteUnicorn.svg \ + svg/BlackSword.svg svg/WhiteSword.svg \ + svg/BlackHSword.svg svg/WhiteHSword.svg \ + svg/BlackLeopard.svg svg/WhiteLeopard.svg \ + svg/BlackLion.svg svg/WhiteLion.svg \ + svg/BlackPromoBishop.svg svg/WhitePromoBishop.svg \ + svg/BlackPromoRook.svg svg/WhitePromoRook.svg \ + svg/BlackPromoHorse.svg svg/WhitePromoHorse.svg \ + svg/BlackPromodragon.svg svg/WhitePromoDragon.svg \ + svg/BlackPromoSword.svg svg/WhitePromoSword.svg \ + svg/BlackPromoHSword.svg svg/WhitePromoHSword.svg \ + svg/BlackHCrown.svg svg/WhiteHCrown.svg \ + svg/BlackDolphin.svg svg/WhiteDolphin.svg \ svg/eo_Analyzing.svg svg/eo_Black.svg \ svg/eo_Clear.svg svg/eo_Ponder.svg \ svg/eo_Thinking.svg svg/eo_Unknown.svg \ diff --git a/backend.c b/backend.c index 4633377..4249d7c 100644 --- a/backend.c +++ b/backend.c @@ -646,8 +646,23 @@ ChessSquare CourierArray[2][BOARD_FILES] = { { BlackRook, BlackKnight, BlackAlfil, BlackBishop, BlackMan, BlackKing, BlackFerz, BlackWazir, BlackBishop, BlackAlfil, BlackKnight, BlackRook } }; +ChessSquare ChuArray[6][BOARD_FILES] = { + { WhiteLance, WhiteUnicorn, WhiteMan, WhiteFerz, WhiteWazir, WhiteKing, + WhiteAlfil, WhiteWazir, WhiteFerz, WhiteMan, WhiteUnicorn, WhiteLance }, + { BlackLance, BlackUnicorn, BlackMan, BlackFerz, BlackWazir, BlackAlfil, + BlackKing, BlackWazir, BlackFerz, BlackMan, BlackUnicorn, BlackLance }, + { WhiteCannon, EmptySquare, WhiteBishop, EmptySquare, WhiteNightrider, WhiteMarshall, + WhiteAngel, WhiteNightrider, EmptySquare, WhiteBishop, EmptySquare, WhiteCannon }, + { BlackCannon, EmptySquare, BlackBishop, EmptySquare, BlackNightrider, BlackAngel, + BlackMarshall, BlackNightrider, EmptySquare, BlackBishop, EmptySquare, BlackCannon }, + { WhiteFalcon, WhiteSilver, WhiteRook, WhiteCardinal, WhiteDragon, WhiteLion, + WhiteQueen, WhiteDragon, WhiteCardinal, WhiteRook, WhiteSilver, WhiteFalcon }, + { BlackFalcon, BlackSilver, BlackRook, BlackCardinal, BlackDragon, BlackQueen, + BlackLion, BlackDragon, BlackCardinal, BlackRook, BlackSilver, BlackFalcon } +}; #else // !(BOARD_FILES>=12) #define CourierArray CapablancaArray +#define ChuArray CapablancaArray #endif // !(BOARD_FILES>=12) @@ -1150,6 +1165,7 @@ InitBackEnd1 () case VariantCapablanca: /* [HGM] should work */ case VariantCourier: /* [HGM] initial forced moves not implemented */ case VariantShogi: /* [HGM] could still mate with pawn drop */ + case VariantChu: /* [HGM] experimental */ case VariantKnightmate: /* [HGM] should work */ case VariantCylinder: /* [HGM] untested */ case VariantFalcon: /* [HGM] untested */ @@ -5861,7 +5877,7 @@ void InitPosition (int redraw) { ChessSquare (* pieces)[BOARD_FILES]; - int i, j, pawnRow, overrule, + int i, j, pawnRow=1, pieceRows=1, overrule, oldx = gameInfo.boardWidth, oldy = gameInfo.boardHeight, oldh = gameInfo.holdingsWidth; @@ -5985,6 +6001,14 @@ InitPosition (int redraw) nrCastlingRights = 0; SetCharTable(pieceToChar, "PNBRLS...G.++++++Kpnbrls...g.++++++k"); break; + case VariantChu: + pieces = ChuArray; pieceRows = 3; + gameInfo.boardWidth = 12; + gameInfo.boardHeight = 12; + nrCastlingRights = 0; + SetCharTable(pieceToChar, "P.BRQSEXOGCATHD.VMLIFN+.+++++++++++++.+++++K" + "p.brqsexogcathd.vmlifn+.+++++++++++++.+++++k"); + break; case VariantCourier: pieces = CourierArray; gameInfo.boardWidth = 12; @@ -6054,6 +6078,7 @@ InitPosition (int redraw) pawnRow = gameInfo.boardHeight - 7; /* seems to work in all common variants */ if(pawnRow < 1) pawnRow = 1; if(gameInfo.variant == VariantMakruk || gameInfo.variant == VariantASEAN || gameInfo.variant == VariantGrand) pawnRow = 2; + if(gameInfo.variant == VariantChu) pawnRow = 3; /* User pieceToChar list overrules defaults */ if(appData.pieceToCharTable != NULL) @@ -6080,6 +6105,15 @@ InitPosition (int redraw) } } } + if(gameInfo.variant == VariantChu) { + if(j == (BOARD_WIDTH-2)/3 || j == BOARD_WIDTH - (BOARD_WIDTH+1)/3) + initialPosition[pawnRow+1][j] = WhiteCobra, + initialPosition[BOARD_HEIGHT-pawnRow-2][j] = BlackCobra; + for(i=1; i=BOARD_RGHT-1) { initialPosition[0][j] = WhiteRook; @@ -10030,6 +10064,8 @@ NonStandardBoardSize () overruled = gameInfo.boardWidth != 8 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 7; if( gameInfo.variant == VariantGrand ) overruled = gameInfo.boardWidth != 10 || gameInfo.boardHeight != 10 || gameInfo.holdingsSize != 7; + if( gameInfo.variant == VariantChu ) + overruled = gameInfo.boardWidth != 12 || gameInfo.boardHeight != 12 || gameInfo.holdingsSize != 0; return overruled; } diff --git a/common.h b/common.h index 65eaa9c..7f3c4f8 100644 --- a/common.h +++ b/common.h @@ -248,11 +248,19 @@ typedef enum { WhitePawn, WhiteKnight, WhiteBishop, WhiteRook, WhiteQueen, WhiteFerz, WhiteAlfil, WhiteAngel, WhiteMarshall, WhiteWazir, WhiteMan, WhiteCannon, WhiteNightrider, WhiteCardinal, WhiteDragon, WhiteGrasshopper, - WhiteSilver, WhiteFalcon, WhiteLance, WhiteCobra, WhiteUnicorn, WhiteKing, + WhiteSilver, WhiteFalcon, WhiteLance, WhiteCobra, WhiteUnicorn, WhiteNothing, + WhiteTokin, WhiteDagger, WhitePCardinal, WhitePDragon, WhiteCat, + WhitePSword, WhiteMonarch, WhiteMother, WhiteLion, WhitePRook, WhitePDagger, + WhiteDolphin, WhiteVacant, WhiteHorned, WhiteEagle, WhiteSword, + WhiteSkip, WhiteCrown, WhiteHorse, WhiteDrunk, WhitePBishop, WhiteKing, BlackPawn, BlackKnight, BlackBishop, BlackRook, BlackQueen, BlackFerz, BlackAlfil, BlackAngel, BlackMarshall, BlackWazir, BlackMan, BlackCannon, BlackNightrider, BlackCardinal, BlackDragon, BlackGrasshopper, - BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackKing, + BlackSilver, BlackFalcon, BlackLance, BlackCobra, BlackUnicorn, BlackNothing, + BlackTokin, BlackDagger, BlackPCardinal, BlackPDragon, BlackCat, + BlackPSword, BlackMonarch, BlackMother, BlackLion, BlackPRook, BlackPDagger, + BlackDolphin, BlackVacant, BlackHorned, BlackEagle, BlackSword, + BlackSkip, BlackCrown, BlackHorse, BlackDrunk, BlackPBishop, BlackKing, EmptySquare, DarkSquare, NoRights, // [HGM] gamestate: for castling rights hidden in board[CASTLING] ClearBoard, WhitePlay, BlackPlay, PromotePiece, DemotePiece /*for use on EditPosition menus*/ @@ -323,6 +331,7 @@ typedef enum { Variant35, /* Temporary name for possible future ICC wild 35 */ Variant36, /* Temporary name for possible future ICC wild 36 */ VariantShogi, /* [HGM] added variants */ + VariantChu, VariantXiangqi, VariantCourier, VariantGothic, @@ -370,6 +379,7 @@ typedef enum { "wild35", \ "wild36", \ "shogi", \ + "chu", \ "xiangqi", \ "courier", \ "gothic", \ diff --git a/draw.c b/draw.c index 9a2b125..a3a9cb1 100644 --- a/draw.c +++ b/draw.c @@ -155,6 +155,11 @@ SelectPieces(VariantClass v) pngPieceBitmaps[i][(int)WhiteAngel] = pngPieceBitmaps2[i][(int)WhiteFalcon]; pngPieceBitmaps[i][(int)WhiteMarshall] = pngPieceBitmaps2[i][(int)WhiteAlfil]; } + if(v == VariantChu) { + pngPieceBitmaps[i][(int)WhiteUnicorn] = pngPieceBitmaps2[i][(int)WhiteCat]; + pngPieceBitmaps[i][(int)WhiteSilver] = pngPieceBitmaps2[i][(int)WhiteSword]; + pngPieceBitmaps[i][(int)WhiteFalcon] = pngPieceBitmaps2[i][(int)WhiteDagger]; + } } } @@ -228,7 +233,9 @@ 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", "Princess", "Chancellor", "Hawk", "Lance", "Cobra", "Unicorn", "King", + "Canon", "Nightrider", "CrownedBishop", "CrownedRook", "Princess", "Chancellor", "Hawk", "Lance", "Cobra", "Unicorn", "Lion", + "GoldPawn", "HSword", "PromoHorse", "PromoDragon", "Leopard", "PromoSword", "King", "Queen", "Lion", "PromoRook", "PromoHSword", + "Dolphin", "Chancellor", "Unicorn", "Hawk", "Sword", "Princess", "HCrown", "Knight", "Elephant", "PromoBishop", "King", "GoldKnight", "GoldLance", "GoldPawn", "GoldSilver", NULL }; diff --git a/svg/BlackDolphin.svg b/svg/BlackDolphin.svg new file mode 100644 index 0000000..b24af4a --- /dev/null +++ b/svg/BlackDolphin.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/svg/BlackHCrown.svg b/svg/BlackHCrown.svg new file mode 100644 index 0000000..6c28d67 --- /dev/null +++ b/svg/BlackHCrown.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/BlackHSword.svg b/svg/BlackHSword.svg new file mode 100644 index 0000000..abb38d1 --- /dev/null +++ b/svg/BlackHSword.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/svg/BlackLeopard.svg b/svg/BlackLeopard.svg new file mode 100644 index 0000000..91bb34e --- /dev/null +++ b/svg/BlackLeopard.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/BlackLion.svg b/svg/BlackLion.svg new file mode 100644 index 0000000..1ed2cd8 --- /dev/null +++ b/svg/BlackLion.svg @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/BlackPromoBishop.svg b/svg/BlackPromoBishop.svg new file mode 100644 index 0000000..df5dc67 --- /dev/null +++ b/svg/BlackPromoBishop.svg @@ -0,0 +1,92 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/svg/BlackPromoDragon.svg b/svg/BlackPromoDragon.svg new file mode 100644 index 0000000..e483ebd --- /dev/null +++ b/svg/BlackPromoDragon.svg @@ -0,0 +1,109 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/svg/BlackPromoHSword.svg b/svg/BlackPromoHSword.svg new file mode 100644 index 0000000..a506ead --- /dev/null +++ b/svg/BlackPromoHSword.svg @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/svg/BlackPromoHorse.svg b/svg/BlackPromoHorse.svg new file mode 100644 index 0000000..9ddda1d --- /dev/null +++ b/svg/BlackPromoHorse.svg @@ -0,0 +1,88 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/svg/BlackPromoRook.svg b/svg/BlackPromoRook.svg new file mode 100644 index 0000000..03a5919 --- /dev/null +++ b/svg/BlackPromoRook.svg @@ -0,0 +1,104 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/svg/BlackPromoSword.svg b/svg/BlackPromoSword.svg new file mode 100644 index 0000000..f5a9e94 --- /dev/null +++ b/svg/BlackPromoSword.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/svg/BlackSword.svg b/svg/BlackSword.svg new file mode 100644 index 0000000..71887a1 --- /dev/null +++ b/svg/BlackSword.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/svg/WhiteDolphin.svg b/svg/WhiteDolphin.svg new file mode 100644 index 0000000..c01d573 --- /dev/null +++ b/svg/WhiteDolphin.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/svg/WhiteHCrown.svg b/svg/WhiteHCrown.svg new file mode 100644 index 0000000..07bc6c9 --- /dev/null +++ b/svg/WhiteHCrown.svg @@ -0,0 +1,129 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/WhiteHSword.svg b/svg/WhiteHSword.svg new file mode 100644 index 0000000..90df377 --- /dev/null +++ b/svg/WhiteHSword.svg @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/svg/WhiteLeopard.svg b/svg/WhiteLeopard.svg new file mode 100644 index 0000000..62e318c --- /dev/null +++ b/svg/WhiteLeopard.svg @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/WhiteLion.svg b/svg/WhiteLion.svg new file mode 100644 index 0000000..e5af5af --- /dev/null +++ b/svg/WhiteLion.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/svg/WhitePromoBishop.svg b/svg/WhitePromoBishop.svg new file mode 100644 index 0000000..ab93a93 --- /dev/null +++ b/svg/WhitePromoBishop.svg @@ -0,0 +1,84 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/svg/WhitePromoDragon.svg b/svg/WhitePromoDragon.svg new file mode 100644 index 0000000..f2e21ad --- /dev/null +++ b/svg/WhitePromoDragon.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/svg/WhitePromoHSword.svg b/svg/WhitePromoHSword.svg new file mode 100644 index 0000000..09fe10a --- /dev/null +++ b/svg/WhitePromoHSword.svg @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/svg/WhitePromoHorse.svg b/svg/WhitePromoHorse.svg new file mode 100644 index 0000000..d678fe9 --- /dev/null +++ b/svg/WhitePromoHorse.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/svg/WhitePromoRook.svg b/svg/WhitePromoRook.svg new file mode 100644 index 0000000..e75c0b3 --- /dev/null +++ b/svg/WhitePromoRook.svg @@ -0,0 +1,94 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + diff --git a/svg/WhitePromoSword.svg b/svg/WhitePromoSword.svg new file mode 100644 index 0000000..cefeb40 --- /dev/null +++ b/svg/WhitePromoSword.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/svg/WhiteSword.svg b/svg/WhiteSword.svg new file mode 100644 index 0000000..cdcc108 --- /dev/null +++ b/svg/WhiteSword.svg @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + -- 1.7.0.4