respect move_start offset in replay game states default tip

Tue, 08 Sep 2026 22:35:50 +0200

author
Mike Becker <universe@uap-core.de>
date
Tue, 08 Sep 2026 22:35:50 +0200
changeset 226
341080f6bf34
parent 225
6e39f53127e9

respect move_start offset in replay game states

relates to #939

src/chess/rules.c file | annotate | diff | comparison | revisions
src/main.c file | annotate | diff | comparison | revisions
--- a/src/chess/rules.c	Tue Sep 08 22:22:01 2026 +0200
+++ b/src/chess/rules.c	Tue Sep 08 22:35:50 2026 +0200
@@ -568,7 +568,14 @@
     gamestate_init(replay);
     memcpy(&replay->info, &gamestate->info, sizeof(GameInfo));
     replay->review = true;
-    // TODO: respect move_start offset
+
+    if (gamestate->move_start > 0) {
+        replay->move_start = gamestate->move_start;
+        replay->fifty_cntr_start = gamestate->fifty_cntr_start;
+        free(replay->fen_start);
+        replay->fen_start = strdup(gamestate->fen_start);
+    }
+
     if (move_number > gamestate->movecount) {
         move_number = gamestate->movecount;
     }
--- a/src/main.c	Tue Sep 08 22:22:01 2026 +0200
+++ b/src/main.c	Tue Sep 08 22:35:50 2026 +0200
@@ -968,6 +968,8 @@
 static void game_review(GameState *gamestate) {
     const unsigned page_moves = 10;
     GameState viewedstate = {0};
+    // TODO: think about if viewedmove should refer to the index in the array
+    //       or to the actual half move (considering the start offset)
     unsigned viewedmove = gamestate->movecount;
     bool redraw = true;
 

mercurial