Source/Player.h
author Jens Alfke <jens@mooseyard.com>
Mon Jul 21 17:32:21 2008 -0700 (2008-07-21)
changeset 21 2eb229411d73
parent 13 db7bb080c3d5
permissions -rw-r--r--
* Added API to Stack for removing bits.
* GoGame correctly saves/restores number of captured pieces.
* Improved positioning of captured-piece Stacks in GoGame.
* New Go piece icons.
* Added "Warn" function to GGBUtils.
     1 //
     2 //  Player.h
     3 //  YourMove
     4 //
     5 //  Created by Jens Alfke on 7/3/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import <Foundation/Foundation.h>
    10 @class Game;
    11 
    12 
    13 /** A mostly-passive object used to represent a player. */
    14 @interface Player : NSObject <NSCoding>
    15 {
    16     Game *_game;
    17     NSString *_name;
    18     BOOL _local;
    19     NSMutableDictionary *_extraValues;
    20 }
    21 
    22 - (id) initWithGame: (Game*)game;
    23 - (id) initWithName: (NSString*)name;
    24 
    25 - (id) initWithCoder: (NSCoder*)decoder;
    26 - (void) encodeWithCoder: (NSCoder*)coder;
    27 
    28 @property (copy) NSString *name;                            // Display name
    29 @property (readonly) CGImageRef icon;                       // An icon to display (calls game.iconForPlayer:)
    30 
    31 @property (readonly) Game *game;
    32 @property (readonly) int index;                             // Player's index in the Game's -players array
    33 @property (readwrite,getter=isLocal) BOOL local;            // Is player a human at this computer? (Defaults to YES)
    34 @property (readonly, getter=isCurrent) BOOL current;        // Is it this player's turn?
    35 @property (readonly, getter=isFriendly) BOOL friendly;      // Is this player the current player or an ally?
    36 @property (readonly, getter=isUnfriendly) BOOL unfriendly;  // Is this player an opponent of the current player?
    37 @property (readonly) Player *nextPlayer, *previousPlayer;   // The next/previous player in sequence
    38 
    39 /** Copy all of the player's attributes (name, local...) into myself. */
    40 - (void) copyFrom: (Player*)player;
    41 @end
    42 
    43 
    44 
    45 @interface CALayer (Game)
    46 
    47 /** Called on any CALayer in the game's layer tree, will return the current Game object. */
    48 @property (readonly) Game *game;
    49 
    50 @end