1011 Commits

Author SHA1 Message Date
261a784d1e 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.

[originally from svn r9733]
2012-12-28 11:22:13 +00:00
e17bf4abec 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).

[originally from svn r9712]
2012-11-21 18:45:07 +00:00
2a2520b8e7 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.

[originally from svn r9711]
2012-11-20 20:05:27 +00:00
083aeafc5c A user points out that I could usefully clarify the Undead clue
semantics when a reflected sight-line crosses the same monster twice.

[originally from svn r9694]
2012-11-03 16:27:49 +00:00
8dddfc22d7 Remove an unused variable spotted by gcc 4.6.3.
[originally from svn r9682]
2012-10-07 15:41:44 +00:00
fc9e6277bd New puzzle! 'Unruly', contributed by Lennard Sprong, is an
implementation of a puzzle usually called 'Tohu wa Vohu'.

[originally from svn r9680]
2012-10-07 10:18:33 +00:00
781ba1cfa4 Make indentation consistent. (Somehow I forgot to do this before I
originally committed the puzzle, as I usually do.)

[originally from svn r9660]
2012-09-10 18:24:34 +00:00
0e8a375814 Forgot to add the new 'const' in the unfinished subdirectory. Oops.
[originally from svn r9659]
2012-09-10 18:05:54 +00:00
0880ef0583 Oops, forgot to initialise changed_ascii on all paths in r9657.
[originally from svn r9658]
[r9657 == 3b250baa02a7332510685948bf17576c397b8ceb]
2012-09-09 21:55:14 +00:00
3b250baa02 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.

[originally from svn r9657]
2012-09-09 18:40:12 +00:00
55748a60cb Minor tweaks to Undead docs.
[originally from svn r9656]
2012-09-09 11:50:05 +00:00
67ddba7a15 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.

[originally from svn r9652]
2012-09-08 10:48:05 +00:00
15a4fbd1cd 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.

[originally from svn r9606]
2012-08-17 19:58:53 +00:00
200d6533bb Fix implicit split to @_. Also add 'use warnings', which would have
spotted it for me.

[originally from svn r9605]
2012-08-17 19:45:03 +00:00
bbf800e49e 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.)

[originally from svn r9594]
2012-07-29 21:29:26 +00:00
6567260eb0 Vary the behaviour of Mines's solve function depending on whether the
user is already in the 'dead' state when they press it. If so, we
reveal the rest of the mines in the grid as if it were the Windows
Minesweeper 'you lose' display, which provides information showing
what the user got wrong. (Otherwise they have to repeatedly flick back
and forth between Solve and Undo if they want to work out which flag
they placed wrongly.)

If you press Solve while alive, however, the existing behaviour
remains unchanged.

(This feature was suggested by Clive Jones a couple of weeks after I
first wrote Mines, and I've finally got round to doing it!)

[originally from svn r9561]
2012-06-10 07:20:18 +00:00
48e9767a20 Fix a bug introduced by r9495 in which we try to write temporary NULs
into a string which is usually a read-only string literal. Instead,
copy each segment into writable memory as we need it, and free it
afterwards.

[originally from svn r9558]
[r9495 == d0ff371b144d4bfe3cbfb062388347c08e431393]
2012-06-06 17:59:37 +00:00
5a095b8a08 Add a hacky environment variable that lets me arrange a soak-test of a
solver I've just modified, by forcing every game generation to be
instantly followed by an attempt to re-solve the same game
_description_ without the aux_info.

I've hacked similar changes in to midend.c several times in the last
couple of months for one reason or another, and it's about time I
arranged not to have to recompile to do it!

[originally from svn r9549]
2012-06-01 18:41:26 +00:00
a46f06e90e Remove the speed optimisation in the stage 3 solver which makes the
first loop only handle rightward or downward bridges (on the basis
that that way every bridge is looked at once rather than twice). This
seems to be breaking in the wake of recent changes to the solver, in
cases such as when island A is left of island B and has enough other
outgoing edges that only one bridge remains to potentially go to B,
but B is as yet unconstrained. In this situation the only code which
is able to adjust the maximum bridge count for that edge is the stage
3 solver (nothing else calls solve_join with is_max true), but it will
only do so if it _tries_ putting two bridges there and finds it
impossible, and when it starts from island A it won't even try.

Game ID which was insoluble just before this commit:
15x15m2:2a4d3b3c2h2d2a2a3c3w4a3m1d1a4a5a2d4d6e4q3e6a2a1e1b2g3a3o2g1d32l4b2c3a4c2b22l4a

This probably means I've done something else in recent checkins which
was not in accordance with the original solver design. However, this
fix will do for the moment.

[originally from svn r9548]
2012-06-01 18:41:24 +00:00
9f87d6fda5 Another uninitialised-variable fix, this one pointing out a real bug.
Simplest fix is to just remove the 'n' parameter from
solve_island_subgroup, replacing it with a robust island_countbridges.

[originally from svn r9547]
2012-06-01 18:41:23 +00:00
d7febe24f9 Add pointless initialisations to placate a gcc warning.
(I'm confident these can't happen. maxb is initialised whenever we
break from the first loop with y < h, and when we don't break from
that loop the second loop which uses maxb is run zero times. But gcc
can't work that out, sigh.)

[originally from svn r9546]
2012-06-01 18:41:23 +00:00
3ddf5cc2d0 Write a comment outlining a design for a rewritten faster solver.
[originally from svn r9544]
2012-05-31 18:10:12 +00:00
9d2f61dcfa Bridges solver enhancement. In the stage 3 solver, we were considering
the possibility that an island might form an isolated subgraph by
connecting to one of its neighbours (and, if so, reducing the maximum
bridge count in that direction so that some bridge would have to go
elsewhere), but we were not also considering the possibility that it
might form an isolated subgraph by connecting to _more_ than one of
its neighbours. For instance, if you have a 3 adjacent to a 1, a 2 and
something else, then at least one bridge must go to the something-else.

Previously insoluble test case:
10x10m2:a2b4a5a2a2a1ga2d3b33a3a4c2aa3e1a22b2a4b4aa3b1a2b33a1e3aa2a1a2c23a3a3a4a2a

[originally from svn r9543]
2012-05-31 18:10:11 +00:00
00f74d4c7d Bridges solver fix: in map_update_possibles, collect values from
maxh/maxv for squares between islands as well as on islands.

[originally from svn r9542]
2012-05-31 18:10:10 +00:00
12cd1ee235 Patch from Jonas Koelker to improve Filling's error highlighting: as
well as marking a region as wrong if it has too many squares for the
number written in it, this patch now causes a region to be marked
wrong if it has too few squares _and no liberties_, so that it can't
just be one the user is intending to enlarge later.

[originally from svn r9534]
2012-05-14 18:42:19 +00:00
1e71966e75 Patch from Jonas Koelker for the developer docs, fixing a couple of
editing errors and adding some comments about the necessary order of
midend operations called by a front end.

[originally from svn r9533]
2012-05-14 18:42:18 +00:00
cab65638b5 GNUstep compatibility: ensure both endpoints are actually drawn by
draw_line, by the brute-force method of explicitly plotting them in
addition to the GUI's line-drawing operation.

[originally from svn r9505]
2012-05-06 14:01:39 +00:00
eae4059d3d GNUstep compatibility: add a missing #include.
[originally from svn r9504]
2012-05-06 14:01:38 +00:00
d58fc30444 GNUstep compatibility: avoid attempting blitter_save with a partially
out-of-bounds rectangle. Instead, take the intersection of the
rectangle with the window boundary and do a smaller operation on
what's left.

[originally from svn r9503]
2012-05-06 14:01:36 +00:00
cdd53f182d GNUstep compatibility: stop using the API feature isFlipped/setFlipped
to translate y-coordinates from the default of up-from-bottom to the
down-from-top expected by these puzzles, because it doesn't work right
on GNUstep. Instead, we run the API in its default mode (probably a
more robust choice anyway) and translate coordinates manually in the
front end.

In the process, I've separated the processButton: method into one for
mouse buttons and one for keys, since that was the easiest way to
ensure the coordinates passed to the mid-end for the latter are -1,-1
_after_ translation rather than before.

[originally from svn r9502]
2012-05-06 14:01:35 +00:00
9d3c8fbde0 GNUstep compatibility: remove an unused variable which the compiler
warned about.

[originally from svn r9501]
2012-05-06 14:01:35 +00:00
3fbb23e354 GNUstep compatibility: comment out some API calls that GNUstep
apparently doesn't have. Fortunately they were optional anyway.

[originally from svn r9500]
2012-05-06 14:01:34 +00:00
41dc4a2195 GNUstep compatibility: spell null selectors "NULL", not "nil".
[originally from svn r9499]
2012-05-06 14:01:32 +00:00
22ebad30e4 Add a section to mkfiles.pl to build a makefile that compiles the OS X
front end using GNUstep, yielding a Unix program built from the same
code. Should make it easier to check OS X behaviour without having to
move as far as a Mac :-) However, it doesn't compile as is, so I'll
apply fixes to the code until it does.

[originally from svn r9498]
2012-05-06 14:01:32 +00:00
d0ff371b14 Stop using the deprecated NSString stringWithCString: methods.
[originally from svn r9495]
2012-05-06 11:36:32 +00:00
14da5088e8 Update the OS X makefile so I can build on Lion. Regrettably that
means I have to withdraw support for OS X 10.3 and PPC.

[originally from svn r9494]
2012-05-06 11:35:59 +00:00
8b96f9b996 Permit users to reconfigure the default setting for each puzzle using
another of those hacky environment variables.

[originally from svn r9455]
2012-04-10 19:51:57 +00:00
ec732a4f4e Add a difficulty exception to prevent Pearl spinning forever when
asked to generate a 5x5 Tricky puzzle. (Debian bug #667963)

[originally from svn r9454]
2012-04-08 13:45:10 +00:00
b40b89f879 Typo fix from Helge Kreutzmann, forwarded from Debian.
[originally from svn r9453]
2012-04-08 13:45:09 +00:00
812800a8b2 Increase by 1 pixel the clip rectangle used to draw and erase the
Black Box finish button. Like the Guess blitter, it was assuming
non-expansion of circles.

[originally from svn r9452]
2012-04-08 13:06:47 +00:00
b4f3b57aa1 Swap a 'max' for a 'min', fixing an out-of-range colour component
being passed to the front end.

[originally from svn r9451]
2012-04-08 13:06:46 +00:00
48fef05eb6 Increase by 1 in every direction the size of the blitter used to save
the background under a Guess coloured peg in mid-drag. Currently it
assumes the circle doesn't extend into the next pixel, which the docs
for draw_circle warn might happen due to antialiasing.

[originally from svn r9450]
2012-04-08 13:06:45 +00:00
51d1f0f856 Add an explicit -lm to the link lines in Makefile.gtk, after two users
reported on the same day that this is now necessary since up-to-date
GNU tools won't consider it sufficient to have libm be a dependency of
other explicitly referenced libraries if you're directly referring to
the contents of libm yourself.

[originally from svn r9448]
2012-04-07 22:28:59 +00:00
4f81608c40 Fix redundant redrawing in Pegs. Apparently it has always redrawn
every single peg and hole on the board, every time it did any kind of
redraw at all, because I forgot to update the array in the drawstate
indicating the last-drawn state of each position. And nobody's noticed
until now!

[originally from svn r9447]
2012-04-07 22:19:18 +00:00
e3f9741317 Change some instances of 'print $thing' to 'print $thing || ""', to
prevent annoying Perl warnings when $thing is undefined.

[originally from svn r9446]
2012-04-07 22:19:17 +00:00
704890390d Error checking in Pattern, which was until now the only remaining game
that _ought_ to have it but did not.

I've tried to implement it before and found that the most obvious
approach was so effective as to constitute a spoiler, so this is a
deliberately weakened approach which in a bit of play-testing seems to
be a more sensible balance. It won't necessarily tell you at the very
instant you put a foot wrong, but it will at least ensure that (my
usual minimum standard) once you've filled in the whole grid you will
either have seen a victory flash, or an error indicator showing you
why not.

[originally from svn r9445]
2012-04-06 12:34:34 +00:00
88accd3ea5 Comment the Mac build out of Buildscr, since I no longer have a
working Mac and hence can't build it any more.

[originally from svn r9442]
2012-04-03 12:49:22 +00:00
faabfe3b62 Patch from Jonas Koelker to add keyboard control support to Pearl.
[originally from svn r9411]
2012-02-19 10:15:59 +00:00
f38adf6394 Tweak a conditional expression in pearl.c to work around a display bug
in the Java build - which turns out to be a JVM bug in OpenJDK 6,
causing the NestedVM rendition of the expression (i==1?3:4) to be
mis-JITed. OpenJDK 7 appears not to do that any more, but this
equivalent (for these purposes) rephrasing should perturb the code
just enough to dodge the problem.

[originally from svn r9408]
2012-02-17 19:07:31 +00:00
21629d7e44 Fix one-character typo in r9405 which was breaking right-clicks.
[originally from svn r9406]
[r9405 == 0c13787c2a17adc891f8e47c06b259f80bc8251a]
2012-02-13 21:10:47 +00:00