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

Diff of /hegemonie/Network/NetInfosClient.m

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

revision 1.1 by thunder, Mon May 26 10:21:21 2003 UTC revision 1.2 by nicov, Tue May 27 10:41:31 2003 UTC
# Line 40  Line 40 
40  @implementation NetInfosClient  @implementation NetInfosClient
41    
42  /**  /**
43   * Initialise NetInfosClient with an existing NetParty and with   * Initialize NetInfosClient with an existing NetParty and with
44   * the connection used by the client to communicate with the server.   * the connection used by the client to communicate with the server.
45   * The NetClient associated with this object is not initialised yet.   * The proxy associated with this object is not initialised yet.
46   * You have to initialise it after.   * You have to initialise it after with setProxy.
47   */   */
48  - (id) initWithParty: (NetParty *)party  - (id) initWithParty: (NetParty *)party
49             withProxy: (NSDistantObject<NetClient> *)proxy        withConnection: (NSConnection *)connection
50            playerName: (NSString *)name            playerName: (NSString *)name
51  {  {
52    NSParameterAssert (party);    NSParameterAssert (party);
53    NSParameterAssert (proxy);    NSParameterAssert (connection);
54    NSParameterAssert (name);    NSParameterAssert (name);
55    NSParameterAssert ([name length] != 0);    NSParameterAssert ([name length] != 0);
56    
# Line 58  Line 58 
58    
59    if (self != nil)    if (self != nil)
60      {      {
61        _party = RETAIN(party);        _party = RETAIN (party);
62        _proxy = RETAIN(proxy);        _connection = RETAIN (connection);
63        //_host = RETAIN(host);        //_host = RETAIN(host);
64        _isAdministrator = NO;        _isAdministrator = NO;
65    
# Line 83  Line 83 
83   */   */
84  - (void) dealloc  - (void) dealloc
85  {  {
86    RELEASE(_party);    RELEASE (_party);
87    RELEASE(_proxy);    RELEASE (_connection);
88      RELEASE (_proxy);
89    //  RELEASE(_host);    //  RELEASE(_host);
90    RELEASE(_player);    RELEASE (_player);
91    RELEASE(_playerState);    RELEASE (_playerState);
92    
93    [super dealloc];    [super dealloc];
94  }  }
95    
96  /**  /**
97   * This will disconnect the client from the current party.   * This will set the proxy associated with this object.
98     */
99    - (void) createProxy
100    {
101      _proxy = RETAIN ([_connection rootProxy]);
102    
103    }
104    
105    /**
106     * This is a method of the delegate object.
107     */
108    - (BOOL) connection: (NetConnection *)parent
109    shouldMakeNewConnection: (NetConnection *)newConnection
110    {
111      return NO;
112    }
113    
114    /**
115     * Bloquing other connection on the connection's receivePort of this object
116     */
117    - (void) delegateClient
118    {
119      NetConnection *defConnection =
120        [NetConnection connectionWithReceivePort: [_connection receivePort]
121                                        sendPort: [_connection receivePort]];
122      [defConnection setDelegate: self];
123    }
124    
125    
126    /**
127     * Disconnects the client from the current party.
128   */   */
129  - (void) disconnect  - (void) disconnect
130  {  {
# Line 109  Line 140 
140  }  }
141    
142  /**  /**
143   * This will update the player's state   * Updates the player's state
144   */   */
145  - (void) updatePlayerState: (HgPlayerState *)playerState  - (void) updatePlayerState: (HgPlayerState *)playerState
146  {  {
# Line 129  Line 160 
160  }  }
161    
162  /**  /**
163   * This will send command to the server   * Sends command to the server
164   * command will be executed only if the client who send it is administrator   * command will be executed only if the client who send it is administrator
165   */   */
166  - (NSString *) execCommand: (NSString *)command  - (NSString *) execCommand: (NSString *)command
# Line 140  Line 171 
171  }  }
172    
173  /**  /**
174   * This will send message to the server, to communicate between   * Sends message to the server, to communicate between
175   * players of the same team.   * players of the same team.
176   */   */
177  - (void) talk: (NSString *)message  - (void) talk: (NSString *)message
# Line 150  Line 181 
181  }  }
182    
183  /**  /**
184   * This will change the permission of the client   * Changes the permission of the client
185   * if flag is TRUE then the client becomes an administrator.   * if flag is TRUE then the client becomes an administrator.
186   */   */
187  - (void) setAdministrator: (BOOL)flag  - (void) setAdministrator: (BOOL)flag
# Line 191  Line 222 
222    return _playerState;    return _playerState;
223  }  }
224    
 /**  
  * This is a method of the delegate object.  
  */  
 - (BOOL) connection: (NetConnection *)parent  
 shouldMakeNewConnection: (NetConnection *)newConnection  
 {  
   return NO;  
 }  
225    
226  @end  @end

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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