summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2010-02-15 20:56:49 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2010-02-15 20:56:49 (GMT)
commit0c0cde558139d12531c4b1e820622bcb81b8eaa5 (patch)
treeed4654bccee6429e8748c900396c0ca1e9f9af0b
parent05a6b6b5f4ddc2769c31f2358ec88792a158dfe5 (diff)
downloadQt-0c0cde558139d12531c4b1e820622bcb81b8eaa5.zip
Qt-0c0cde558139d12531c4b1e820622bcb81b8eaa5.tar.gz
Qt-0c0cde558139d12531c4b1e820622bcb81b8eaa5.tar.bz2
Fix SameGame high scores
When it's deployed across multiple devices, there is no 'standard' grid size. This allows non-desktop versions to display high scores.
-rwxr-xr-xdemos/declarative/samegame/content/samegame.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js
index 41ed84c..c0f10bd 100755
--- a/demos/declarative/samegame/content/samegame.js
+++ b/demos/declarative/samegame/content/samegame.js
@@ -222,8 +222,9 @@ function saveHighScore(name) {
tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)');
tx.executeSql(dataStr, data);
- var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "12x17" ORDER BY score desc LIMIT 10');
- var r = "\nHIGH SCORES for a standard sized grid\n\n"
+ //Only show results for the current grid size
+ var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxX+"x"+maxY+'" ORDER BY score desc LIMIT 10');
+ var r = "\nHIGH SCORES for this grid size\n\n"
for(var i = 0; i < rs.rows.length; i++){
r += (i+1)+". " + rs.rows.item(i).name +' got '
+ rs.rows.item(i).score + ' points in '