shithub: puzzles

Download patch

ref: a7b1697b1cd450589141b88862142dafc72e0b74
parent: ae63b8010b2fbac2eb591da888eefa9566da2b5f
author: Simon Tatham <anakin@pobox.com>
date: Tue Aug 17 15:59:14 EDT 2004

Now we have the `dir' parameter, we should use it where it makes
sense to do so.

[originally from svn r4477]

--- a/cube.c
+++ b/cube.c
@@ -1366,7 +1366,7 @@
     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;
 
         /*
@@ -1373,6 +1373,8 @@
          * 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;
--- a/sixteen.c
+++ b/sixteen.c
@@ -664,10 +664,12 @@
 		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];