[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-games-devel
Subject:    Re: [Kde-games-devel] KScoreDialog
From:       Fela Winkelmolen <fela.kde () gmail ! com>
Date:       2008-04-28 15:34:12
Message-ID: 200804281734.12659.fela.kde () gmail ! com
[Download RAW message or body]

> 6. It looks like scores <= 0 aren't supported.

This should be fixed by the attached patch, I tested it a bit for regressions 
(both with kmines (less is more) and KBreakOut (negative Scores)) and it 
seems to work ok.
Let me know if it's ok to commit.. :)
Cheers,
- fela

["negativescore.diff" (text/x-diff)]

Index: libkdegames/highscore/kscoredialog.cpp
===================================================================
--- libkdegames/highscore/kscoredialog.cpp	(revision 802056)
+++ libkdegames/highscore/kscoredialog.cpp	(working copy)
@@ -437,15 +437,13 @@
     for(int i=0; i<d->scores[d->configGroup].size(); i++)
     {
         FieldInfo score = d->scores[d->configGroup].at(i); //First look at the score in the config file
-        bool ok;
+        bool ok; //will be false if there isn't any score yet in position i
         int num_score = score[Score].toLong(&ok); //test if the stored score is a number
-        if (lessIsMore && !ok)
-            num_score = 1 << 30; //this is a very large number so the score won't be on the table
         
         score = FieldInfo(newInfo); //now look at the submitted score
         int newScore = score[Score].toInt();
         if (((newScore > num_score) && !lessIsMore) ||
-              ((newScore < num_score) && lessIsMore))
+              ((newScore < num_score) && lessIsMore) || !ok)
         {
             
             d->latest = QPair<QString,int>(d->configGroup,i+1);


_______________________________________________
kde-games-devel mailing list
kde-games-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic