Don't fail an assertion when setting up the provided clues at the
start of the solver, if they contradict each other. (Could trigger on
user-provided grids.)


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9594 cda61777-01e9-0310-a592-d414129be87e
Fix implicit split to @_. Also add 'use warnings', which would have
spotted it for me.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9605 cda61777-01e9-0310-a592-d414129be87e
For the convenience of Linux package maintainers, add to Makefile.gtk
and Makefile.doc a command-line parameter 'BINPREFIX' which will be
prepended to all the game binary names. E.g. 'make BINPREFIX=sgt-' and
'make BINPREFIX=sgt- install', and correspondingly 'make -f
Makefile.doc BINPREFIX=sgt-'.

Also included in this commit by mistake, changes to singles.c to add
\n to the end of all its debug() statements. I meant to commit that
separately. Oops.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9606 cda61777-01e9-0310-a592-d414129be87e
New puzzle! Contributed by Steffen Bauer, an implementation of
'Haunted Mirror Maze', a game involving placing ghosts, zombies and
vampires in a grid so that the right numbers of them are visible along
sight-lines reflected through multiple mirrors.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9652 cda61777-01e9-0310-a592-d414129be87e
Minor tweaks to Undead docs.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9656 cda61777-01e9-0310-a592-d414129be87e
New rule: interpret_move() is passed a pointer to the game_drawstate
basically just so that it can divide mouse coordinates by the tile
size, but is definitely not expected to _write_ to it, and it hadn't
previously occurred to me that anyone might try. Therefore,
interpret_move() now gets a pointer to a _const_ game_drawstate
instead of a writable one.

All existing puzzles cope fine with this API change (as long as the
new const qualifier is also added to a couple of subfunctions to which
interpret_move delegates work), except for the just-committed Undead,
which somehow had ds->ascii and ui->ascii the wrong way round but is
otherwise unproblematic.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9657 cda61777-01e9-0310-a592-d414129be87e
Oops, forgot to initialise changed_ascii on all paths in r9657.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9658 cda61777-01e9-0310-a592-d414129be87e
Forgot to add the new 'const' in the unfinished subdirectory. Oops.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9659 cda61777-01e9-0310-a592-d414129be87e
Make indentation consistent. (Somehow I forgot to do this before I
originally committed the puzzle, as I usually do.)


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9660 cda61777-01e9-0310-a592-d414129be87e
New puzzle! 'Unruly', contributed by Lennard Sprong, is an
implementation of a puzzle usually called 'Tohu wa Vohu'.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9680 cda61777-01e9-0310-a592-d414129be87e
Remove an unused variable spotted by gcc 4.6.3.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9682 cda61777-01e9-0310-a592-d414129be87e
A user points out that I could usefully clarify the Undead clue
semantics when a reflected sight-line crosses the same monster twice.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9694 cda61777-01e9-0310-a592-d414129be87e
Work around an annoying GTK behaviour I noticed the other day on my
Ubuntu 12.04 machine. What seems to happen is that we set up a window
containing a menu bar, a drawing area and a status bar, and set the
size of the drawing area; then the window is displayed _without_ the
menu bar; then we reduce the drawing area's size request to (1,1) to
let the user resize the window smaller; and now GTK gets round to
constructing the menu bar, and the drawing area helpfully shrinks a
bit to make room for it.

My fix is to set a 'shrink pending' flag instead of shrinking the
drawing area's size request, and defer the actual shrink operation
until the menu bar and status bar are both present.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9711 cda61777-01e9-0310-a592-d414129be87e
Fix overnight build failure last night, by making the new call to
gtk_widget_get_allocation conditional on GTK being new enough to have
that function.

I'm assuming until someone proves otherwise that if it isn't that new,
then it also isn't one of the versions of GTK which exhibit the bug
which that call was working around (since gtk_widget_get_allocation
came in 2.18, and the problem seems to have arisen since 2.20).


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9712 cda61777-01e9-0310-a592-d414129be87e
Actually do what the comment says at the top of main() regarding not
bombing out due to an option that we don't recognise but GTK will.
Somehow my basically workable plan had been completely nullified by
putting the error check in the wrong place.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9733 cda61777-01e9-0310-a592-d414129be87e
Pattern's display was broken for non-square puzzles, because
draw_numbers() was considerably confused between the width of the clue
border at the left and the height of the clue border at the top.
Unconfuse it (I think).


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9737 cda61777-01e9-0310-a592-d414129be87e
Revamp of the Windows command-line parsing and puzzle-loading code.

The Windows puzzles now accept similar command-line syntax to the GTK
ones, in that you can give them either a game ID (descriptive, random
or just plain params) or the name of a save file. Unlike the GTK ones,
however, the save file interpretation is tried first; this is because
some puzzles (e.g. Black Box) will interpret any old string as a valid
(if boring) game ID, and unlike the GTK puzzles it's not feasible to
require users to disambiguate via a command-line option, because on
Windows a thing that might easily happen is that a user passes a save
file to a puzzle binary via 'Open With' in the GUI shell, where they
don't get the chance to add extra options.

In order to make this work sensibly in the all-in-one Windows app, I
had to get round to another thing I've been planning to do for a
while, which is to write a function to examine a saved game file and
find out which puzzle it's for. So the combined Windows binary will
auto-switch to the right game if you pass a save file on its command
line, and also if you use Load while the program is running.

Another utility function I needed is one to split the WinMain single
command line string into argv. For this I've imported a copy of
split_into_argv() from Windows PuTTY (which doesn't affect this
package's list of copyright holders, since that function was all my
own code anyway).


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9749 cda61777-01e9-0310-a592-d414129be87e
Bring Pearl's game-completion handling in line with my usual practice:
the 'completed' flag is not reset if you make a new move transforming
a solved game into an unsolved state, so the game won't flash again if
you manually erase and redraw a line segment (though it still will if
you undo and redo past the first solved state in the undo history).


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9750 cda61777-01e9-0310-a592-d414129be87e
Stop the analysis pass in Loopy's redraw routine from being
conditionalised on !ds->started, so that we still do all the looping
over everything even if we know it's all going to be redrawn. This is
because deciding how much needs redrawing is not the only important
thing in those loops - they also set up arrays like ds->clue_error,
which tell the individual redraw functions _what_ to draw.

Fixes a bug in which, if you start a Loopy game and make moves causing
a clue to light up red for an error and then save your game, loading
the same save file at the start of a Loopy run would fail to highlight
the erroneous clue.

(This commit diff looks large, but actually it changes almost nothing
but whitespace.)


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9751 cda61777-01e9-0310-a592-d414129be87e
Stop using CLUE2CHAR to translate clues into text; just do the obvious
sprintf in both locations (screen and print) that need it. Fixes a bug
in which clues greater than 9 came out as hex digits in printed
puzzles.


git-svn-id: svn://svn.tartarus.org/sgt/puzzles@9765 cda61777-01e9-0310-a592-d414129be87e