* Put the spots in the right place in 13x13 and 19x19 boards.
* Fixed some front/back layering issues in Grid.
1.1 --- a/Source/BoardView.m Thu Jul 31 13:23:44 2008 -0700
1.2 +++ b/Source/BoardView.m Thu Jul 31 20:01:26 2008 -0700
1.3 @@ -113,6 +113,7 @@
1.4 _table.autoresizingMask = kCALayerMinXMargin | kCALayerMaxXMargin | kCALayerMinYMargin | kCALayerMaxYMargin;
1.5
1.6 // Tell the game to set up the board:
1.7 + _game.tablePerspectiveAngle = _perspective;
1.8 _game.table = _table;
1.9
1.10 [self.layer addSublayer: _table];
2.1 --- a/Source/GoGame.m Thu Jul 31 13:23:44 2008 -0700
2.2 +++ b/Source/GoGame.m Thu Jul 31 20:01:26 2008 -0700
2.3 @@ -34,6 +34,14 @@
2.4
2.5 + (int) dimensions {return 19;}
2.6
2.7 ++ (const GridCoord*) spotCoords
2.8 +{
2.9 + static GridCoord const sSpots[10]={ { 3,3}, { 3,9}, { 3,15},
2.10 + { 9,3}, { 9,9}, { 9,15},
2.11 + {15,3}, {15,9}, {15,15}, {NSNotFound,NSNotFound} };
2.12 + return sSpots;
2.13 +}
2.14 +
2.15 - (id) init
2.16 {
2.17 self = [super init];
2.18 @@ -63,12 +71,11 @@
2.19 */
2.20 board.lineColor = kTranslucentGrayColor;
2.21 board.cellClass = [GoSquare class];
2.22 + board.usesDiagonals = board.allowsMoves = board.allowsCaptures = NO;
2.23 [board addAllCells];
2.24 - ((GoSquare*)[board cellAtRow: 2 column: 2]).dotted = YES;
2.25 - ((GoSquare*)[board cellAtRow: 6 column: 6]).dotted = YES;
2.26 - ((GoSquare*)[board cellAtRow: 2 column: 6]).dotted = YES;
2.27 - ((GoSquare*)[board cellAtRow: 6 column: 2]).dotted = YES;
2.28 - board.usesDiagonals = board.allowsMoves = board.allowsCaptures = NO;
2.29 + const GridCoord *spots = [[self class] spotCoords];
2.30 + for( int i=0; spots[i].row!=NSNotFound; i++ )
2.31 + ((GoSquare*)[board cellAtRow: spots[i].row column: spots[i].col]).dotted = YES;
2.32 [_table addSublayer: board];
2.33 [board release];
2.34
2.35 @@ -261,10 +268,21 @@
2.36 @implementation Go9Game
2.37 + (NSString*) displayName {return @"Go (9x9)";}
2.38 + (int) dimensions {return 9;}
2.39 ++ (const GridCoord*) spotCoords
2.40 +{
2.41 + static GridCoord const sSpots[6]= { {2,2}, {2,6}, {4,4}, {6,2}, {6,6}, {NSNotFound,NSNotFound} };
2.42 + return sSpots;
2.43 +}
2.44 @end
2.45
2.46
2.47 @implementation Go13Game
2.48 + (NSString*) displayName {return @"Go (13x13)";}
2.49 + (int) dimensions {return 13;}
2.50 ++ (const GridCoord*) spotCoords
2.51 +{
2.52 + static GridCoord const sSpots[6] = { { 2,2}, { 2,10}, {6,6},
2.53 + {10,2}, {10,10}, {NSNotFound,NSNotFound} };
2.54 + return sSpots;
2.55 +}
2.56 @end
3.1 --- a/Source/Grid.h Thu Jul 31 13:23:44 2008 -0700
3.2 +++ b/Source/Grid.h Thu Jul 31 20:01:26 2008 -0700
3.3 @@ -24,6 +24,11 @@
3.4 @class GridCell;
3.5
3.6
3.7 +typedef struct {
3.8 + unsigned col, row;
3.9 +} GridCoord;
3.10 +
3.11 +
3.12 /** Abstract superclass of regular geometric grids of GridCells that Bits can be placed on. */
3.13 @interface Grid : GGBLayer
3.14 {
4.1 --- a/Source/Grid.m Thu Jul 31 13:23:44 2008 -0700
4.2 +++ b/Source/Grid.m Thu Jul 31 20:01:26 2008 -0700
4.3 @@ -167,8 +167,10 @@
4.4 cell = [self createCellAtRow: row column: col suggestedFrame: frame];
4.5 if( cell ) {
4.6 [_cells replaceObjectAtIndex: index withObject: cell];
4.7 - //[self addSublayer: cell];
4.8 - [self insertSublayer: cell atIndex: 0];
4.9 + if( _reversed )
4.10 + [self addSublayer: cell];
4.11 + else
4.12 + [self insertSublayer: cell atIndex: 0];
4.13 [self setNeedsDisplay];
4.14 }
4.15 }
4.16 @@ -178,7 +180,7 @@
4.17
4.18 - (void) addAllCells
4.19 {
4.20 - for( int row=_nRows-1; row>=0; row-- ) // makes 'upper' cells be in 'back'
4.21 + for( int row=0; row<_nRows; row++ )
4.22 for( int col=0; col<_nColumns; col++ )
4.23 [self addCellAtRow: row column: col];
4.24 }