src/chess/rules.c

changeset 186
8230904458a7
parent 185
c0acc89d6c01
--- a/src/chess/rules.c	Mon Aug 24 13:20:19 2026 +0200
+++ b/src/chess/rules.c	Mon Aug 24 13:42:35 2026 +0200
@@ -535,7 +535,7 @@
 }
 
 
-static void format_move_impl(const GameState *gamestate, Move *move) {
+void format_move(const GameState *gamestate, Move *move) {
     char *string = &(move->string[0]);
 
     /* at least 8 characters should be available, wipe them out */
@@ -622,18 +622,6 @@
     }
 }
 
-void format_move(const GameState *gamestate, Move *move) {
-    /* correct check/checkmate flags */
-    move->check = move->checkmate = false;
-    switch (determine_check_or_checkmate(gamestate, move)) {
-        case 2: move->checkmate = true;
-        case 1: move->check = true;
-    }
-
-    /* format the move string */
-    format_move_impl(gamestate, move);
-}
-
 static int validate_move_rules(const GameState *gamestate, const Move *move) {
     assert((move->piece & ~(PIECE_MASK|COLOR_MASK)) == 0);
 
@@ -1025,6 +1013,7 @@
     }
     char mstr[8];
     strcpy(mstr, pstr);
+    strcpy(move->string, pstr);
     
     /* evaluate check/checkmate flags */
     if (mstr[len-1] == '+' || mstr[len-1] == '#') {
@@ -1155,7 +1144,7 @@
     return VALID_MOVE_SYNTAX;
 }
 
-int eval_move2(const GameState *gamestate,
+static int eval_move2(const GameState *gamestate,
         const char *mstr, Color color, Move *move, bool lazy) {
     int result = eval_move1(mstr, move, color);
     if (result == VALID_MOVE_SYNTAX) {
@@ -1172,9 +1161,6 @@
                     case 1: move->check = true;
                 }
             }
-
-            /* format the move string */
-            format_move_impl(gamestate, move);
         }
     }
     return result;

mercurial