Source/Game.m
changeset 20 7c9ecb09a612
parent 15 73f8c889f053
child 21 2eb229411d73
     1.1 --- a/Source/Game.m	Wed Jul 09 17:07:45 2008 -0700
     1.2 +++ b/Source/Game.m	Fri Jul 18 13:26:59 2008 -0700
     1.3 @@ -68,11 +68,11 @@
     1.4  }
     1.5  
     1.6  
     1.7 -- (id) initNewGameWithBoard: (GGBLayer*)board
     1.8 +- (id) initNewGameWithTable: (GGBLayer*)board
     1.9  {
    1.10      self = [self init];
    1.11      if( self ) {
    1.12 -        self.board = board;
    1.13 +        self.table = board;
    1.14          NSAssert1(_players && _turns, @"%@ failed to set numberOfPlayers",self);
    1.15      }
    1.16      return self;
    1.17 @@ -81,7 +81,7 @@
    1.18  
    1.19  - (void) dealloc
    1.20  {
    1.21 -    [_board release];
    1.22 +    [_table release];
    1.23      [_players release];
    1.24      [_turns release];
    1.25      [_extraValues release];
    1.26 @@ -117,19 +117,19 @@
    1.27      NSAssert1(NO,@"%@ forgot to implement -setUpBoard",[self class]);
    1.28  }
    1.29  
    1.30 -- (GGBLayer*) board
    1.31 +- (GGBLayer*) table
    1.32  {
    1.33 -    return _board;
    1.34 +    return _table;
    1.35  }
    1.36  
    1.37 -- (void) setBoard: (GGBLayer*)board
    1.38 +- (void) setTable: (GGBLayer*)board
    1.39  {
    1.40 -    setObj(&_board,board);
    1.41 +    setObj(&_table,board);
    1.42      if( board ) {
    1.43          // Store a pointer to myself as the value of the "Game" property
    1.44          // of my root layer. (CALayers can have arbitrary KV properties stored into them.)
    1.45          // This is used by the -[CALayer game] category method defined below, to find the Game.
    1.46 -        [_board setValue: self forKey: @"Game"];
    1.47 +        [_table setValue: self forKey: @"Game"];
    1.48          
    1.49          BeginDisableAnimations();
    1.50          
    1.51 @@ -263,7 +263,7 @@
    1.52      if( curTurn.status > kTurnEmpty && curTurn.status < kTurnFinished ) {
    1.53          if( _winner )
    1.54              self.winner = nil;
    1.55 -        if( _board )
    1.56 +        if( _table )
    1.57              self.stateString = curTurn.previousTurn.boardState;
    1.58          curTurn.status = kTurnEmpty;
    1.59      }
    1.60 @@ -308,7 +308,7 @@
    1.61      NSParameterAssert(turnNo<=self.maxTurnNo);
    1.62      unsigned oldTurnNo = _currentTurnNo;
    1.63      if( turnNo != oldTurnNo ) {
    1.64 -        if( _board ) {
    1.65 +        if( _table ) {
    1.66              Turn *turn = [_turns objectAtIndex: turnNo];
    1.67              NSString *state;
    1.68              if( turn.status == kTurnEmpty )
    1.69 @@ -325,7 +325,6 @@
    1.70                      @try{
    1.71                          if( ! [self applyMoveString: move] ) {
    1.72                              _currentTurnNo = oldTurnNo;
    1.73 -                            NSBeep();
    1.74                              NSLog(@"WARNING: %@ failed to apply stored move '%@'!", self,move);
    1.75                              return;
    1.76                          }
    1.77 @@ -341,7 +340,6 @@
    1.78              }
    1.79              if( ! [self.stateString isEqual: state] ) {
    1.80                  _currentTurnNo = oldTurnNo;
    1.81 -                NSBeep();
    1.82                  NSLog(@"WARNING: %@ failed to apply stored state '%@'!", self,state);
    1.83                  return;
    1.84              }
    1.85 @@ -360,7 +358,7 @@
    1.86                || ! [self canBit: bit moveFrom: src to: dst] )
    1.87          return NO;
    1.88      
    1.89 -    ChangeSuperlayer(bit, _board.superlayer, -1);
    1.90 +    ChangeSuperlayer(bit, _table.superlayer, -1);
    1.91      bit.pickedUp = YES;
    1.92      dst.highlighted = YES;
    1.93      [bit performSelector: @selector(setPickedUp:) withObject:nil afterDelay: 0.15];
    1.94 @@ -397,8 +395,8 @@
    1.95          if( oldHolder != dst ) 
    1.96              return [self animateMoveFrom: oldHolder to: dst];
    1.97      } else
    1.98 -        bit.position = [dst convertPoint: GetCGRectCenter(dst.bounds) toLayer: _board.superlayer];
    1.99 -    ChangeSuperlayer(bit, _board.superlayer, -1);
   1.100 +        bit.position = [dst convertPoint: GetCGRectCenter(dst.bounds) toLayer: _table.superlayer];
   1.101 +    ChangeSuperlayer(bit, _table.superlayer, -1);
   1.102      bit.pickedUp = YES;
   1.103      dst.highlighted = YES;
   1.104