1.1 --- a/Source/Game.m Thu Jul 03 17:44:30 2008 -0700
1.2 +++ b/Source/Game.m Tue Jul 08 20:32:52 2008 -0700
1.3 @@ -125,20 +125,22 @@
1.4 - (void) setBoard: (GGBLayer*)board
1.5 {
1.6 setObj(&_board,board);
1.7 - // Store a pointer to myself as the value of the "Game" property
1.8 - // of my root layer. (CALayers can have arbitrary KV properties stored into them.)
1.9 - // This is used by the -[CALayer game] category method defined below, to find the Game.
1.10 - [_board setValue: self forKey: @"Game"];
1.11 -
1.12 - BeginDisableAnimations();
1.13 -
1.14 - // Tell the game to add the necessary bits to the board:
1.15 - [self setUpBoard];
1.16 -
1.17 - // Re-apply the current state to set up the pieces/cards:
1.18 - self.stateString = [[_turns objectAtIndex: _currentTurnNo] boardState];
1.19 -
1.20 - EndDisableAnimations();
1.21 + if( board ) {
1.22 + // Store a pointer to myself as the value of the "Game" property
1.23 + // of my root layer. (CALayers can have arbitrary KV properties stored into them.)
1.24 + // This is used by the -[CALayer game] category method defined below, to find the Game.
1.25 + [_board setValue: self forKey: @"Game"];
1.26 +
1.27 + BeginDisableAnimations();
1.28 +
1.29 + // Tell the game to add the necessary bits to the board:
1.30 + [self setUpBoard];
1.31 +
1.32 + // Re-apply the current state to set up the pieces/cards:
1.33 + self.stateString = [[_turns objectAtIndex: _currentTurnNo] boardState];
1.34 +
1.35 + EndDisableAnimations();
1.36 + }
1.37 }
1.38
1.39