[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames/kpat
From: Parker Coates <parker.coates () gmail ! com>
Date: 2009-03-31 3:25:26
Message-ID: 1238469926.873815.10761.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 947129 by coates:
Fixed a bug where abandonning a game after saving it would result in a loss, which is \
probably not what the user expected. Now the game will not be recorded as a loss, \
provided that zero moves have been made since the last save.
M +15 -1 dealer.cpp
M +1 -0 dealer.h
M +1 -0 pwidget.cpp
--- trunk/KDE/kdegames/kpat/dealer.cpp #947128:947129
@@ -186,6 +186,7 @@
quint32 _id;
bool _gameRecorded;
bool gameStarted;
+ bool wasJustSaved;
QGraphicsPixmapItem *wonItem;
bool gothelp;
bool toldAboutLostGame;
@@ -272,6 +273,7 @@
if (n) {
d->initialDeal = false;
+ d->wasJustSaved = false;
if (isGameWon()) {
won();
d->toldAboutWonGame = true;
@@ -354,6 +356,8 @@
}
}
+ d->wasJustSaved = true;
+
/*
QDomElement eList = doc.createElement("undo");
@@ -521,6 +525,7 @@
d->_won = false;
d->_gameRecorded = false;
d->gameStarted = false;
+ d->wasJustSaved = false;
d->wonItem = 0;
d->gothelp = false;
d->myActions = 0;
@@ -887,6 +892,7 @@
d->redoList.clear();
d->toldAboutLostGame = false;
d->toldAboutWonGame = false;
+ d->wasJustSaved = false;
d->loadedMoveCount = 0;
emit updateMoves();
@@ -1853,9 +1859,17 @@
return d->gameStarted;
}
+bool DealerScene::wasJustSaved() const
+{
+ return d->wasJustSaved;
+}
+
void DealerScene::recordGameStatistics()
{
- if ( d->gameStarted && !d->_gameRecorded )
+ // Don't record the game if it was never started, if it is unchanged since
+ // it was last saved (allowing the user to close KPat after saving without
+ // it recording a loss) or if it has already been recorded.
+ if ( d->gameStarted && !d->wasJustSaved && !d->_gameRecorded )
{
QString totalPlayedKey = QString("total%1").arg( d->_id );
QString wonKey = QString("won%1").arg( d->_id );
--- trunk/KDE/kdegames/kpat/dealer.h #947128:947129
@@ -171,6 +171,7 @@
bool isInitialDeal() const;
bool hasBeenStarted() const;
+ bool wasJustSaved() const;
void recordGameStatistics();
bool cardsAreMoving() const { return !movingCards.empty(); }
--- trunk/KDE/kdegames/kpat/pwidget.cpp #947128:947129
@@ -307,6 +307,7 @@
// then ask if she wants to abort it.
return !m_dealer
|| !m_dealer->hasBeenStarted()
+ || m_dealer->wasJustSaved()
|| m_dealer->isGameWon()
|| m_dealer->isGameLost()
|| KMessageBox::warningContinueCancel(0,
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic