src/chess/pgn.c

changeset 80
b980a7192b5a
parent 78
ceb9197b3c6d
child 81
82d3b044aa69
--- a/src/chess/pgn.c	Tue Jun 03 08:43:17 2025 +0200
+++ b/src/chess/pgn.c	Wed Jun 04 23:56:40 2025 +0200
@@ -63,11 +63,11 @@
     char tagvalue[128];
     
     /* read tag pairs */
-    _Bool readmoves = 0;
+    bool readmoves = false;
     while (!readmoves) {
         while (isspace(c = fgetc(stream)));
         if (c == '1') {
-            readmoves = 1;
+            readmoves = true;
             break;
         }
         if (c != '[') {
@@ -279,31 +279,31 @@
     return 1;
 }
 
-static _Bool fen_castling_chkmoved(GameState *gamestate,
+static bool fen_castling_chkmoved(GameState *gamestate,
     uint8_t row, uint8_t file) {
     
     MoveList *ml = gamestate->movelist;
     while (ml) {
         if (ml->move.fromfile == file && ml->move.fromrow == row) {
-            return 1;
+            return true;
         }
         ml = ml->next;
     }
     
-    return 0;
+    return false;
 }
 
 static size_t fen_castling(char *str, GameState *gamestate) {
-    _Bool K, Q, k, q;
+    bool K, Q, k, q;
     
     if (fen_castling_chkmoved(gamestate, rowidx('1'), fileidx('e'))) {
-        K = Q = 0;
+        K = Q = false;
     } else {
         K = !fen_castling_chkmoved(gamestate, rowidx('1'), fileidx('h'));
         Q = !fen_castling_chkmoved(gamestate, rowidx('1'), fileidx('a'));
     }
     if (fen_castling_chkmoved(gamestate, rowidx('8'), fileidx('e'))) {
-        k = q = 0;
+        k = q = false;
     } else {
         k = !fen_castling_chkmoved(gamestate, rowidx('8'), fileidx('h'));
         q = !fen_castling_chkmoved(gamestate, rowidx('8'), fileidx('a'));

mercurial