From de0706e6db65fa857a314a8d982f006d35eebb94 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Sun, 6 Dec 2020 11:37:07 +0100
Subject: [PATCH] Fix Fullcavalry initial setup

---
 client/src/variants/Fullcavalry.js | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/client/src/variants/Fullcavalry.js b/client/src/variants/Fullcavalry.js
index 7397261e..98549db4 100644
--- a/client/src/variants/Fullcavalry.js
+++ b/client/src/variants/Fullcavalry.js
@@ -104,10 +104,12 @@ export class FullcavalryRules extends ChessRules {
         (firstBlackRook <= 3 ? 'e' : 'm') +
       baseFen.substring(firstBlackRook + 1, lastBlackRook) +
         (lastBlackRook >= 5 ? 'm' : 'e') +
+      // Subtract 35 = total number of characters before last FEN row:
+      // 8x3 (full rows) + 4 (empty rows) + 7 (separators)
       baseFen.substring(lastBlackRook + 1, firstWhiteRook) +
-        (firstWhiteRook <= 3 ? 'E' : 'M') +
+        (firstWhiteRook - 35 <= 3 ? 'E' : 'M') +
       baseFen.substring(firstWhiteRook + 1, lastWhiteRook) +
-        (lastWhiteRook >= 5 ? 'M' : 'E') +
+        (lastWhiteRook - 35 >= 5 ? 'M' : 'E') +
       baseFen.substring(lastWhiteRook + 1)
     );
   }
-- 
2.44.0