summaryrefslogtreecommitdiffstats
path: root/demos/declarative/snake/content
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-06-08 10:00:17 (GMT)
committermae <qt-info@nokia.com>2010-06-08 10:00:17 (GMT)
commite5567b2e0513f5a03987f78df2d565c0e6c6a951 (patch)
treebfd19f1520fa6cf256a84f9c8a1e7df19a5ab1da /demos/declarative/snake/content
parent9623b49fd3055ede03569e6e9a46a4237f6e119f (diff)
downloadQt-e5567b2e0513f5a03987f78df2d565c0e6c6a951.zip
Qt-e5567b2e0513f5a03987f78df2d565c0e6c6a951.tar.gz
Qt-e5567b2e0513f5a03987f78df2d565c0e6c6a951.tar.bz2
Fix snake demo
Code degeneration lead to three bugs: 1. progress bar worked only the first time 2. restart was broken 3. highscore model was not persistent Reviewed-by: Trust me
Diffstat (limited to 'demos/declarative/snake/content')
-rw-r--r--demos/declarative/snake/content/HighScoreModel.qml2
-rw-r--r--demos/declarative/snake/content/snake.js1
2 files changed, 2 insertions, 1 deletions
diff --git a/demos/declarative/snake/content/HighScoreModel.qml b/demos/declarative/snake/content/HighScoreModel.qml
index 99799c8..42482f8 100644
--- a/demos/declarative/snake/content/HighScoreModel.qml
+++ b/demos/declarative/snake/content/HighScoreModel.qml
@@ -106,7 +106,7 @@ ListModel {
}
if (rs.rows.length > maxScores)
tx.executeSql("DELETE FROM HighScores WHERE game=? AND score <= ?",
- [rs.rows.item(maxScores).score]);
+ [game, rs.rows.item(maxScores).score]);
}
}
)
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 6f78b33..4d05e33 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -37,6 +37,7 @@ function startNewGame()
startNewGameTimer.running = true;
return;
}
+
numRows = numRowsAvailable;
numColumns = numColumnsAvailable;
board = new Array(numRows * numColumns);