27 |
#include <Foundation/NSArray.h> |
#include <Foundation/NSArray.h> |
28 |
#include <Foundation/NSException.h> |
#include <Foundation/NSException.h> |
29 |
#include <Foundation/NSNotification.h> |
#include <Foundation/NSNotification.h> |
30 |
|
#include <Foundation/NSDistantObject.h> |
31 |
|
|
32 |
#include "Network/NetParty.h" |
#include "Network/NetParty.h" |
33 |
#include "Network/NetClient.h" |
#include "Network/NetClient.h" |
158 |
|
|
159 |
[_clients removeObject: client]; |
[_clients removeObject: client]; |
160 |
|
|
161 |
[NetServer updateServerListWithParty : self]; |
[_server updateServerListWithParty : self]; |
162 |
} |
} |
163 |
|
|
164 |
/** |
/** |
266 |
RELEASE(newClient); |
RELEASE(newClient); |
267 |
|
|
268 |
/* update meta server */ |
/* update meta server */ |
269 |
[NetServer updateServerListWithParty : self]; |
[_server updateServerListWithParty : self]; |
270 |
|
|
|
printf(" Etat du jeu avant mise a jour : %s\n", [[*game name] cString]); |
|
|
|
|
271 |
/* this game is returned through the network via bycopy, |
/* this game is returned through the network via bycopy, |
272 |
* so we shouldn't retain it */ |
* so we shouldn't retain it */ |
273 |
*game = _game; |
*game = _game; |
274 |
|
|
|
printf(" Etat du jeu apres mise a jour : %s\n", [[*game name] cString]); |
|
|
|
|
275 |
return receivePort; |
return receivePort; |
276 |
} |
} |
277 |
|
|
281 |
|
|
282 |
/** |
/** |
283 |
* Create an object from notification on all the clients. |
* Create an object from notification on all the clients. |
284 |
|
* If a client does not respond then it is disconnected. |
285 |
*/ |
*/ |
286 |
- (void) createObject:(NSNotification *)notification |
- (void) createObject:(NSNotification *)notification |
287 |
{ |
{ |
291 |
NetInfosClient *client; |
NetInfosClient *client; |
292 |
while ( (client = [enumerator nextObject]) ) |
while ( (client = [enumerator nextObject]) ) |
293 |
{ |
{ |
294 |
[[client proxy] createObject: obj]; |
if ([[[client proxy] connectionForProxy] isValid]) |
295 |
|
{ |
296 |
|
[[client proxy] createObject: obj]; |
297 |
|
} |
298 |
|
else |
299 |
|
{ |
300 |
|
[self disconnect: client]; |
301 |
|
} |
302 |
} |
} |
303 |
} |
} |
304 |
|
|
305 |
/** |
/** |
306 |
* Destroy an object from notification on all the clients. |
* Destroy an object from notification on all the clients. |
307 |
|
* If a client does not respond then it is disconnected. |
308 |
*/ |
*/ |
309 |
- (void) destroyObject:(NSNotification *)notification |
- (void) destroyObject:(NSNotification *)notification |
310 |
{ |
{ |
314 |
NetInfosClient *client; |
NetInfosClient *client; |
315 |
while ( (client = [enumerator nextObject]) ) |
while ( (client = [enumerator nextObject]) ) |
316 |
{ |
{ |
317 |
[[client proxy] destroyObject: obj]; |
if ([[[client proxy] connectionForProxy] isValid]) |
318 |
|
{ |
319 |
|
[[client proxy] destroyObject: obj]; |
320 |
|
} |
321 |
|
else |
322 |
|
{ |
323 |
|
[self disconnect: client]; |
324 |
|
} |
325 |
} |
} |
326 |
} |
} |
327 |
|
|
366 |
NetInfosClient *client; |
NetInfosClient *client; |
367 |
while ( (client = [enumerator nextObject]) ) |
while ( (client = [enumerator nextObject]) ) |
368 |
{ |
{ |
369 |
[[client proxy] destroyPlayer: player]; |
if ([[[client proxy] connectionForProxy] isValid]) |
370 |
|
{ |
371 |
|
[[client proxy] destroyPlayer: player]; |
372 |
|
} |
373 |
} |
} |
374 |
} |
} |
375 |
|
|
438 |
/** |
/** |
439 |
* Send to all the clients a message to update all the updated objects on |
* Send to all the clients a message to update all the updated objects on |
440 |
* the server and remove all the objects to the list of updated objects. |
* the server and remove all the objects to the list of updated objects. |
441 |
|
* If a client does not respond then it is disconnected. |
442 |
*/ |
*/ |
443 |
- (void) sendUpdatedObjects |
- (void) sendUpdatedObjects |
444 |
{ |
{ |
450 |
NetInfosClient *client; |
NetInfosClient *client; |
451 |
while ( (client = [enumerator nextObject]) ) |
while ( (client = [enumerator nextObject]) ) |
452 |
{ |
{ |
453 |
[[client proxy] updateObject: obj]; |
if ([[[client proxy] connectionForProxy] isValid]) |
454 |
|
{ |
455 |
|
[[client proxy] updateObject: obj]; |
456 |
|
} |
457 |
|
else |
458 |
|
{ |
459 |
|
[self disconnect: client]; |
460 |
|
} |
461 |
} |
} |
462 |
} |
} |
463 |
[_updatedObjects removeAllObjects]; |
[_updatedObjects removeAllObjects]; |