GNOME Bugzilla – Bug 733708
“undo” button clickable after the first move
Last modified: 2014-08-13 01:55:31 UTC
The “undo” button puts Iagno in a weird state when clicked at the beginning of a computer-plays-first game (after the first computer’s move), or after the first move of a two-players game: it’s neither possible to play, nor to start a new game… (both with the app’menu entry and the “start other” button, they are grayed.) The logical solution for the computer-plays-first case is to have the “undo” button grayed until the human player’s first move (and when undoing his second move, etc.); for the two-players case, it would probably be good that “undo” just undoes one of the move (the last one, darks’ move OR lights’ move). /!\ WARNING: the state of the org.gnome.iagno “play-as” gsetting could be changed during the game, don’t rely on it to know the type of the actual game.
If you move it will crash -> critical I probably won't get to this until late next week, if you want to work on a patch in the meantime.
Backtrace at the downstream report
Created attachment 281923 [details] [review] Make "undo" button unclickable before player's first move. That works, but I don’t know why. /o\ If someone understand the "4" thing…
(In reply to comment #3) > That works, but I don’t know why. /o\ If someone understand the "4" thing… Intuitively, you'd think each ply (one player's turn) takes up one space in the undo history, but actually it's each individual tile flip. Since exactly one enemy tile is flipped during the first ply, undo_index will always be 3 at the start of the second ply.
Created attachment 282410 [details] [review] Disallow undo if only computer has moved What do you think of this approach? It's pretty similar to what you did.
(In reply to comment #4) > Since exactly one > enemy tile is flipped during the first ply, undo_index will always be 3 at the > start of the second ply. Well, that's not much of an explanation, but I checked and it's always true. :)
Pushing my patch; thanks for your help on this one! Attachment 282410 [details] pushed as 9aaac95 - Disallow undo if only computer has moved