/[hegemonie]/hegemonie/GameEngine/HgTeam.m
ViewVC logotype

Diff of /hegemonie/GameEngine/HgTeam.m

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

revision 1.8 by thunder, Tue Jul 22 13:25:18 2003 UTC revision 1.9 by nicov, Fri Jul 25 13:48:59 2003 UTC
# Line 25  Line 25 
25  #include <Foundation/NSException.h>  #include <Foundation/NSException.h>
26  #include <Foundation/NSCoder.h>  #include <Foundation/NSCoder.h>
27  #include <Foundation/NSValue.h>  #include <Foundation/NSValue.h>
28    #include <Foundation/NSNotification.h>
29    
30  #include "GameEngine/HgTeam.h"  #include "GameEngine/HgTeam.h"
31  #include "GameEngine/HgGame.h"  #include "GameEngine/HgGame.h"
# Line 80  Line 81 
81  }  }
82    
83  /**  /**
84   * add a player to the team.   * Add a player to the team.
85   * The player must exist and mustn't be already in the team   * The player must exist and mustn't be already in the team
86   * already contains the player   * already contains the player.
87     * Post an notification named "updateTeam" containing the current object.
88   */   */
89  - (void) addPlayer: (HgPlayer *)player  - (void) addPlayer: (HgPlayer *)player
90  {  {
# Line 91  Line 93 
93    NSParameterAssert (![_players containsObject: player]);    NSParameterAssert (![_players containsObject: player]);
94        
95    [_players addObject: player];    [_players addObject: player];
96    
97      [[NSNotificationCenter defaultCenter]
98        postNotificationName:@"updateTeam" object:self];
99  }  }
100    
101  /**  /**
102   * Remove a player to the team.   * Remove a player to the team.
103   * the player must be in the team.   * The player must be in the team.
104     * Post an notification named "updateTeam" containing the current object.
105   */   */
106  - (void) removePlayer: (HgPlayer *)player  - (void) removePlayer: (HgPlayer *)player
107  {  {
# Line 103  Line 109 
109    NSParameterAssert ([_players containsObject: player]);    NSParameterAssert ([_players containsObject: player]);
110    
111    [_players removeObject: player];    [_players removeObject: player];
112    
113      [[NSNotificationCenter defaultCenter]
114        postNotificationName:@"updateTeam" object:self];
115  }  }
116    
117  /**  /**
# Line 148  Line 157 
157        
158    if (self != nil)    if (self != nil)
159      {      {
160        ASSIGN(_name, [decoder decodeObject]);        _name = RETAIN([decoder decodeObject]);
161        [decoder decodeValueOfObjCType: "i" at: &_maxPlayers];        [decoder decodeValueOfObjCType: "i" at: &_maxPlayers];
162        ASSIGN(_players, [decoder decodeObject]);        _players = RETAIN([decoder decodeObject]);
163      }      }
164        
165    return self;    return self;

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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