simon-git: puzzles (main): Simon Tatham
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Tue May 25 11:11:21 BST 2021
TL;DR:
806e4e4 nestedvm.cmake: fix accidental use of dynamic scope.
b547021 GTK3: fix window redraw after copying to clipboard.
d5b5385 Permit building GUI helper tools.
12b64a1 Build a lot of conditioned-out test and helper programs.
8f3413c galaxieseditor: make 'copy to clipboard' give the game id.
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Simon Tatham <anakin at pobox.com>
Date: 2021-05-25 11:11:21
commit 806e4e4088be9f03da78aba8eb8cdda23d7c9cb6
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=806e4e4088be9f03da78aba8eb8cdda23d7c9cb6;hp=f729f51e475ff98d0caf529f0723ef810b1c88ef
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 23 10:38:32 2021 +0100
nestedvm.cmake: fix accidental use of dynamic scope.
In this platform's set_platform_puzzle_target_properties, I referred
to ${EXENAME} twice, which is not one of the function parameters. It
worked anyway, because CMake has dynamic scope, and that variable was
defined - to the right value - within the local-variable scope of the
calling function. But that wasn't at all what I meant to do!
Renamed it to ${TARGET}, which is the actual parameter name we get
passed.
cmake/platforms/nestedvm.cmake | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
commit b54702168b5c0759604302f198d85bc28af40feb
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=b54702168b5c0759604302f198d85bc28af40feb;hp=806e4e4088be9f03da78aba8eb8cdda23d7c9cb6
Author: Simon Tatham <anakin at pobox.com>
Date: Tue May 25 10:21:16 2021 +0100
GTK3: fix window redraw after copying to clipboard.
I just found out, in GTK3 under X11, that if you use the 'Copy' menu
item to copy a text representation of the game to the clipboard,
afterwards the puzzle window is no longer redrawn.
That was pretty mysterious, and I still don't _fully_ understand it.
But I think the main point is that when you set the GtkDrawingArea to
be the owner of an X11 selection, that requires it to have an X11
window of its own, where previously it was managing fine as a logical
subrectangle of its containing GtkWindow. And apparently switching
strategies half way through the run is confusing to GTK, and causes
redraws to silently stop working.
The easy workaround is to make fe->window rather than fe->area the
thing that owns GTK selections and receives the followup events. That
must already have an X window, so nothing has to be changed when we
make it a selection owner half way through the run.
gtk.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
commit d5b53853aad6c3bbfe255c063c045e7986de33ad
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=d5b53853aad6c3bbfe255c063c045e7986de33ad;hp=b54702168b5c0759604302f198d85bc28af40feb
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 23 10:01:06 2021 +0100
Permit building GUI helper tools.
These look like puzzles, in that they link against a frontend and
provide the usual 'struct game', but they don't count as a puzzle for
purposes of shipping, or even having to have descriptions and icons.
There's one of these buried in the code already under an ifdef, which
I'll re-enable in the next commit.
cmake/platforms/emscripten.cmake | 4 ++++
cmake/platforms/nestedvm.cmake | 5 ++++-
cmake/platforms/osx.cmake | 5 +++++
cmake/platforms/unix.cmake | 3 +++
cmake/platforms/windows.cmake | 5 ++++-
cmake/setup.cmake | 20 ++++++++++++++++++++
6 files changed, 40 insertions(+), 2 deletions(-)
commit 12b64a1db1a2cb94b938295875e5583237dbe168
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=12b64a1db1a2cb94b938295875e5583237dbe168;hp=d5b53853aad6c3bbfe255c063c045e7986de33ad
Author: Simon Tatham <anakin at pobox.com>
Date: Sun May 23 10:04:47 2021 +0100
Build a lot of conditioned-out test and helper programs.
Most of these aren't especially useful, but if we're going to have
them in the code base at all, we should at least ensure they compile:
bit-rotted conditioned-out code is of no value.
One of the new programs is 'galaxieseditor', which borrows most of the
Galaxies code but changes the UI so that you can create and remove
_dots_ instead of edges, and then run the solver to see whether it can
solve the puzzle you've designed. Unlike the rest, this is a GUI
helper tool, using the 'guiprogram' cmake function introduced in the
previous commit.
The programs are:
- 'combi', a test program for the utility module that generates all
combinations of n things
- 'divvy', a test program for the module that divides a rectangle at
random into equally-sized polyominoes
- 'penrose-test', a test program for the Penrose-tiling generator
used in Loopy, which outputs an SVG of a piece of tiling
- 'penrose-vector', a much smaller test program for the vector
arithmetic subroutines in that code
- 'sort-test', a test of this code base's local array sorting routine
- 'tree234-test', the exhaustive test code that's been in tree234.c
all along.
Not all of them compiled first time. Most of the fixes were the usual
kind of thing: fixing compiler warnings by removing unused
variables/functions, bringing uses of internal APIs up to date. A
notable one was that galaxieseditor's interpret_move() modified the
input game state, which was an error all along and is now detected by
me having made it a const pointer; I had to replace that with an extra
wrinkle in the move-string format, so that now execute_move() makes
the modification.
The one I'm _least_ proud of is squelching a huge number of
format-string warnings in tree234-test by interposing a variadic
function without __attribute__((printf)).
CMakeLists.txt | 8 +++++++
combi.c | 5 -----
divvy.c | 4 ++--
galaxies.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++---------
pearl.c | 2 +-
penrose.c | 2 +-
tree234.c | 35 ++++++++++++++++++++---------
7 files changed, 96 insertions(+), 31 deletions(-)
commit 8f3413c31ffd43c4ebde40894ac1b2f7cdf222c3
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=8f3413c31ffd43c4ebde40894ac1b2f7cdf222c3;hp=12b64a1db1a2cb94b938295875e5583237dbe168
Author: Simon Tatham <anakin at pobox.com>
Date: Tue May 25 10:44:08 2021 +0100
galaxieseditor: make 'copy to clipboard' give the game id.
This seems like a generally helpful design for game editors in
general: if we're going to have a helper program that can construct an
instance of a game, then one obvious thing you'd want as output from
it would be the descriptive game id, suitable for pasting back into
the playing UI.
So, in the just-re-enabled helper program 'galaxieseditor', I've
rewritten game_text_format so that it generates exactly that. Now you
can place dots until you have a puzzle you like, then use the 'Copy'
menu item to make it into a game id usable in 'galaxies' proper.
This doesn't set a precedent that I'm planning to _write_ editors for
all the other games, or even any of them (right now). For some, it
wouldn't be too hard (especially games where the solution and clues
are the same kind of thing, like default-mode Solo); for others, it
would be a huge UI nightmare.
galaxies.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
More information about the tartarus-commits
mailing list