]> git.draconx.ca Git - rrace.git/blobdiff - src/motif_ui.c
Report changed positions from game_do_move.
[rrace.git] / src / motif_ui.c
index dfe4e82911434a59695646e14736a0c3546d547c..85241d8803c2de539427e41eea19b79c4d003945 100644 (file)
@@ -217,12 +217,9 @@ static void goal_resize(Widget w, void *data, void *cb_data)
 
 static void do_input_move(struct app_state *state, int x, int y)
 {
-       uint_least32_t *gp = state->board.game, prev[4];
-
-       memcpy(prev, gp, sizeof prev);
-       if (game_do_move(&state->board, x, y) == 0) {
-               uint_least32_t mask;
+       uint_fast32_t mask;
 
+       if ((mask = game_do_move(&state->board, x, y)) != 0) {
                if (game_check_goal(&state->board) == 0) {
                        int_fast32_t ms = game_finish(&state->board);
                        unsigned min, sec;
@@ -236,14 +233,9 @@ static void do_input_move(struct app_state *state, int x, int y)
                        min = sec / 60, sec %= 60;
                        printf("You won!  Time was %u:%.2u:%.3u\n",
                               min, sec, (unsigned)ms);
+                       mask |= ~GOAL_MASK;
                }
 
-               /* Figure out which tiles changed */
-               prev[0] ^= gp[0];
-               prev[1] ^= gp[1];
-               prev[2] ^= gp[2];
-               mask = prev[0] | prev[1] | prev[2];
-
                x11_redraw_game(state, mask);
        }
 }