chiark / gitweb /
Now we have the `dir' parameter, we should use it where it makes
authorSimon Tatham <anakin@pobox.com>
Tue, 17 Aug 2004 19:59:14 +0000 (19:59 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 17 Aug 2004 19:59:14 +0000 (19:59 +0000)
sense to do so.

[originally from svn r4477]

cube.c
sixteen.c

diff --git a/cube.c b/cube.c
index 45b38bcd5709306c876930a2b87fa0711cc919ea..d5221e645e00f901411cecb4aba50add7a358235 100644 (file)
--- a/cube.c
+++ b/cube.c
@@ -1366,13 +1366,15 @@ void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
     draw_rect(fe, 0, 0, (int)((bb.r-bb.l+2.0F) * GRID_SCALE),
               (int)((bb.d-bb.u+2.0F) * GRID_SCALE), COL_BACKGROUND);
 
-    if (oldstate && oldstate->movecount > state->movecount) {
+    if (dir < 0) {
         game_state *t;
 
         /*
          * This is an Undo. So reverse the order of the states, and
          * run the roll timer backwards.
          */
+       assert(oldstate);
+
         t = oldstate;
         oldstate = state;
         state = t;
index 1e1f8b88e294536a8914c1b899c18fbf1fe8cbde..f6215bdb587bac9cbef177aacf8cb396809c9b74 100644 (file)
--- a/sixteen.c
+++ b/sixteen.c
@@ -664,10 +664,12 @@ void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
                float c;
                int sense;
 
-               if (oldstate && state->movecount < oldstate->movecount)
+               if (dir < 0) {
+                   assert(oldstate);
                    sense = -oldstate->last_movement_sense;
-               else
+               } else {
                    sense = state->last_movement_sense;
+               }
 
                t = state->tiles[i];