[Picross-commit] SF.net SVN: picross: [16] trunk/src/picross/grid/PicrossGridModel.java
Status: Pre-Alpha
                
                Brought to you by:
                
                    yvan_norsa
                    
                
            | 
     
      
      
      From: <yva...@us...> - 2007-06-06 15:02:51
      
     
   | 
Revision: 16
          http://picross.svn.sourceforge.net/picross/?rev=16&view=rev
Author:   yvan_norsa
Date:     2007-06-06 07:57:34 -0700 (Wed, 06 Jun 2007)
Log Message:
-----------
fixed the victory conditions
Modified Paths:
--------------
    trunk/src/picross/grid/PicrossGridModel.java
Modified: trunk/src/picross/grid/PicrossGridModel.java
===================================================================
--- trunk/src/picross/grid/PicrossGridModel.java	2007-06-06 14:26:30 UTC (rev 15)
+++ trunk/src/picross/grid/PicrossGridModel.java	2007-06-06 14:57:34 UTC (rev 16)
@@ -264,7 +264,6 @@
 
             if (type == PicrossGridController.CHECK_ACTION) {
                 this.boxes[row][column].check();
-                this.checkCompleted();
             } else { //if (type == PicrossGridController.CROSS_ACTION) {
                 this.boxes[row][column].cross();
             }
@@ -297,12 +296,12 @@
                     this.boxes[row][column].check();
                     this.mediator.check(row, column,
                                         PicrossGridController.CHECK_ACTION);
-                    this.checkCompleted();
                 }
             }
         }
 
         this.lastModified = this.boxes[row][column];
+        this.checkCompleted();
     }
 
     /** Checks wether the grid is finished. */
@@ -311,7 +310,11 @@
 
         for (int i = 0; i < this.data.length; i++) {
             for (int j = 0; j < this.data[i].length; j++) {
-                if (this.data[i][j] && !this.boxes[i][j].isChecked()) {
+                boolean isCurrentBoxChecked = this.boxes[i][j].isChecked();
+
+                if ((this.data[i][j] && !isCurrentBoxChecked)
+                    || (!this.data[i][j] && isCurrentBoxChecked)) {
+
                     completed = false;
                     break;
                 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |