Package: brutalchess
Version: 0.5.2+dfsg-7
Severity: wishlist
Tags: patch

Dear Debian Games team,

I did not find a way to undo the last move, so I made this simple patch
that causes backspace to undo the last move. This makes this program
much more enjoyable.

Cheers,
-- 
Bill. <ballo...@debian.org>

Imagine a large red swirl here. 
Index: brutalchess-0.5.2+dfsg/src/gamecore.cpp
===================================================================
--- brutalchess-0.5.2+dfsg.orig/src/gamecore.cpp
+++ brutalchess-0.5.2+dfsg/src/gamecore.cpp
@@ -349,6 +349,14 @@ bool GameCore::handleEvent(SDL_Event& e)
                                        m_menu.activate();
                                }
                        }
+                       if (e.key.keysym.sym == SDLK_BACKSPACE) {
+                                       if(m_firstclick.isValid()) {
+                                               SDL_SetCursor(m_defaultcur);
+                                               m_set->deselectPosition();
+                                               m_firstclick.invalidate();
+                                       }
+                                       m_game.undoMove();
+                       }
        }
        else if (e.type == SDL_USEREVENT) {
                if(e.user.code == 0) {
Index: brutalchess-0.5.2+dfsg/src/chessgame.cpp
===================================================================
--- brutalchess-0.5.2+dfsg.orig/src/chessgame.cpp
+++ brutalchess-0.5.2+dfsg/src/chessgame.cpp
@@ -80,9 +80,9 @@ void ChessGame::undoMove()
                m_state = m_history_stack.top();
                m_redo_stack.push(m_history_stack.top());
                m_history_stack.pop();
+               m_player1->undoMove();
+               m_player2->undoMove();
        }
-       m_player1->undoMove();
-       m_player2->undoMove();
 }
 
 // End of file chessgame.cpp

Reply via email to