[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdegames/kpat
From: Parker Coates <parker.coates () kdemail ! net>
Date: 2012-02-15 4:45:29
Message-ID: 20120215044529.B9425AC897 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1280174 by coates:
Only write the game-specific-state attribute when if changes.
This just produces shorter, more readable saves.
M +7 -2 dealer.cpp
--- trunk/KDE/kdegames/kpat/dealer.cpp #1280173:1280174
@@ -444,12 +444,17 @@
for ( int i = d->redoStack.size() - 1; i >= 0; --i )
allStates << d->redoStack.at( i );
+ QString lastGameSpecificState;
+
for ( int i = 0; i < allStates.size(); ++i )
{
const GameState * state = allStates.at( i );
xml.writeStartElement( "state" );
- if ( !state->stateData.isEmpty() )
+ if ( state->stateData != lastGameSpecificState )
+ {
xml.writeAttribute( "game-specific-state", state->stateData );
+ lastGameSpecificState = state->stateData;
+ }
if ( i == d->undoStack.size() )
xml.writeAttribute( "current", "true" );
@@ -503,7 +508,6 @@
}
d->gameNumber = readIntAttribute( xml, "deal-number" );
-
setGameOptions( xml.attributes().value( "game-type-options" ).toString() );
QMultiHash<quint32,KCard*> cardHash;
@@ -524,6 +528,7 @@
return false;
}
+ if ( xml.attributes().hasAttribute( "game-specific-state" ) )
setGameState( xml.attributes().value( "game-specific-state" ).toString() );
if ( undosToDo > -1 )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic