/[hegemonie]/hegemonie/Network/NetParty.m
ViewVC logotype

Diff of /hegemonie/Network/NetParty.m

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by nicov, Fri Jul 25 13:29:34 2003 UTC revision 1.11 by nicov, Wed Aug 13 12:41:23 2003 UTC
# Line 27  Line 27 
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"
# Line 157  Line 158 
158    
159    [_clients removeObject: client];    [_clients removeObject: client];
160    
161    [NetServer updateServerListWithParty : self];    [_server updateServerListWithParty : self];
162  }  }
163    
164  /**  /**
# Line 265  Line 266 
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        
# Line 284  Line 281 
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  {  {
# Line 293  Line 291 
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  {  {
# Line 308  Line 314 
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    
# Line 353  Line 366 
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    
# Line 422  Line 438 
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  {  {
# Line 433  Line 450 
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];

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26