ref: 3c6b77c93bc508a44a5726d660bbf7161bde9945
parent: 0e5380b96df67258ae2267eb9f65bd5e4bc06f27
author: Simon Tatham <anakin@pobox.com>
date: Mon May 30 14:24:06 EDT 2005
`Copy' operation for Mines. [originally from svn r5868]
--- a/mines.c
+++ b/mines.c
@@ -2174,7 +2174,30 @@
static char *game_text_format(game_state *state)
{
- return NULL;
+ char *ret;
+ int x, y;
+
+ ret = snewn((state->w + 1) * state->h + 1, char);
+ for (y = 0; y < state->h; y++) {
+ for (x = 0; x < state->w; x++) {
+ int v = state->grid[y*state->w+x];
+ if (v == 0)
+ v = '-';
+ else if (v >= 1 && v <= 8)
+ v = '0' + v;
+ else if (v == -1)
+ v = '*';
+ else if (v == -2 || v == -3)
+ v = '?';
+ else if (v >= 64)
+ v = '!';
+ ret[y * (state->w+1) + x] = v;
+ }
+ ret[y * (state->w+1) + state->w] = '\n';
+ }
+ ret[(state->w + 1) * state->h] = '\0';
+
+ return ret;
}
struct game_ui {
@@ -2728,7 +2751,7 @@
dup_game,
free_game,
FALSE, solve_game,
- FALSE, game_text_format,
+ TRUE, game_text_format,
new_ui,
free_ui,
make_move,