ref: 3107237af4aa82f538826e989ee7633e0a1ba22c
parent: 295fb9fd83512432404cd701c8b09bae4e627e20
author: Simon Tatham <anakin@pobox.com>
date: Sun Sep 18 03:43:19 EDT 2011
Remove the 'cheated' flag in Range's game_ui, which was stickily remembering whether the player had ever used the hint or solve functions, even if they then pressed undo (and even if they saved and restored). As far as Solve+Undo is concerned, this just brings Range into line with common practice in the rest of my puzzles. On the other hand, Range is the first time there's been a 'hint' function to consider in this question, so here's a policy decision: the victory flash is not a congratulation for a puzzle solved unaided, it's a confirmation that you really have reached a correct solution and haven't made any mistakes. So the only reason to omit the victory flash is if you've used the Solve operation to go straight to a guaranteed-correct solution _in a single move_; if you're using the hint button, there's still scope for you to make mistakes in all your non-hint moves, so the victory flash is still a useful indicator that you didn't. [originally from svn r9306]
--- a/range.c
+++ b/range.c
@@ -1206,7 +1206,6 @@
struct game_ui {
puzzle_size r, c; /* cursor position */
unsigned int cursor_show: 1;
- unsigned int cheated: 1;
};
static game_ui *new_ui(game_state *state)
@@ -1213,7 +1212,7 @@
{
struct game_ui *ui = snew(game_ui);
ui->r = ui->c = 0;
- ui->cursor_show = ui->cheated = FALSE;
+ ui->cursor_show = FALSE;
return ui;
}
@@ -1224,12 +1223,11 @@
static char *encode_ui(game_ui *ui)
{
- return dupstr(ui->cheated ? "1" : "0");
+ return NULL;
}
static void decode_ui(game_ui *ui, char *encoding)
{
- ui->cheated = (*encoding == '1');
}
typedef struct drawcell {
@@ -1330,7 +1328,14 @@
ret = nfmtstr(40, "%c,%d,%d",
buf->colour == M_BLACK ? 'B' : 'W',
buf->square.r, buf->square.c);
- ui->cheated = TRUE; /* you are being naughty ;-) */
+ /* We used to set a flag here in the game_ui indicating
+ * that the player had used the hint function. I (SGT)
+ * retired it, on grounds of consistency with other games
+ * (most of these games will still flash to indicate
+ * completion if you solved and undid it, so why not if
+ * you got a hint?) and because the flash is as much about
+ * checking you got it all right than about congratulating
+ * you on a job well done. */
}
sfree(buf);
return ret;
@@ -1466,7 +1471,6 @@
static void game_changed_state(game_ui *ui, game_state *oldstate,
game_state *newstate)
{
- if (newstate->has_cheated) ui->cheated = TRUE;
}
static float game_anim_length(game_state *oldstate, game_state *newstate,
@@ -1480,7 +1484,7 @@
static float game_flash_length(game_state *from, game_state *to,
int dir, game_ui *ui)
{
- if (!from->was_solved && to->was_solved && !ui->cheated)
+ if (!from->was_solved && to->was_solved && !to->has_cheated)
return FLASH_TIME;
return 0.0F;
}