71 |
self = [super init]; |
self = [super init]; |
72 |
if (self != nil) |
if (self != nil) |
73 |
{ |
{ |
74 |
// _gameList = [[NSMutableArray init] alloc]; |
//_gameList = [[NSMutableArray init] alloc]; |
75 |
_gameList = [NSMutableArray array]; |
_gameList = [NSMutableArray array]; |
76 |
} |
} |
77 |
|
|
150 |
NSDictionary *infosServer; |
NSDictionary *infosServer; |
151 |
|
|
152 |
while ( (infosServer = [enumerator nextObject]) ) { |
while ( (infosServer = [enumerator nextObject]) ) { |
153 |
|
printf(" numplayers = %d\n", [[infosServer objectForKey: @"num_players"] |
154 |
|
intValue]); |
155 |
|
|
156 |
[self _addGameIDWithHost: [NSHost hostWithAddress: |
[self _addGameIDWithHost: [NSHost hostWithAddress: |
157 |
[infosServer objectForKey: @"address"]] |
[infosServer objectForKey: @"address"]] |
158 |
gameName: [infosServer objectForKey: @"game_name"] |
gameName: [infosServer objectForKey: @"game_name"] |
188 |
NSDistantObject<NetParty> *party; |
NSDistantObject<NetParty> *party; |
189 |
NSPort *receivePort; |
NSPort *receivePort; |
190 |
|
|
191 |
printf ("Entre ds connectToGame\n"); |
game = [[HgGame init] alloc]; |
192 |
|
|
|
|
|
193 |
/** --- FIXE ME ---- Error message without cast **/ |
/** --- FIXE ME ---- Error message without cast **/ |
194 |
receivePort = (NSPort *)[NSPort port]; |
receivePort = (NSPort *)[NSPort port]; |
195 |
|
|
|
printf ("registeredName = %s\n", [[gameID gameName] cString]); |
|
|
printf ("hostAddress = %s\n", [[[gameID host] address] cString]); |
|
|
printf ("hostName = %s\n", [[[gameID host] name] cString]); |
|
|
|
|
|
|
|
196 |
party = [NetConnection rootProxyForConnectionWithRegisteredName: |
party = [NetConnection rootProxyForConnectionWithRegisteredName: |
197 |
[gameID gameName] |
[gameID gameName] |
198 |
host: [[gameID host] name]]; |
host: [[gameID host] name]]; |
199 |
|
|
|
printf ("Connexion etablie\n"); |
|
|
|
|
|
|
|
200 |
NSPort *sendPort = [party connectWithName: playerName |
NSPort *sendPort = [party connectWithName: playerName |
201 |
withPort: receivePort |
withPort: receivePort |
202 |
initGame: &game]; |
initGame: &game]; |
203 |
|
|
204 |
RETAIN(game); |
RETAIN(game); |
249 |
NSParameterAssert (master); |
NSParameterAssert (master); |
250 |
NSParameterAssert (mapName); |
NSParameterAssert (mapName); |
251 |
|
|
252 |
|
printf ("AddGameID\n"); |
253 |
|
printf ("numPlayers = %d\n", numPlayers); |
254 |
|
|
255 |
|
|
256 |
NetGameID *game = [[NetGameID alloc] initWithHost: host |
NetGameID *game = [[NetGameID alloc] initWithHost: host |
257 |
gameName: gameName |
gameName: gameName |
258 |
numPlayers: numPlayers |
numPlayers: numPlayers |