shithub: puzzles

Download patch

ref: b7f192eea34e0bd36abcd457333ab37eb221789f
parent: 6824dcde03d894886fea4c1e16e0020a9c176225
author: Simon Tatham <anakin@pobox.com>
date: Sat Oct 22 12:35:23 EDT 2005

Cleanup: the `mouse_priorities' field in the back end has been a
more general-purpose flags word for some time now. Rename it to
`flags'.

[originally from svn r6414]

--- a/blackbox.c
+++ b/blackbox.c
@@ -1434,7 +1434,7 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 /* vim: set shiftwidth=4 tabstop=8: */
--- a/bridges.c
+++ b/bridges.c
@@ -2668,7 +2668,7 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 /* vim: set shiftwidth=4 tabstop=8: */
--- a/cube.c
+++ b/cube.c
@@ -1738,5 +1738,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/devel.but
+++ b/devel.but
@@ -1166,8 +1166,7 @@
 the mid-end will handle them internally and never consult this
 function at all. State changes as a result of Solve operations are
 also not animated by default, although you can change this for a
-particular game by setting a flag in \c{mouse_priorities}
-(\k{backend-mouse-priorities}).
+particular game by setting a flag in \c{flags} (\k{backend-flags}).
 
 The function is also passed a pointer to the local \c{game_ui}. It
 may refer to information in here to help with its decision (see
@@ -1441,12 +1440,12 @@
 freeze the timer thereafter so that the user can undo back through
 their solution process without altering their time.
 
-\S{backend-mouse-priorities} \c{mouse_priorities}
+\S{backend-flags} \c{flags}
 
-\c int mouse_priorities;
+\c int flags;
 
-This field is badly named. It is in fact a generic flags word. It
-consists of the bitwise OR of the following flags:
+This field contains miscellaneous per-backend flags. It consists of
+the bitwise OR of some combination of the following:
 
 \dt \cw{BUTTON_BEATS(x,y)}
 
--- a/dominosa.c
+++ b/dominosa.c
@@ -1778,5 +1778,5 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/fifteen.c
+++ b/fifteen.c
@@ -883,5 +883,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/flip.c
+++ b/flip.c
@@ -1304,5 +1304,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/guess.c
+++ b/guess.c
@@ -1314,7 +1314,7 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 /* vim: set shiftwidth=4 tabstop=8: */
--- a/inertia.c
+++ b/inertia.c
@@ -2178,5 +2178,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/lightup.c
+++ b/lightup.c
@@ -2254,7 +2254,7 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 #ifdef STANDALONE_SOLVER
--- a/loopy.c
+++ b/loopy.c
@@ -2753,5 +2753,5 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,                                       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/map.c
+++ b/map.c
@@ -3123,7 +3123,7 @@
     TRUE, TRUE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 #ifdef STANDALONE_SOLVER
--- a/midend.c
+++ b/midend.c
@@ -578,7 +578,7 @@
      * See if this move requires an animation.
      */
     if (special(type) && !(type == SOLVE &&
-			   (me->ourgame->mouse_priorities & SOLVE_ANIMATES))) {
+			   (me->ourgame->flags & SOLVE_ANIMATES))) {
         anim_time = 0;
     } else {
         anim_time = me->ourgame->anim_length(oldstate,
@@ -690,7 +690,7 @@
 	 * If the new button has lower priority than the old one,
 	 * don't bother doing this.
 	 */
-	if (me->ourgame->mouse_priorities &
+	if (me->ourgame->flags &
 	    BUTTON_BEATS(me->pressed_mouse_button, button))
 	    return ret;		       /* just ignore it */
 
@@ -1214,7 +1214,7 @@
                                    me->states[me->statepos-2].state,
                                    me->states[me->statepos-1].state);
     me->dir = +1;
-    if (me->ourgame->mouse_priorities & SOLVE_ANIMATES) {
+    if (me->ourgame->flags & SOLVE_ANIMATES) {
 	me->oldstate = me->ourgame->dup_game(me->states[me->statepos-2].state);
         me->anim_time =
 	    me->ourgame->anim_length(me->states[me->statepos-2].state,
--- a/net.c
+++ b/net.c
@@ -2873,5 +2873,5 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/netslide.c
+++ b/netslide.c
@@ -1827,5 +1827,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/nullgame.c
+++ b/nullgame.c
@@ -289,5 +289,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/pattern.c
+++ b/pattern.c
@@ -1281,7 +1281,7 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 #ifdef STANDALONE_SOLVER
--- a/pegs.c
+++ b/pegs.c
@@ -1224,5 +1224,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/puzzles.h
+++ b/puzzles.h
@@ -60,12 +60,14 @@
 #define IS_MOUSE_RELEASE(m) ( (unsigned)((m) - LEFT_RELEASE) <= \
                                (unsigned)(RIGHT_RELEASE - LEFT_RELEASE))
 
+/*
+ * Flags in the back end's `flags' word.
+ */
 /* Bit flags indicating mouse button priorities */
 #define BUTTON_BEATS(x,y) ( 1 << (((x)-LEFT_BUTTON)*3+(y)-LEFT_BUTTON) )
-
-/* Another random flag that goes in the mouse priorities section for want
- * of a better place to put it */
+/* Flag indicating that Solve operations should be animated */
 #define SOLVE_ANIMATES ( 1 << 9 )
+/* end of `flags' word definitions */
 
 #define IGNOREARG(x) ( (x) = (x) )
 
@@ -397,7 +399,7 @@
     int (*wants_statusbar)(void);
     int is_timed;
     int (*timing_state)(game_state *state, game_ui *ui);
-    int mouse_priorities;
+    int flags;
 };
 
 /*
--- a/rect.c
+++ b/rect.c
@@ -2874,5 +2874,5 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/samegame.c
+++ b/samegame.c
@@ -1664,5 +1664,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/sixteen.c
+++ b/sixteen.c
@@ -1059,5 +1059,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/slant.c
+++ b/slant.c
@@ -2089,7 +2089,7 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 #ifdef STANDALONE_SOLVER
--- a/solo.c
+++ b/solo.c
@@ -3090,7 +3090,7 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 #ifdef STANDALONE_SOLVER
--- a/tents.c
+++ b/tents.c
@@ -2091,7 +2091,7 @@
     TRUE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
 
 #ifdef STANDALONE_SOLVER
--- a/twiddle.c
+++ b/twiddle.c
@@ -1226,5 +1226,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    0,				       /* mouse_priorities */
+    0,				       /* flags */
 };
--- a/untangle.c
+++ b/untangle.c
@@ -1463,5 +1463,5 @@
     FALSE, FALSE, game_print_size, game_print,
     game_wants_statusbar,
     FALSE, game_timing_state,
-    SOLVE_ANIMATES,		       /* mouse_priorities */
+    SOLVE_ANIMATES,		       /* flags */
 };