From a7431c0b7ce232f296ebcd70172ca64e58300105 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 6 Sep 2008 09:27:56 +0000 Subject: New infrastructure feature. Games are now permitted to be _conditionally_ able to format the current puzzle as text to be sent to the clipboard. For instance, if a game were to support playing on a square grid and on other kinds of grid such as hexagonal, then it might reasonably feel that only the former could be sensibly rendered in ASCII art; so it can now arrange for the "Copy" menu item to be greyed out depending on the game_params. To do this I've introduced a new backend function (can_format_as_text_now()), and renamed the existing static backend field "can_format_as_text" to "can_format_as_text_ever". The latter will cause compile errors for anyone maintaining a third-party front end; if any such person is reading this, I apologise to them for the inconvenience, but I did do it deliberately so that they'd know to update their front end. As yet, no checked-in game actually uses this feature; all current games can still either copy always or copy never. [originally from svn r8161] --- lightup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lightup.c') diff --git a/lightup.c b/lightup.c index 4f4f569..a601130 100644 --- a/lightup.c +++ b/lightup.c @@ -1705,6 +1705,11 @@ done: return move; } +static int game_can_format_as_text_now(game_params *params) +{ + return TRUE; +} + /* 'borrowed' from slant.c, mainly. I could have printed it one * character per cell (like debug_state) but that comes out tiny. * 'L' is used for 'light here' because 'O' looks too much like '0' @@ -2240,7 +2245,7 @@ const struct game thegame = { dup_game, free_game, TRUE, solve_game, - TRUE, game_text_format, + TRUE, game_can_format_as_text_now, game_text_format, new_ui, free_ui, encode_ui, -- cgit v1.1