aboutsummaryrefslogtreecommitdiff
path: root/devel.but
diff options
context:
space:
mode:
authorFranklin Wei <franklin@rockbox.org>2024-07-21 18:06:37 -0400
committerSimon Tatham <anakin@pobox.com>2024-07-31 23:29:00 +0100
commit5de69c22b0ff037f648a740a7c01869e78587df2 (patch)
treea4ea1196ffd2942a0937ae5d05a92710c6be6589 /devel.but
parentc010ca122f8e5a9b9828a846cbbc0d32de489b20 (diff)
downloadpuzzles-5de69c22b0ff037f648a740a7c01869e78587df2.zip
puzzles-5de69c22b0ff037f648a740a7c01869e78587df2.tar.gz
puzzles-5de69c22b0ff037f648a740a7c01869e78587df2.tar.bz2
puzzles-5de69c22b0ff037f648a740a7c01869e78587df2.tar.xz
Refactor `button & ~MOD_MASK' as `STRIP_BUTTON_MODIFIERS(button)'.
This refactors all instances of bitwise-ANDs with `~MOD_MASK'. There is a handful of more complex instances I left unchanged (in cube.c, midend.c, and twiddle.c), since those AND with `~MOD_MASK | MOD_NUM_KEYPAD' or similar. I don't think it's worth writing a macro for those cases. Also document this new macro's usage in devel.but.
Diffstat (limited to 'devel.but')
-rw-r--r--devel.but12
1 files changed, 10 insertions, 2 deletions
diff --git a/devel.but b/devel.but
index 577e74d..71bc60d 100644
--- a/devel.but
+++ b/devel.but
@@ -1161,8 +1161,10 @@ input probably just wants to treat the numeric keypad as numbers).
\dt \cw{MOD_MASK}
\dd This mask is the bitwise OR of all the available modifiers; you
-can bitwise-AND with \cw{~MOD_MASK} to strip all the modifiers off
-any input value.
+can bitwise-AND with \cw{~MOD_MASK} to strip all the modifiers off any
+input value; as this is a common operation, the
+\cw{STRIP_BUTTON_MODIFIERS()} macro can do this for you (see
+\k{utils-strip-button-modifiers}).
\S{backend-execute-move} \cw{execute_move()}
@@ -5322,6 +5324,12 @@ many domino tilings of the same grid.
The returned array is delivered in \c{grid}.
+\S{utils-strip-button-modifiers} \cw{STRIP_BUTTON_MODIFIERS()}
+
+This macro, defined in the main Puzzles header file, strips the
+modifier flags from the key code passed as an argument. It is
+equivalent to a bitwise-AND with \cw{~MOD_MASK}.
+
\C{writing} How to write a new puzzle
This chapter gives a guide to how to actually write a new puzzle: