chiark / gitweb /
sgt-puzzles.git
8 years agoChange Pearl's cursor logic.
Jonas Kölker [Tue, 22 Sep 2015 09:37:17 +0000 (11:37 +0200)]
Change Pearl's cursor logic.

Keyboard dragging while holding Control now moves the cursor to the
target square. Shift-Control-arrowkey performs the previous behavior
of Control-arrowkey.

8 years agoRefactor Pearl's mark_in_direction, and invert a parameter.
Jonas Kölker [Tue, 22 Sep 2015 09:19:53 +0000 (11:19 +0200)]
Refactor Pearl's mark_in_direction, and invert a parameter.

8 years agoRefactor modifier handling in Pearl's cursor code.
Jonas Kölker [Tue, 22 Sep 2015 09:18:31 +0000 (11:18 +0200)]
Refactor modifier handling in Pearl's cursor code.

8 years agoAdd more keyboard controls to Slant.
Jonas Kölker [Mon, 21 Sep 2015 16:34:53 +0000 (18:34 +0200)]
Add more keyboard controls to Slant.

8 years agoSlant: hide keyboard cursor when using the mouse.
Jonas Kölker [Mon, 21 Sep 2015 16:22:34 +0000 (18:22 +0200)]
Slant: hide keyboard cursor when using the mouse.

8 years agoRectangles: cancel keyboard drag with Escape.
Jonas Kölker [Mon, 21 Sep 2015 15:44:50 +0000 (17:44 +0200)]
Rectangles: cancel keyboard drag with Escape.

8 years agoFilling: enable keyboard-driven cursor dragging mode.
Jonas Kölker [Mon, 21 Sep 2015 15:41:10 +0000 (17:41 +0200)]
Filling: enable keyboard-driven cursor dragging mode.

8 years agoRange: add pencil marks to squares by Shift-cursor keys.
Jonas Kölker [Mon, 21 Sep 2015 15:39:47 +0000 (17:39 +0200)]
Range: add pencil marks to squares by Shift-cursor keys.

8 years agoPattern: color multiple squares with Ctrl- or Shift-cursor keys.
Jonas Kölker [Mon, 21 Sep 2015 15:33:02 +0000 (17:33 +0200)]
Pattern: color multiple squares with Ctrl- or Shift-cursor keys.

8 years agoAdd game_text_format to Tents.
Jonas Kölker [Mon, 21 Sep 2015 15:14:55 +0000 (17:14 +0200)]
Add game_text_format to Tents.

Replaces an inactive stub implementation.

8 years agoAdd game_text_format to Pattern.
Jonas Kölker [Mon, 21 Sep 2015 15:02:47 +0000 (17:02 +0200)]
Add game_text_format to Pattern.

8 years agoAdd game_text_format to Inertia.
Jonas Kölker [Mon, 21 Sep 2015 14:57:14 +0000 (16:57 +0200)]
Add game_text_format to Inertia.

8 years agoAdd game_text_format to Flip.
Jonas Kölker [Mon, 21 Sep 2015 14:54:38 +0000 (16:54 +0200)]
Add game_text_format to Flip.

8 years agoAdd game_text_format to Pearl.
Jonas Kölker [Mon, 21 Sep 2015 14:53:20 +0000 (16:53 +0200)]
Add game_text_format to Pearl.

8 years agoAdd game_text_format to Dominosa.
Jonas Kölker [Mon, 21 Sep 2015 14:49:56 +0000 (16:49 +0200)]
Add game_text_format to Dominosa.

8 years agoUnequal: stop ignoring keys 'h' and 'm' while cursor active.
Jonas Kölker [Mon, 21 Sep 2015 14:41:03 +0000 (16:41 +0200)]
Unequal: stop ignoring keys 'h' and 'm' while cursor active.

At least, so long as 'h' and 'm' are not "numbers".

8 years agoFix a memory leak in Range's find_errors.
Jonas Kölker [Mon, 21 Sep 2015 14:21:48 +0000 (16:21 +0200)]
Fix a memory leak in Range's find_errors.

Only occurred in invalid instances, such as 3x1:1b when you put a
black in the middle square.

8 years agoDon't overallocate colour memory in Loopy.
Jonas Kölker [Mon, 21 Sep 2015 14:24:10 +0000 (16:24 +0200)]
Don't overallocate colour memory in Loopy.

8 years agoFix segfault in Range's game_text_format.
Jonas Kölker [Mon, 21 Sep 2015 13:55:53 +0000 (15:55 +0200)]
Fix segfault in Range's game_text_format.

Occurred on Nx1 puzzles, etc.

8 years agoFix typo in undo key handling.
Jonas Kölker [Mon, 21 Sep 2015 14:26:53 +0000 (16:26 +0200)]
Fix typo in undo key handling.

Now we can undo with both 'u' and 'U', symmetrically with redoing with
both 'r' and 'R'.

8 years agoInclude an example of Range's text_format in the comments.
Jonas Kölker [Mon, 21 Sep 2015 13:48:29 +0000 (15:48 +0200)]
Include an example of Range's text_format in the comments.

8 years agoFix a typo in the comments of Pearl.
Jonas Kölker [Mon, 21 Sep 2015 13:51:06 +0000 (15:51 +0200)]
Fix a typo in the comments of Pearl.

Each stone can have 2 lines radiating from its centre, not 3.

8 years agoAdd '-set colorspace RGB' to some icon convert commands.
Simon Tatham [Sat, 3 Oct 2015 12:15:59 +0000 (13:15 +0100)]
Add '-set colorspace RGB' to some icon convert commands.

Its absence was breaking the icon build on Ubuntu 14.04, because you
ask convert to map an image into a specific 16-colour palette, and it
does so and _then_ nonconsensually maps those colours in turn through
a colourspace transformation you didn't ask for, causing icon.pl to
fail an assertion when it finds an RGB value not in the palette.

8 years agoGTK 3 port: arrange configure.ac support for GTK 2/3 detection.
Simon Tatham [Sat, 3 Oct 2015 11:28:28 +0000 (12:28 +0100)]
GTK 3 port: arrange configure.ac support for GTK 2/3 detection.

GTK 3 is the default, falling back to GTK 2 if 3 isn't available; you
can also say --with-gtk=2 to force GTK 2.

8 years agoGTK 3 port: don't turn off drawing area double buffering.
Simon Tatham [Sat, 3 Oct 2015 11:28:26 +0000 (12:28 +0100)]
GTK 3 port: don't turn off drawing area double buffering.

I think I did this in GTK2 on the basis that our server-side cache
pixmap was double-buffering enough for us - any puzzle which erased a
big area with a background rectangle and then redrew over the top of
it would do so only on the off-screen pixmap, and the updates would
only be copied to the visible window after it was all done.

In GTK3, I don't think there's any need - this is all the usual way
things are done anyway, as far as I can see. So I've turned this call
back off, at least until I hear of a reason why I need it again.

8 years agoGTK 3 port: change API functions for widget sizing.
Simon Tatham [Sat, 3 Oct 2015 11:28:24 +0000 (12:28 +0100)]
GTK 3 port: change API functions for widget sizing.

set_usize is deprecated, and get_preferred_size is the GTK 3 thing we
should use in place of size_request.

8 years agoGTK 3 port: use GtkBox directly, not GtkHBox and GtkVBox.
Simon Tatham [Sat, 3 Oct 2015 11:28:21 +0000 (12:28 +0100)]
GTK 3 port: use GtkBox directly, not GtkHBox and GtkVBox.

I've done this by #defining the old names in terms of the new ones,
because the old ones are still more concise!

8 years agoGTK 3 port: be prepared not to use GtkStock.
Simon Tatham [Sat, 3 Oct 2015 11:28:19 +0000 (12:28 +0100)]
GTK 3 port: be prepared not to use GtkStock.

GTK 3 has deprecated it in favour of just making you specify fixed
strings as button labels, which seems like a step backwards to me but
there we go.

8 years agoGTK 3 port: use GdkRGBA for the window background colour.
Simon Tatham [Sat, 3 Oct 2015 11:28:17 +0000 (12:28 +0100)]
GTK 3 port: use GdkRGBA for the window background colour.

Suits our internal API better, anyway, with RGB components being
floats ranging from 0 to 1.

8 years agoGTK 3 port: stop getting default bg colour from the window style.
Simon Tatham [Sat, 3 Oct 2015 11:28:15 +0000 (12:28 +0100)]
GTK 3 port: stop getting default bg colour from the window style.

GTK3 window styles don't reliably provide one, so we have to fall back
to just making one up.

8 years agoGTK 3 port: condition out the complicated window resize code.
Simon Tatham [Sat, 3 Oct 2015 11:28:13 +0000 (12:28 +0100)]
GTK 3 port: condition out the complicated window resize code.

In GTK 2, we had a big pile of horrible code to deal with the fact
that it's very hard to open a window in such a way as to make it easy
to resize smaller as well as bigger.

Essentially, we'd open the window with the drawing area's minimum size
request set to the desired _initial_ window size; then we'd wait until
GTK had finished creating other window components (menu bar, status
line) and the window's size allocation had settled down, and finally
reduce the size request to the real minimum size so that now the
window was resizable in both directions. This also involved some
deliberate checking of the Ubuntu Unity GTK extension which steals the
menu bar and put it elsewhere (see commit 8f8333a35), to avoid us
waiting forever for a menu bar that wasn't going to show up.

But in GTK3, this has all become actually sensible! All we now have to
do is to set the window's geometry hints to indicate the drawing area
itself as the base widget (probably a good plan anyway), and then we
can set the initial size using gtk_window_set_default_geometry() and
resize it later using gtk_window_resize_to_geometry(). So now we can
completely condition out all of the previous horrors, and consider
them to be legacy GTK2 compatibility code only. Phew.

8 years agoGTK 3 port: provide a 'draw' handler.
Simon Tatham [Sat, 3 Oct 2015 11:28:11 +0000 (12:28 +0100)]
GTK 3 port: provide a 'draw' handler.

This is what GTK 3 uses in place of 'expose_event'. Also I've arranged
here for my internal USE_CAIRO_WITHOUT_PIXMAP setting to be enabled in
GTK3, as well as in GTK2 with deprecated functions disabled.

8 years agoGTK 3 port: use GtkGrid as an alternative to GtkTable.
Simon Tatham [Sat, 3 Oct 2015 11:28:09 +0000 (12:28 +0100)]
GTK 3 port: use GtkGrid as an alternative to GtkTable.

This also involves setting some "hexpand" properties on the widgets
contained in the GtkGrid, to achieve effects which GtkTable did by
setting flags in gtk_table_attach.

8 years agoGTK 3 prep: use g_timeout_add, not gtk_timeout_add.
Simon Tatham [Sat, 3 Oct 2015 11:28:06 +0000 (12:28 +0100)]
GTK 3 prep: use g_timeout_add, not gtk_timeout_add.

8 years agoGTK 3 prep: use GTK instead of GDK window-icon functions.
Simon Tatham [Sat, 3 Oct 2015 11:28:04 +0000 (12:28 +0100)]
GTK 3 prep: use GTK instead of GDK window-icon functions.

We now build cleanly with -DGDK_DISABLE_DEPRECATED.

8 years agoGTK 3 prep: make the server-side backing pixmap optional.
Simon Tatham [Sat, 3 Oct 2015 11:28:02 +0000 (12:28 +0100)]
GTK 3 prep: make the server-side backing pixmap optional.

When GDK_DISABLE_DEPRECATED is defined, we now don't have fe->pixmap;
instead we just maintain our client-side window contents in fe->image,
and draw from there directly to the window in the expose handler.

8 years agoGTK 3 prep: use gtk_radio_menu_item_get_group().
Simon Tatham [Sat, 3 Oct 2015 11:28:00 +0000 (12:28 +0100)]
GTK 3 prep: use gtk_radio_menu_item_get_group().

Replaces the previous deprecated spelling. We now build cleanly with
-DGTK_DISABLE_DEPRECATED.

8 years agoGTK 3 prep: use GtkComboBox for drop-down lists.
Simon Tatham [Sat, 3 Oct 2015 11:27:58 +0000 (12:27 +0100)]
GTK 3 prep: use GtkComboBox for drop-down lists.

The previous GtkOptionMenu was long since deprecated.

8 years agoGTK 3 prep: use the glib names for base object types.
Simon Tatham [Sat, 3 Oct 2015 11:27:56 +0000 (12:27 +0100)]
GTK 3 prep: use the glib names for base object types.

8 years agoGTK 3 prep: use GTK_KEY_* constants.
Simon Tatham [Sat, 3 Oct 2015 11:27:54 +0000 (12:27 +0100)]
GTK 3 prep: use GTK_KEY_* constants.

8 years agoGTK 3 prep: use accessors instead of direct field access.
Simon Tatham [Sat, 3 Oct 2015 11:27:51 +0000 (12:27 +0100)]
GTK 3 prep: use accessors instead of direct field access.

We now build cleanly with -DGSEAL_ENABLE.

8 years agoFix packing direction of config boxes.
Simon Tatham [Sat, 3 Oct 2015 11:27:49 +0000 (12:27 +0100)]
Fix packing direction of config boxes.

We were packing the GtkTable into the dialog's content area using
gtk_box_pack_end, which had the slightly silly effect that resizing
the config box vertically would keep all the controls aligned to the
_bottom_ rather than the top.

8 years agoDon't refresh backing store on a no-op configure event.
Simon Tatham [Sat, 3 Oct 2015 11:27:47 +0000 (12:27 +0100)]
Don't refresh backing store on a no-op configure event.

Sometimes, we can get a "configure_area" event telling us that the
drawing area has changed size to the same size it already was. This
can happen when we change puzzle presets in a way that doesn't change
the size, and also sometimes seems to happen as a side effect of
changing the text in the status line.

In that situation, it's a waste of effort - and can cause visible
on-screen flicker - to throw away the window's backing image and
pixmap and regenerate them from scratch. So now we detect a non-resize
and avoid doing all that.

The only thing we retain unconditionally in configure_area is the
midend_force_redraw, because that's the place where a puzzle redraw is
forced when changing presets or loading a new game.

8 years agoEnforce more than one dot in Galaxies puzzles.
Chris Boyle [Sat, 26 Sep 2015 17:54:15 +0000 (18:54 +0100)]
Enforce more than one dot in Galaxies puzzles.

At minimum size (3x3) Galaxies can generate a pre-solved single dot
game.

You have to add and remove a line to get the victory flash which is a
bit weird, so just prevent this.

8 years agoFix OS X build failure due to a deprecated method.
Simon Tatham [Fri, 18 Sep 2015 11:20:32 +0000 (12:20 +0100)]
Fix OS X build failure due to a deprecated method.

Apple upgraded me to Xcode 7 yesterday, and now [NSString cString]
gives a deprecation warning, which -Werror turns into a full-on build
failure. Explicitly specify an encoding.

(I mention in a comment that there's an alternative piece of API that
I possibly ought to be using instead, but until I make a concrete
decision about where my backwards compatibility threshold is, I'll
leave it as it is for the moment.)

8 years agoImplement osx_draw_thick_line
Bo Lindbergh [Wed, 2 Sep 2015 19:58:55 +0000 (21:58 +0200)]
Implement osx_draw_thick_line

8 years agoTypo in the OS X Info plist
Bo Lindbergh [Tue, 25 Aug 2015 13:45:07 +0000 (15:45 +0200)]
Typo in the OS X Info plist

8 years agoemcc frontend: stop indiscriminately squashing mouseups.
Simon Tatham [Fri, 14 Aug 2015 18:42:42 +0000 (19:42 +0100)]
emcc frontend: stop indiscriminately squashing mouseups.

The mouseup listener was calling event.preventDefault(), as part of
the mechanism for making mouse clicks and drags on the puzzle's resize
handle have resizing effects _instead_ of the normal browser
behaviour. However, calling event.preventDefault() on _every_ mouseup,
rather than just the ones associated with the resize handle, was
overkill, and I've recently noticed that it's breaking attempts to
select from the game type dropdown by clicking the mouse. So now I'm
only calling preventDefault() on the mouseups that I have reason to
think are actually relevant to what I'm trying to do.

(I don't know why I've only just noticed this. I suppose a change of
behaviour between Firefox versions is the most likely cause.)

8 years agoReplace a TCHAR with a WCHAR.
Simon Tatham [Sat, 1 Aug 2015 10:14:30 +0000 (11:14 +0100)]
Replace a TCHAR with a WCHAR.

MultiByteToWideChar expects a WCHAR[256] output buffer if you pass it
an output length of 256. TCHAR[256] is entirely the wrong size, though
for some reason Visual Studio seems not to have thrown a compile error
pointing that out.

Thanks to Jason Hood for spotting this.

8 years agoSolo, Undead: support 'm' to fill in all pencils.
Simon Tatham [Mon, 13 Jul 2015 18:06:53 +0000 (19:06 +0100)]
Solo, Undead: support 'm' to fill in all pencils.

Keen, Towers and Unequal (and Group) already have this feature in
common: pressing m while no square is selected, causes a full set of
pencil marks to be filled in for every square without a real number/
letter/whatever in it. Solo and Undead share the basic UI principles
(left-click to select a square then type a thing to go in it, vs
right-click to select a square then type things to pencil-mark in it),
but did not have that same feature. Now they do.

8 years agoFix redrawing of Undead 'done' clues after a resize.
Simon Tatham [Sun, 5 Jul 2015 20:57:38 +0000 (21:57 +0100)]
Fix redrawing of Undead 'done' clues after a resize.

The is_hint_stale() function has the side effect of copying a path
hint's new colour-relevant information into the game_drawstate, where
draw_path_hint will then use it. But it returns TRUE early in some
situations, notably !ds->started, which can happen after the actual
game start if the window is resized and a fresh drawstate is created.

This patch, thanks to Chris Boyle, fixes it by eliminating the early
returns from is_hint_stale - the return value is unchanged, but now
the side effects happen reliably.

8 years agoMagnets: you can now mark clues as done
Kevin Lyles [Mon, 8 Jun 2015 20:47:09 +0000 (15:47 -0500)]
Magnets: you can now mark clues as done

8 years agoRemoved an extra layer of complexity for count colors
Kevin Lyles [Mon, 8 Jun 2015 21:42:31 +0000 (16:42 -0500)]
Removed an extra layer of complexity for count colors

8 years agoFactored out some of the color logic for the clues
Kevin Lyles [Mon, 8 Jun 2015 21:20:58 +0000 (16:20 -0500)]
Factored out some of the color logic for the clues

8 years agoRemoved DS_FULL (it wasn't used)
Kevin Lyles [Mon, 8 Jun 2015 20:48:03 +0000 (15:48 -0500)]
Removed DS_FULL (it wasn't used)

8 years agoUpdated name/size of clues_done in Towers
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Updated name/size of clues_done in Towers

8 years agoUndead: you can now mark clues as done
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Undead: you can now mark clues as done

8 years agoReworked draw_path_hint
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Reworked draw_path_hint

8 years agoFactored out a portion of game_redraw
Kevin Lyles [Tue, 26 May 2015 00:46:24 +0000 (19:46 -0500)]
Factored out a portion of game_redraw

8 years agoTowers: you can now mark clues done
Kevin Lyles [Wed, 13 May 2015 04:23:52 +0000 (23:23 -0500)]
Towers: you can now mark clues done

8 years agoSplit out the text color portion of draw_tile
Kevin Lyles [Sat, 16 May 2015 18:51:34 +0000 (13:51 -0500)]
Split out the text color portion of draw_tile

8 years agoCleaned up execute_move a little
Kevin Lyles [Sat, 16 May 2015 18:51:34 +0000 (13:51 -0500)]
Cleaned up execute_move a little

9 years agoAdd the 'make test' target to Makefile.am too.
Simon Tatham [Mon, 18 May 2015 15:41:06 +0000 (16:41 +0100)]
Add the 'make test' target to Makefile.am too.

Now I don't have to annoyingly switch over to the GTK makefile.

9 years agoAdd sorting-order buttons to the benchmark output.
Simon Tatham [Mon, 18 May 2015 15:39:12 +0000 (16:39 +0100)]
Add sorting-order buttons to the benchmark output.

Since I'm committed to HTML5ish Javascript already, that shouldn't be
too much of an inconvenience.

9 years agoMove the benchmarking logic out into a script.
Simon Tatham [Mon, 18 May 2015 15:17:49 +0000 (16:17 +0100)]
Move the benchmarking logic out into a script.

It's a pain having it in a rule in Makefile.gtk, which isn't even the
recommended makefile these days - it can't be re-run conveniently, and
there's no way to parametrise it. Now it can be run no matter which
makefile you're using, and it lets you narrow down to a subset of
games (though not presets). Other options could easily be added.

9 years agoHandle replacing an existing arrow
Kevin Lyles [Sun, 10 May 2015 00:16:24 +0000 (19:16 -0500)]
Handle replacing an existing arrow

9 years agoFix the extra arrow hanging around while moving the opposite existing arrow
Kevin Lyles [Sun, 10 May 2015 00:11:02 +0000 (19:11 -0500)]
Fix the extra arrow hanging around while moving the opposite existing arrow

9 years agoMark some arguments constant
Kevin Lyles [Sun, 10 May 2015 02:05:18 +0000 (21:05 -0500)]
Mark some arguments constant

9 years agoFix the issue with adding only one arrow when the other end was already white
Kevin Lyles [Sat, 9 May 2015 23:51:00 +0000 (18:51 -0500)]
Fix the issue with adding only one arrow when the other end was already white

9 years agoAdd/remove the opposite arrow when you let go
Kevin Lyles [Sun, 3 May 2015 15:46:07 +0000 (10:46 -0500)]
Add/remove the opposite arrow when you let go

9 years agoDraw the opposite arrow only while dragging
Kevin Lyles [Sun, 3 May 2015 15:46:07 +0000 (10:46 -0500)]
Draw the opposite arrow only while dragging

9 years agoMoved all function declarations to the top of the file
Kevin Lyles [Sat, 9 May 2015 23:51:00 +0000 (18:51 -0500)]
Moved all function declarations to the top of the file

9 years agoUse the game_state and space typedefs
Kevin Lyles [Sun, 10 May 2015 02:36:44 +0000 (21:36 -0500)]
Use the game_state and space typedefs

9 years agoAlways use ret instead of state in execute_move
Kevin Lyles [Sun, 3 May 2015 17:40:14 +0000 (12:40 -0500)]
Always use ret instead of state in execute_move

9 years agoFixed a typo in a comment
Kevin Lyles [Sun, 3 May 2015 17:40:14 +0000 (12:40 -0500)]
Fixed a typo in a comment

9 years agoSpecial-case right-dragging of a numbered cell off the grid.
Simon Tatham [Sat, 9 May 2015 14:35:10 +0000 (15:35 +0100)]
Special-case right-dragging of a numbered cell off the grid.

Chris Boyle reports that if you right-drag a numbered cell off the
grid, _all_ numbered cells (except the immutable initial clues) get
reset to blank, because this is treated as an attempt to erase a whole
chain of linked cells (of the form a,a+1,...,a_k) and the cells with
definite numbers are all treated as 'chain 0'.

In that situation, I now substitute the same behaviour you'd get by
left-dragging the numbered cell off the board, i.e. erase _just_ that
cell and not the whole of the rest of the puzzle.

(The previous unintended behaviour was a UI action you surely never
want - and Chris also reports that due to the Android front end's way
of representing right-drags, it's especially easy to hit by mistake.)

9 years agoSort out abs/fabs confusion.
Simon Tatham [Fri, 10 Apr 2015 06:55:16 +0000 (07:55 +0100)]
Sort out abs/fabs confusion.

My Mac has just upgraded itself to include a version of clang which
warns if you use abs() on a floating-point value, or fabs() on an
integer. Fixed the two occurrences that came up in this build (and
which were actual build failures, because of -Werror), one in each
direction.

I think both were benign. The potentially dangerous one was using abs
in place of fabs in grid_find_incentre(), because that could actually
lose precision, but I think that function had plenty of precision to
spare (grid point separation being of the order of tens of pixels) so
nothing should have gone seriously wrong with the old code.

9 years agoAdd Tracks to the automake makefile's "install" target.
Simon Tatham [Wed, 25 Mar 2015 18:23:39 +0000 (18:23 +0000)]
Add Tracks to the automake makefile's "install" target.

Each game's .R file should append the binary to $(GAMES) in both the
'am' and 'gtk' makefiles, but presumably due to copy-and-paste from an
out-of-date version, tracks.R only did 'gtk'.

Also clarified CHECKLST.txt in the hope that I won't miss that again.

9 years agoFix a compile warning on ARM.
Simon Tatham [Tue, 24 Mar 2015 19:20:03 +0000 (19:20 +0000)]
Fix a compile warning on ARM.

Aapo Rantalainen points out that comparing 'char c' against zero gives
rise to gcc's "comparison is always false" warning, which escalates to
an error under -Werror.

This is one of those situations where the warning is doing more harm
than good, but here's a rephrasing which casts to unsigned so that
both negative numbers and positive out-of-range ones can be caught by
the same comparison.

9 years agoUpdate README after the switch to autoconf.
Simon Tatham [Sun, 15 Mar 2015 08:50:53 +0000 (08:50 +0000)]
Update README after the switch to autoconf.

A user just pointed out that it still (and now falsely) claims that
mkfiles.pl directly generates a usable Unix Makefile.

9 years agoFix a build failure on x32 (time_t printfs).
Adam Borowski [Mon, 9 Mar 2015 06:58:10 +0000 (07:58 +0100)]
Fix a build failure on x32 (time_t printfs).

As that architecture has 64-bit time_t but only 32-bit longs, printf format
causes a warning.  Enter -Werror...

9 years agoTurn <image> tag into <img>.
Simon Tatham [Sun, 8 Feb 2015 22:52:20 +0000 (22:52 +0000)]
Turn <image> tag into <img>.

Not sure how I managed to write the former by mistake, but I didn't
notice because browsers didn't immediately complain. Still, James
Harvey points out, it ought to be turned into the actually
standards-compliant spelling of the tag. Ahem.

9 years agoNew puzzle from James Harvey: 'Tracks'.
Simon Tatham [Sun, 8 Feb 2015 16:23:32 +0000 (16:23 +0000)]
New puzzle from James Harvey: 'Tracks'.

9 years agoRemove a lingering bashism in makedist.sh.
Simon Tatham [Sat, 17 Jan 2015 08:49:28 +0000 (08:49 +0000)]
Remove a lingering bashism in makedist.sh.

A load of source files in the icons subdirectory were being left out
of the distribution tarball because I tried to include them using a
combined wildcard and bash brace expansion - but makedist cites
/bin/sh, so can't get away with bashisms. Expanded the braces.

9 years agoImprove the Flood solver.
Simon Tatham [Thu, 15 Jan 2015 20:21:05 +0000 (20:21 +0000)]
Improve the Flood solver.

Previously it simply chose every move based on the static evaluation
function 'minimise the pair (longest shortest-path to any square,
number of squares at that distance)'. Now it looks three moves ahead
recursively, and I've also adjusted the evaluation function to tie-
break based on the number of squares brought to distance zero (i.e.
actually in control).

The result isn't an unconditional improvement on the old solver; in a
test run based on 'flood --generate 1000 12x12c6m0#12345' I found that
57 out of 1000 grids tested now had longer solutions. However, about
three quarters had shorter ones, and solutions are more than a move
shorter on average.

9 years agoRemove some lingering HTML markup.
Simon Tatham [Tue, 13 Jan 2015 20:59:54 +0000 (20:59 +0000)]
Remove some lingering HTML markup.

It was getting conscientiously escaped by the new webpage.pl :-) but
in any case it's better to have the puzzle descriptions be plain text
usable in any context.

9 years agoAnd one more whitespace fix.
Simon Tatham [Tue, 13 Jan 2015 20:46:00 +0000 (20:46 +0000)]
And one more whitespace fix.

It's a pain having to commit each of these separately in order to test
the script, but there we go. Should be working now.

9 years agoCouple of fixes to the new web-page mechanism.
Simon Tatham [Tue, 13 Jan 2015 20:30:40 +0000 (20:30 +0000)]
Couple of fixes to the new web-page mechanism.

I missed some spaces in the autogenerated <span>s, and I generated the
web page components including unfinished puzzles by mistake.

9 years agoScript to autogenerate pieces of the web page.
Simon Tatham [Tue, 13 Jan 2015 20:04:18 +0000 (20:04 +0000)]
Script to autogenerate pieces of the web page.

This should simplify the process of adding a new puzzle, by automating
the part where I have to manually edit index.html separately from the
main build step.

9 years agoPut the game summaries from the website into gamedesc.txt.
Simon Tatham [Tue, 13 Jan 2015 19:54:46 +0000 (19:54 +0000)]
Put the game summaries from the website into gamedesc.txt.

More sensible to bring all the pieces of per-puzzle descriptive text
together into one place, so they can be easily reused everywhere
they're needed.

9 years agoRevise the Flood preset list.
Simon Tatham [Tue, 13 Jan 2015 19:31:29 +0000 (19:31 +0000)]
Revise the Flood preset list.

The ones I started with were a bit under-varied and over-orthogonal.
Get rid of some of the more pointless things like 16x16 with lots of
extra moves, and add some with different colour counts. While I'm
here, make the menu descriptions nicer.

9 years agoHandle the space bar in the Javascript front end.
Simon Tatham [Tue, 13 Jan 2015 19:19:05 +0000 (19:19 +0000)]
Handle the space bar in the Javascript front end.

I wasn't passing it through at all, causing CURSOR_SELECT2 dependent
keyboard UI not to be reachable.

9 years agoNew puzzle: 'Flood'.
Simon Tatham [Mon, 12 Jan 2015 19:51:19 +0000 (19:51 +0000)]
New puzzle: 'Flood'.

Based on a web game I saw a few years ago, and dashed off this weekend
after I thought of a way to write a good (though not quite optimal)
heuristic solver, here's a random little thing not quite in the same
line as the most usual kind of Puzzles fare: instead of making you
scratch your head to find any move to make at all, it's easy to find
solutions in principle, and the challenge comes from having to do so
within a move limit.

9 years agoUpdate the new-puzzle checklist for git.
Simon Tatham [Mon, 12 Jan 2015 19:44:31 +0000 (19:44 +0000)]
Update the new-puzzle checklist for git.

Replace references to svn:ignore and 'svn add' with the git
equivalents.

9 years agoAdd OS X metadata to make Puzzles.app searchable in Spotlight.
Simon Tatham [Thu, 8 Jan 2015 14:10:15 +0000 (14:10 +0000)]
Add OS X metadata to make Puzzles.app searchable in Spotlight.

Thanks to Stephen Norman for most of the work, particularly working
out what all the metadata had to be in the first place. This patch is
mostly his work, and all I've done is fiddle with the plumbing that
gets the right version number into the right places.

9 years agoFix puzzle window resize behaviour on Unity.
Simon Tatham [Sun, 4 Jan 2015 18:03:36 +0000 (18:03 +0000)]
Fix puzzle window resize behaviour on Unity.

Unity hijacks the menu bar and prevents it from appearing in the main
puzzle window. And we wait for the menu bar to appear before reducing
the puzzle drawing area's size request. These two behaviours go
together badly.

Fixed by detecting the extra GTK property that the Unity patches
invented, and using that to know whether to expect the menu bar to
show up at all.

9 years agoFix homology bug (!) in Net's loop highlighter.
Simon Tatham [Mon, 29 Dec 2014 10:11:47 +0000 (10:11 +0000)]
Fix homology bug (!) in Net's loop highlighter.

I unthinkingly transplanted into Net the same loop-finding algorithm
used in Loopy and Slant, which identifies the connected components
into which the grid lines divide the plane, and marks an edge as part
of a loop iff it separates two different components. This works fine
for a planar graph, but in Net's wrapping mode, it's possible to have
loops which do not have this property - e.g. a loop can go off the top
of the grid and back on the bottom to join up with itself, and then
it _doesn't_ disconnect the surface into two components.

(In principle, this kind of problem can turn up in any topological
space with a non-trivial H_1 homology group, which is why it fails on
the torus to which Net's wrapping mode corresponds, but not on the
plane or sphere. I think it's forgivable that I hadn't expected
homology to be the cause of any bug in practical code ever!)

Fixed by inventing yet another dsf-based loop-finding algorithm, this
one based on tracing round the outside of connected components of the
graph. It's still not _fully_ general, in that this one still depends
on the graph being drawn on an orientable surface (so it'll need
another rewrite if I ever add Mobius strip or Klein bottle modes for
Net...), but it's fairly simple to state and implement, and detects
loops that the previous implementation did not, such as the one in the
starting position of 3x3w:1a39ac6a8 .

9 years agoError-highlight loops in Net.
Simon Tatham [Sun, 28 Dec 2014 12:19:50 +0000 (12:19 +0000)]
Error-highlight loops in Net.

Loops are detected using the same dsf technique I ended up using in
Slant, and highlighted in red (whether or not the connected component
they belong to is currently powered).

Should make life a little bit easier for someone who's filled in most
of the grid to a nice uniform cyan and finds one piece left over - now
they have some idea where to start looking for their mistake.

We also take care not to generate any loops in the starting position,
on grounds of politeness (don't accuse the user of a mistake before
they've even had a chance to make one).

Loop detection does not contribute to the code that decides whether
the puzzle is complete, because there's no need - if all squares are
connected together, then there can't be any loops anyway, by graph
theory.

9 years agoPermit selecting a diagonal of squares at once in Group.
Simon Tatham [Thu, 18 Dec 2014 09:48:02 +0000 (09:48 +0000)]
Permit selecting a diagonal of squares at once in Group.

When filling in a cyclic subgroup or one of its cosets, I've often
found I wanted to set an entire diagonal to the same thing at once
(usually SW-NE, but the other way round too in non-abelian groups),
and it's a pain having to do that to each square individually.
Restricting multiple selection to diagonals makes it easy to get the
selection I really wanted.

9 years agoFix two compile warnings in emcc.c.
Simon Tatham [Sun, 30 Nov 2014 17:00:45 +0000 (17:00 +0000)]
Fix two compile warnings in emcc.c.

Reported by a user, who didn't say what version of Emscripten they
were using but it must not be the same as mine.