60 |
/** |
/** |
61 |
* Initialise an object which will be contained in game. |
* Initialise an object which will be contained in game. |
62 |
* The position must be contained in the game map. |
* The position must be contained in the game map. |
63 |
|
* The HgPlayer's pointer is necessary to know the player who owes this object. |
64 |
|
* If nobody owes this object, the pointer is nil. |
65 |
*/ |
*/ |
66 |
- (id) initWithGame: (HgGame *)game |
- (id) initWithGame: (HgGame *)game |
67 |
|
withPlayer: (HgPlayer *)player |
68 |
position: (coord_t)position |
position: (coord_t)position |
69 |
{ |
{ |
70 |
/* |
/* |
85 |
_delegate = nil; |
_delegate = nil; |
86 |
[self setPosition: position]; |
[self setPosition: position]; |
87 |
_game = RETAIN(game); |
_game = RETAIN(game); |
88 |
|
_player = RETAIN(player); |
89 |
} |
} |
90 |
|
|
91 |
return self; |
return self; |
95 |
{ |
{ |
96 |
RELEASE(_delegate); |
RELEASE(_delegate); |
97 |
RELEASE(_game); |
RELEASE(_game); |
98 |
|
RELEASE(_player); |
99 |
|
|
100 |
[super dealloc]; |
[super dealloc]; |
101 |
} |
} |
102 |
|
|
103 |
/** |
/** |
104 |
|
* Returns the player. |
105 |
|
*/ |
106 |
|
- (HgPlayer *) player |
107 |
|
{ |
108 |
|
return _player; |
109 |
|
} |
110 |
|
|
111 |
|
/** |
112 |
* Returns the object identifier. |
* Returns the object identifier. |
113 |
*/ |
*/ |
114 |
- (unsigned) identifier |
- (unsigned) identifier |