136 |
NSParameterAssert (gameID); |
NSParameterAssert (gameID); |
137 |
NSParameterAssert (playerName); |
NSParameterAssert (playerName); |
138 |
|
|
139 |
HgGame *game = AUTORELEASE([[HgGame alloc] init]); |
HgGame *game; |
140 |
|
game = [[HgGame alloc] init]; |
141 |
|
|
142 |
NSPort *receivePort = [NSPort port]; |
NSPort *receivePort = [NSPort port]; |
143 |
|
|
144 |
NSPort *sendPort = [[gameID party] connectWithName: playerName |
NSPort *sendPort = [[gameID party] connectWithName: playerName |
145 |
withPort: receivePort |
withPort: receivePort |
146 |
initGame: game]; |
initGame: &game]; |
147 |
|
RETAIN(game); |
148 |
|
|
149 |
if (sendPort != nil) |
if (sendPort != nil) |
150 |
{ |
{ |
151 |
NetConnection *cnx = [NetConnection |
NetConnection *cnx = [NetConnection |
152 |
connectionWithReceivePort: receivePort |
connectionWithReceivePort: receivePort |
153 |
sendPort: sendPort]; |
sendPort: sendPort]; |
154 |
|
|
155 |
NSDistantObject<NetInfosClient> *serverInfosClient = [cnx rootProxy]; |
NSDistantObject<NetInfosClient> *serverInfosClient = [cnx rootProxy]; |
156 |
|
|
157 |
NetClient *client = AUTORELEASE ([[NetClient alloc] |
NetClient *client = [[NetClient alloc] |
158 |
initWithProxy: serverInfosClient |
initWithProxy: serverInfosClient |
159 |
withGame: game]); |
withGame: game]; |
160 |
|
|
161 |
[cnx setRootObject: client]; |
[cnx setRootObject: client]; |
|
|
|
|
//envoi du jeu du serveur sur la machine client |
|
|
[client createGame: game]; |
|
|
|
|
162 |
[serverInfosClient createProxy]; |
[serverInfosClient createProxy]; |
163 |
[serverInfosClient delegateClient]; |
[serverInfosClient delegateClient]; |
164 |
|
|
165 |
//RELEASE(game); |
//RELEASE(game); |
166 |
|
|
167 |
return client; |
return client; |
168 |
} |
} |
169 |
else |
else |