From c350b3e525b72509a4b717a513ccaa596f1fc515 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 14 Apr 2021 19:33:59 +0200
Subject: [PATCH] Special SVG for berolina pawns

---
 client/public/images/pieces/Antiking/bp.svg |  1 +
 client/public/images/pieces/Antiking/wp.svg |  1 +
 client/public/images/pieces/Berolina/SOURCE |  1 +
 client/public/images/pieces/Berolina/bp.svg | 25 +++++++++++++++++++++
 client/public/images/pieces/Berolina/wp.svg | 25 +++++++++++++++++++++
 client/src/variants/Antiking1.js            |  2 +-
 client/src/variants/Berolina.js             |  4 ++++
 client/src/variants/Diamond.js              |  4 ++++
 8 files changed, 62 insertions(+), 1 deletion(-)
 create mode 120000 client/public/images/pieces/Antiking/bp.svg
 create mode 120000 client/public/images/pieces/Antiking/wp.svg
 create mode 100644 client/public/images/pieces/Berolina/SOURCE
 create mode 100644 client/public/images/pieces/Berolina/bp.svg
 create mode 100644 client/public/images/pieces/Berolina/wp.svg

diff --git a/client/public/images/pieces/Antiking/bp.svg b/client/public/images/pieces/Antiking/bp.svg
new file mode 120000
index 00000000..d73b1f5a
--- /dev/null
+++ b/client/public/images/pieces/Antiking/bp.svg
@@ -0,0 +1 @@
+../Berolina/bp.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Antiking/wp.svg b/client/public/images/pieces/Antiking/wp.svg
new file mode 120000
index 00000000..4ba4e2bd
--- /dev/null
+++ b/client/public/images/pieces/Antiking/wp.svg
@@ -0,0 +1 @@
+../Berolina/wp.svg
\ No newline at end of file
diff --git a/client/public/images/pieces/Berolina/SOURCE b/client/public/images/pieces/Berolina/SOURCE
new file mode 100644
index 00000000..5067a58e
--- /dev/null
+++ b/client/public/images/pieces/Berolina/SOURCE
@@ -0,0 +1 @@
+https://greenchess.net/info.php?item=downloads
diff --git a/client/public/images/pieces/Berolina/bp.svg b/client/public/images/pieces/Berolina/bp.svg
new file mode 100644
index 00000000..7b2df989
--- /dev/null
+++ b/client/public/images/pieces/Berolina/bp.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+	Berolina-gyalog (fekete)
+	Készült: a pawn-b.svg felhasználásával
+	Felhasználási feltételek: Nevezd meg! - Így add tovább! (Creative Commons)
+	Uray M. János
+	2014-2018
+-->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 45 45">
+	<g stroke="#000" stroke-width="2.0" stroke-linecap="round">
+		<path d="M 22.5,11 L 22.5,8"/>
+	</g>
+	<g fill="#000" stroke="#000" stroke-width="1.5" stroke-linejoin="miter">
+		<path d="M 22.5,11.41
+			A 4,4,0 1,0 16.83,16.09
+			C 15.88,17.27 15.35,18.71 15.35,20.3 C 15.35,22.53 16.38,24.52 18,25.83
+			C 15.41,27.09 11,31.58 11,39.5
+			L 34,39.5
+			C 34,31.58 29.59,27.09 27,25.83
+			C 28.62,24.52 29.65,22.53 29.65,20.3 C 29.65,18.71 29.12,17.27 28.17,16.09
+			A 4,4,0 1,0 22.5,11.41
+		"/>
+	</g>
+</svg>
diff --git a/client/public/images/pieces/Berolina/wp.svg b/client/public/images/pieces/Berolina/wp.svg
new file mode 100644
index 00000000..e25862f4
--- /dev/null
+++ b/client/public/images/pieces/Berolina/wp.svg
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!--
+	Berolina-gyalog (fehér)
+	Készült: a pawn-w.svg felhasználásával
+	Felhasználási feltételek: Nevezd meg! - Így add tovább! (Creative Commons)
+	Uray M. János
+	2014-2018
+-->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 45 45">
+	<g stroke="#000" stroke-width="2.0" stroke-linecap="round">
+		<path d="M 22.5,11 L 22.5,8"/>
+	</g>
+	<g fill="#FFF" stroke="#000" stroke-width="1.5" stroke-linejoin="miter">
+		<path d="M 22.5,11.41
+			A 4,4,0 1,0 16.83,16.09
+			C 15.88,17.27 15.35,18.71 15.35,20.3 C 15.35,22.53 16.38,24.52 18,25.83
+			C 15.41,27.09 11,31.58 11,39.5
+			L 34,39.5
+			C 34,31.58 29.59,27.09 27,25.83
+			C 28.62,24.52 29.65,22.53 29.65,20.3 C 29.65,18.71 29.12,17.27 28.17,16.09
+			A 4,4,0 1,0 22.5,11.41
+		"/>
+	</g>
+</svg>
diff --git a/client/src/variants/Antiking1.js b/client/src/variants/Antiking1.js
index 781984f9..7876da63 100644
--- a/client/src/variants/Antiking1.js
+++ b/client/src/variants/Antiking1.js
@@ -30,7 +30,7 @@ export class Antiking1Rules extends BerolinaRules {
   }
 
   getPpath(b) {
-    return b[1] == "a" ? "Antiking/" + b : b;
+    return (['a', 'p'].includes(b[1]) ? "Antiking/" : "") + b;
   }
 
   static IsGoodPosition(position) {
diff --git a/client/src/variants/Berolina.js b/client/src/variants/Berolina.js
index 15a567ce..9b071d34 100644
--- a/client/src/variants/Berolina.js
+++ b/client/src/variants/Berolina.js
@@ -2,6 +2,10 @@ import { ChessRules } from "@/base_rules";
 
 export class BerolinaRules extends ChessRules {
 
+  getPpath(b) {
+    return (b[1] == 'p' ? "Berolina/" : "") + b;
+  }
+
   // En-passant after 2-sq jump
   getEpSquare(moveOrSquare) {
     if (!moveOrSquare) return undefined;
diff --git a/client/src/variants/Diamond.js b/client/src/variants/Diamond.js
index 658b7ad7..aedd15db 100644
--- a/client/src/variants/Diamond.js
+++ b/client/src/variants/Diamond.js
@@ -12,6 +12,10 @@ export class DiamondRules extends ChessRules {
     return false;
   }
 
+  getPpath(b) {
+    return (b[1] == 'p' ? "Berolina/" : "") + b;
+  }
+
   static GenRandInitFen(options) {
     if (options.randomness == 0)
       return "krbp4/rqnp4/nbpp4/pppp4/4PPPP/4PPBN/4PNQR/4PBRK w 0";
-- 
2.44.0