shithub: puzzles

Download patch

ref: 5ec86c03a8bc911bb3dbd77fb7c827eeca975594
parent: 7ada9a5742dd4766cc42909ac01bbb2505f74e47
author: Ben Harris <bjh21@bjh21.me.uk>
date: Wed Aug 9 05:43:04 EDT 2023

move_cursor(): handle visible flag; return useful value

This adds an extra parameter to move_cursor() that's an optional pointer
to a bool indicating whether the cursor is visible.  This allows for
centralising the common idiom of having the keyboard cursor become
visible when a cursor key is pressed.  Consistently with the vast
majority of existing puzzles, the cursor moves even if it was invisible
before, and becomes visible even if it can't move.

The function now also returns one of the special constants that can be
returned by interpret_move(), so that the caller can correctly return
MOVE_UI_UPDATE or MOVE_NO_EFFECT without needing to carefully check for
changes itself.

Callers are updated only to the extent that they all pass NULL as the
new argument.  Most of them could now be substantially simplified.