Codebase list brutalchess / c7612f3
Bill Allombert: Implement an undo feature to undo the last move. Closes: #845269 Thanks: Bill Allombert for the report and patch. Markus Koschany 5 years ago
2 changed file(s) with 36 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
55 06_gcc-4.7.patch
66 disable-quake-pieces.patch
77 use-pkg-config.patch
8 undo.patch
0 Index: brutalchess-0.5.2+dfsg/src/gamecore.cpp
1 ===================================================================
2 --- brutalchess-0.5.2+dfsg.orig/src/gamecore.cpp
3 +++ brutalchess-0.5.2+dfsg/src/gamecore.cpp
4 @@ -349,6 +349,14 @@ bool GameCore::handleEvent(SDL_Event& e)
5 m_menu.activate();
6 }
7 }
8 + if (e.key.keysym.sym == SDLK_BACKSPACE) {
9 + if(m_firstclick.isValid()) {
10 + SDL_SetCursor(m_defaultcur);
11 + m_set->deselectPosition();
12 + m_firstclick.invalidate();
13 + }
14 + m_game.undoMove();
15 + }
16 }
17 else if (e.type == SDL_USEREVENT) {
18 if(e.user.code == 0) {
19 Index: brutalchess-0.5.2+dfsg/src/chessgame.cpp
20 ===================================================================
21 --- brutalchess-0.5.2+dfsg.orig/src/chessgame.cpp
22 +++ brutalchess-0.5.2+dfsg/src/chessgame.cpp
23 @@ -80,9 +80,9 @@ void ChessGame::undoMove()
24 m_state = m_history_stack.top();
25 m_redo_stack.push(m_history_stack.top());
26 m_history_stack.pop();
27 + m_player1->undoMove();
28 + m_player2->undoMove();
29 }
30 - m_player1->undoMove();
31 - m_player2->undoMove();
32 }
33
34 // End of file chessgame.cpp