Let's show the actual positions of the pieces.
Note I couldn't figure out how to use markup here. Enabling it in the
GtkCellRenderer didn't seem to work.
This reverts 73a3af2e. There's no longer any need to use a short
message, since we will now always put it in the info bar.
Let's also italicize the text, as is appropriate. Sadly this means
translators will have to work with markup, because they may need to
remove the markup, or reorder the string, so it requires violating the
normal guidance to avoid markup in translatable strings. That's probably
fine; we should avoid it wherever possible, but not when it's really
needed.
...and always use the info bar instead, even when the screen is not
narrow.
The header bar subtitle will now exclusively be used to indicate the
current filename.
This simplifies the code, and avoids many strange bugs. As long as the
title is short, we can use it even in narrow mode. But the status that
we previously put into the subtitle is just too large, so it will need
the info bar. Extra status is rare, so it's OK to use the info bar even
in normal mode: it doesn't look good to have it up constantly, but it's
only used when an engine is not installed, or the game has ended, or an
en passant capture is performed, so it should be OK.
This fixes the subtitle getting messed up after using Undo when a game
has finished, but it also avoids strange state differences between
narrow and normal mode, and the complexity of switching between the two.
This will allow the user to decide whether or not to open the file
chooser. Surprisingly, the code for both of these still exists -- it was
already possible to choose between them using keyboard shortcuts -- so
all we need to do is edit the menu.
We currently give the engine 10 seconds to move, and end the game with
an engine error if it takes longer than that, to avoid the game stalling
forever if the engine breaks. But we use the chess clock to run this
check, meaning it doesn't work in untimed games. And games are untimed
by default. Oops.
Fix it by not relying on the chess clock.
Fixes#54
If we are sandboxed, then any files we save are going to be located
under /run inside the sandbox. But that's not where they are on the host
system, so we should try to avoid exposing this to the user. Sad reality
is that there is no way we can know where the file really exists on the
host, so let's just not preselect the file's location in this case.
Fixes#53
This never looks good in narrow mode, so if we are in narrow mode, never
set the window subtitle.
But if we start in normal mode, then the user switches to narrow mode,
it looks weird for the subtitle to disappear and not come back. So let's
maintain it as the window subtitle. It should definitely not move to the
info bar, like other subtitles, since that looks weird.
The main header bar doesn't have enough space to show messages when the
screen is narrow. So when running in mobile mode, let's add an info bar.
This looks better than my first attempt, 0e8090dcd1.
This reverts commit 2345085d92.
I'm going to try using an info bar instead. It's less obnoxious, and is
useful to avoid ellipsizing the window title even at larger window
sizes.
If the user has resigned, the engine doesn't know the game is over,
because we don't tell it. So if the user resigns immediately after
moving, and the engine has not moved yet, we need to ignore it when it
does.
Fixes#49
When we replay the engine's move later, we should make sure we are still
playing the same game AND that the state of the game is still the same.
Otherwise, discard the engine's move. The user has done something to
advance the state of the game beyond what the engine knows about, so
it's totally expected that the engine's move may no longer apply.
The state of the game ought to always be the same as it was before. Add
an assert just to be sure.
Halfway fixes#49
When the game is stalemated, the chess engine will declare a draw. We
then check if it can claim a draw, and if not, declare that the game has
ended due to an engine bug. Since stalemate is not a valid reason to
claim a draw -- it is a forced draw, not a claimable draw -- this means
we incorrectly claim the engine is broken.
Stalemate requires special handling.
I tried 400 first, but then it's no longer possible to smoothly switch
between narrow and desktop mode. 500 is a bit too big to transition into
the clunky inner headerbar, so let's try 450.
The main headerbar doesn't have enough space to show messages when the
screen is narrow. So when running in mobile mode, let's add a secondary
headerbar.
This is not likely to have a very strong effect, but it's the best we
can do short of writing an entirely new chess engine. The HoiChess
engine seems to be notably easier than other engines, so currently that
seems like the best choice to distribute with GNOME Chess.
Fixes#18, at least sort of.
If we've repeated the same move enough times, we display the claim draw
dialog immediately before ending the game due to the forced draw. This
is wrong: the game is already over, but the user is still prompted to
decide whether to claim draw or not! That's no good.
Way back in 4cabc41085, I thought it was
important to allow users to claim a draw at any point in the future
after a threefold repetition. But this is not what the laws of chess
allow: it should be claimed when it happens, not at random points in the
future. At the time, that change probably made sense because we didn't
tell the user when it's possible to claim a draw, which nowadays we do
by opening a message dialog. But nowadays, it has no benefit, and a
large cost: the message dialog appears at the start of every turn,
forevermore, getting in the way and irritating the user. So let's only
show it if the current board state really is eligible for a draw.
Fixes#47
Fixes:
0 _g_log_abort (breakpoint=1) at ../../../../Projects/glib/glib/gmessages.c:559
1 0x00007f4cae0bf45e in g_logv (log_domain=0x7f4cae122b50 "GLib", log_level=G_LOG_LEVEL_CRITICAL,
format=0x7f4cae122fc0 "Source ID %u was not found when attempting to remove it", args=0x7ffdd5eff9b8)
at ../../../../Projects/glib/glib/gmessages.c:1405
2 0x00007f4cae0bf54f in g_log (log_domain=0x7f4cae122b50 "GLib", log_level=G_LOG_LEVEL_CRITICAL,
format=0x7f4cae122fc0 "Source ID %u was not found when attempting to remove it")
at ../../../../Projects/glib/glib/gmessages.c:1447
3 0x00007f4cae0b4524 in g_source_remove (tag=2921) at ../../../../Projects/glib/glib/gmain.c:2499
4 0x000000000041958e in chess_scene_set_game (self=0x25a0150, value=0x27024e0)
at ../../../../Projects/gnome-chess/src/chess-scene.vala:97
5 0x0000000000423db6 in chess_application_start_game (self=0x22b2320)
at ../../../../Projects/gnome-chess/src/gnome-chess.vala:520
6 0x00000000004341f0 in chess_application_start_new_game (self=0x22b2320)
at ../../../../Projects/gnome-chess/src/gnome-chess.vala:2464
7 0x000000000042afac in chess_application_new_game_cb (self=0x22b2320)
at ../../../../Projects/gnome-chess/src/gnome-chess.vala:1519