[Picross-commit] SF.net SVN: picross:[96] trunk
Status: Pre-Alpha
Brought to you by:
yvan_norsa
From: <yva...@us...> - 2011-06-29 13:57:23
|
Revision: 96 http://picross.svn.sourceforge.net/picross/?rev=96&view=rev Author: yvan_norsa Date: 2011-06-29 13:57:17 +0000 (Wed, 29 Jun 2011) Log Message: ----------- fixed bugs due to reorg Modified Paths: -------------- trunk/src/picross/grid/GridModel.java trunk/src/picross/grid/ui/GridMediator.java trunk/test/picross/grid/GridModelTest.java Modified: trunk/src/picross/grid/GridModel.java =================================================================== --- trunk/src/picross/grid/GridModel.java 2011-06-29 13:07:46 UTC (rev 95) +++ trunk/src/picross/grid/GridModel.java 2011-06-29 13:57:17 UTC (rev 96) @@ -394,9 +394,9 @@ return; } - GridModel.log.debug("checkBox(" + row + ", " + column + ")"); - GridModel.log.debug("lastModified == null : " - + (lastModified == null)); + //GridModel.log.debug("checkBox(" + row + ", " + column + ")"); + //GridModel.log.debug("lastModified == null : " + // + (lastModified == null)); /* * If we are trying to check the last box we just checked @@ -471,15 +471,24 @@ this.lastModified = this.boxes[column][row]; this.checkColumn(column); this.checkRow(row); - this.checkCompleted(); + //this.checkCompleted(); } + private boolean erase; + /** Enables the erase mode. */ private void setEraseMode() { // FIXME //this.mediator.setEraseMode(); + this.erase = true; } + public boolean getEraseMode() { + boolean result = this.erase; + this.erase = false; + return result; + } + /** * Checks if a row is empty. * @@ -657,7 +666,7 @@ * @param column column number to check */ private void checkColumn(int column) { - GridModel.log.debug("checkColumn(" + column + ")"); + //GridModel.log.debug("checkColumn(" + column + ")"); if (this.emptyCol(column)) { this.completedHints.setCompleteCol(column); @@ -807,7 +816,7 @@ } /** Checks wether the grid is finished. */ - private void checkCompleted() { + public boolean checkCompleted() { boolean completed = true; for (int i = 0; i < this.data.length; i++) { @@ -823,10 +832,11 @@ } } - if (completed) { + //if (completed) { // FIXME //this.mediator.congratulations(); - } + //} + return completed; } /** Indicates the current action has come to an end. */ Modified: trunk/src/picross/grid/ui/GridMediator.java =================================================================== --- trunk/src/picross/grid/ui/GridMediator.java 2011-06-29 13:07:46 UTC (rev 95) +++ trunk/src/picross/grid/ui/GridMediator.java 2011-06-29 13:57:17 UTC (rev 96) @@ -150,7 +150,17 @@ // TODO what now ? check the model'state this.view.updateBox(col, row, this.model.getBoxes()[col][row]); this.repaint(row, col); + this.repaintRowHints(row); + this.repaintColHints(col); + if (this.model.checkCompleted()) { + this.congratulations(); + } else { + if (this.model.getEraseMode()) { + this.setEraseMode(); + } + } + return; } Modified: trunk/test/picross/grid/GridModelTest.java =================================================================== --- trunk/test/picross/grid/GridModelTest.java 2011-06-29 13:07:46 UTC (rev 95) +++ trunk/test/picross/grid/GridModelTest.java 2011-06-29 13:57:17 UTC (rev 96) @@ -332,8 +332,9 @@ gridModel.actOnBox(11, 10, GridAction.CHECK); gridModel.actOnBox(11, 11, GridAction.CHECK); -//CompletedHints completedHints = gridModel.getCompletedHints(); -//Assert.assertFalse(completedHints.isRowHintComplete(5, 2)); + //CompletedHints completedHints = gridModel.getCompletedHints(); + int rowData = gridModel.getRowData(); + Assert.assertFalse(completedHints.isRowHintComplete(5, 2)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |