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

List:       kde-commits
Subject:    kdegames/kpat
From:       Stephan Kulow <coolo () kde ! org>
Date:       2005-03-06 21:14:24
Message-ID: 20050306211424.A1C3BE772 () office ! kde ! org
[Download RAW message or body]

CVS commit by coolo: 

high severity bug


  M +50 -40    fortyeight.cpp   1.20


--- kdegames/kpat/fortyeight.cpp  #1.19:1.20
@@ -135,5 +135,6 @@ void Fortyeight::setGameState( const QSt
 }
 
-bool Fortyeight::isGameLost() const{
+bool Fortyeight::isGameLost() const
+{
    kdDebug(11111) << "isGameLost ?" << endl;
    if(!lastdeal)
@@ -143,5 +144,6 @@ bool Fortyeight::isGameLost() const{
 
    Card *c;
-   for(int i=0; i < 8; i++){
+    for(int i=0; i < 8; i++)
+    {
         if(stack[i]->isEmpty())
                 return false;
@@ -150,8 +153,15 @@ bool Fortyeight::isGameLost() const{
         if(c->value() == Card::Ace)
                 return false;
-        if(!pile->isEmpty())
+
+        if(!pile->isEmpty()) {
                 if(pile->top()->suit() == c->suit() &&
                         pile->top()->value()+1 == c->value())
                         return false;
+
+            if ( !target[i]->isEmpty() &&
+                 pile->top()->suit() == target[i]->top()->suit() &&
+                 pile->top()->value() == target[i]->top()->value()+1)
+                return false;
+        }
         for(int j=0; j <8;j++){
                 if(target[j]->isEmpty())
@@ -161,5 +171,5 @@ bool Fortyeight::isGameLost() const{
                         return false;
                 }
-        for(int j=1; j < 8; j++){
+        for(int j=1; j < 8; j++) {
                 int k=(i+j) % 8;
                 if (stack[k]->isEmpty())


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

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