Bug#845269: patch to make backspace to 'undo' last move

2018-10-24 Thread Bill Allombert
On Sat, Oct 20, 2018 at 07:17:16PM +0200, Markus Koschany wrote:
> Hi Bill,
> 
> > that causes backspace to undo the last move. This makes this program
> > much more enjoyable.
> 
> I just tried your "undo" patch for brutalchess. I don't think it is
> complete yet. I have to press backspace twice to undo a move. But if
> this is done, I can't play another move with the same player. In case
> the second player is the computer, no other moves are possible then.

Thanks to have taken the time to try my patch.
As you can see it only add a keystroke for a feature that was already
in the original code (unlimited undo).

I agree the behavior is a bit odd (you have to press backspace 3 times
to undo a move) but I am used to it so "it works for me" :)
The only serious bug is if you try to undo the first move, then it
freezes.

I will look whether I can improve it.

Cheers
-- 
Bill. 

Imagine a large red swirl here. 



Bug#845269: patch to make backspace to 'undo' last move

2018-10-20 Thread Markus Koschany
Hi Bill,

On Mon, 21 Nov 2016 23:51:54 +0100 Bill Allombert 
wrote:
> 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.

I just tried your "undo" patch for brutalchess. I don't think it is
complete yet. I have to press backspace twice to undo a move. But if
this is done, I can't play another move with the same player. In case
the second player is the computer, no other moves are possible then.

To make this really a new feature, a patch to implement "undo" should
make sure that continuing the game is possible. Implementing unlimited
undo would be the next step but can be tracked in another wishlist bug
report.

Regards,

Markus



signature.asc
Description: OpenPGP digital signature


Bug#845269: patch to make backspace to 'undo' last move

2016-11-21 Thread Bill Allombert
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. 

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