[Kde-games-devel] Bugfix for KDiamond

Stefan Majewsky majewsky at gmx.net
Sat Aug 9 12:31:15 CEST 2008


Am Freitag 08 August 2008 17:50:22 schrieb Paul B:
> I have here a patch to fix two bugs in KDiamond I came across.

Thank you for your engagement even to test my messy intermediate code. 
Attached is a revision of your patch which adapts KDiamond's coding style, and 
addresses some flaws of your initial version. Please do not understand my 
review as an embarassement, but as an encouragement to send in further 
patches. 

> The first bug was that after completing a game it was not possible to play
> another game without restarting the application because the update timer
> would be stopped at the end of each game but not started again when a new
> game was started, this was fixed by starting the update timers in
> MainWindow::startNewGame() instead of MainWindow::MainWindow().

Good observation. I moved the QObject::connect and further one-time 
initialisation back to the MainWindow constructor.

> Second bug was that when playing an untimed game the game would end on
> your first move after 200 seconds were up. This happens when
> KDiamond::GameState::addPoints() is called and it calls update(true), which
> forces recalculation of the time even if you're playing an untimed game,
> and it doesn't check whether the game is untimed before ending it based on
> the time.

(m_state == Untimed) was already checked earlier in GameState::update(bool), 
but this was combined with the forceRecalculation switch, which is false. I 
corrected that.

> In addition to fixing these it also changes it so that "Untimed Game" is
> displayed in the statusbar instead of "Time Remaining: %1 seconds" if
> you're playing an untimed game.

Agreed.

Stefan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdiamond-fixes.patch
Type: text/x-patch
Size: 2688 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080809/5a8b06f5/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-games-devel/attachments/20080809/5a8b06f5/attachment.pgp 


More information about the kde-games-devel mailing list