Summary: | KReversi: Switch sides and then Undo gets the program out of sync. | ||
---|---|---|---|
Product: | [Applications] kreversi | Reporter: | Inge Wallin <inge> |
Component: | general | Assignee: | Inge Wallin <inge> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Inge Wallin
2004-09-24 21:42:48 UTC
CVS commit by ingwa: Fix Bug 90190: KReversi: Switch sides and then Undo gets the program out of sync. - If it is the computers turn to move after an undo, call computerMakeMove(). - Fix repainting so that it looks nice. I will backport to KDE_3_3_BRANCH. CCMAIL: 90190-done@bugs.kde.org M +9 -1 ChangeLog 1.38 M +18 -1 board.cpp 1.48 --- kdegames/kreversi/ChangeLog #1.37:1.38 @@ -1,2 +1,10 @@ +2004-09-26 Inge Wallin <ingwa@c83-250-5-110.bredband.comhem.se> + + Fix Bug 90190: KReversi: Switch sides and then Undo gets the + program out of sync. + * board.cpp (doUndo): If it is the computers turn to move after an + undo, call computerMakeMove(). + (doUndo): Fix repainting so that it looks nice. + 2004-09-25 Inge Wallin <inge@lysator.liu.se> @@ -40,5 +48,5 @@ Tested Inges fix and found it works well. -2004-09-22 Inge Wallin <ing@lysator.liu.se> +2004-09-22 Inge Wallin <inge@lysator.liu.se> Fix bug 89829: "KReversi: When you save a game, the color for --- kdegames/kreversi/board.cpp #1.47:1.48 @@ -371,10 +371,27 @@ void Board::doUndo() return; + // Can't undo anything if no moves are made. + if (m_game->moveNumber() == 0) + return; + + // Get the color of the last move. Color last_color = m_game->lastMove().color(); + + // Undo all moves of the same color as the last one. while (m_game->moveNumber() != 0 && last_color == m_game->lastMove().color()) m_game->TakeBackMove(); + // Take back one move more. m_game->TakeBackMove(); + + + if (m_game->toMove() == computerColor()) { + // Must repaint so that the new move is not shown before the old + // one is removed on the screen. + repaint(); + computerMakeMove(); + } + else update(); } |