From 650a2214b6511c28d6b18bd182f676f49609cf76 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Wed, 7 Sep 2011 20:35:02 +0300 Subject: [PATCH] Highscore strored as milliseconds instead of seconds And shown as seconds with one decimal instead of minutes and whole seconds. "Tap to start the next level" text added. --- levelset.cpp | 4 ++-- seascene.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/levelset.cpp b/levelset.cpp index b470946..66e0bfe 100644 --- a/levelset.cpp +++ b/levelset.cpp @@ -64,7 +64,7 @@ int Levelset::getTotalHighScore() { QSettings settings; settings.beginGroup(name_); - return settings.value("TotalHighScore",900*100).toInt(); + return settings.value("TotalHighScore",900*1000*100).toInt(); } void Levelset::setTotalHighScore(int highscore) @@ -85,7 +85,7 @@ int Levelset::getLevelHighScore(int index) qDebug() << group; - return settings.value(QString(index),900).toInt(); + return settings.value(QString(index),900*1000).toInt(); } void Levelset::setLevelHighScore(int index, int highScore) diff --git a/seascene.cpp b/seascene.cpp index 62cb4d6..5adef14 100644 --- a/seascene.cpp +++ b/seascene.cpp @@ -632,7 +632,7 @@ void SeaScene::nextLevel() { //get score for previous level - int score = scoreCounter_.elapsed()/1000; + int score = scoreCounter_.elapsed(); totalScore_ += score; int highscore = levelset_.getLevelHighScore(currentLevel_); qDebug() << highscore; @@ -641,13 +641,13 @@ void SeaScene::nextLevel() if (score >= highscore) { - scoretext = tr("Your time: %1 min %2 s
Best time: %3 min %4 sec").arg(score/60).arg(score%60).arg(highscore/60).arg(highscore%60); + scoretext = tr("Your time: %1.%2 s
Best time: %3.%4 s

Tap to start the next level").arg(score/1000).arg((score%1000)/100).arg(highscore/1000).arg((highscore%1000)/100); } else //New high score! { - scoretext = tr("Your time %1 min %2 s is the new best time!").arg(score/60).arg(score%60); + scoretext = tr("Your time %1.%2 s is the new best time!
br> Tap to start the next level").arg(score/1000).arg((score%1000)/100); levelset_.setLevelHighScore(currentLevel_,score); } -- 1.7.9.5