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

Diff of /hegemonie/GameEngine/HgObject.m

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

revision 1.10 by thunder, Thu Aug 14 08:40:15 2003 UTC revision 1.11 by nicov, Mon Aug 18 10:31:59 2003 UTC
# Line 63  Line 63 
63        _position = position;        _position = position;
64      }      }
65        
   [[NSNotificationCenter defaultCenter]  
     postNotificationName:@"updateObject" object: _game];  
   
66    return self;    return self;
67  }  }
68    
# Line 112  Line 109 
109  /**  /**
110   * Set the current position of the object.   * Set the current position of the object.
111   * The position must be contained in the map.   * The position must be contained in the map.
112   * Post an notification named "updateObject" containing the current object.   * Post an notification named "updateObject" containing the current game and
113     * the current object.
114   */   */
115  - (void) setPosition: (coord_t)position  - (void) setPosition: (coord_t)position
116  {  {
# Line 121  Line 119 
119     */     */
120    //[_position mapContainsPosition: position]    //[_position mapContainsPosition: position]
121        
   [[NSNotificationCenter defaultCenter]  
     postNotificationName:@"updateObject" object: _game];  
     
122    _position = position;    _position = position;
123    
124      [[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject"
125                                                          object: _game
126                    userInfo: [NSDictionary dictionaryWithObject: self
127                                                          forKey: @"HgObject"]];
128    
129  }  }
130    
131  /**  /**
# Line 137  Line 138 
138    
139  /**  /**
140   * Set the orientation of the object.   * Set the orientation of the object.
141   * Post an notification named "updateObject" containing the current object.   * Post an notification named "updateObject" containing the current game and
142     * the current object.
143   */   */
144  - (void) setOrientation: (coord_t)orientation  - (void) setOrientation: (coord_t)orientation
145  {  {
   [[NSNotificationCenter defaultCenter]  
     postNotificationName:@"updateObject" object: _game];  
   
146    _orientation = orientation;    _orientation = orientation;
147    
148      [[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject"
149                                                          object: _game
150                    userInfo: [NSDictionary dictionaryWithObject: self
151                                                          forKey: @"HgObject"]];
152  }  }
153    
154  /* FIXME implementation a revoir */  /* FIXME implementation a revoir */
# Line 168  Line 172 
172    NSParameterAssert (![_boundingBoxes containsObject: boundingBoxes]);    NSParameterAssert (![_boundingBoxes containsObject: boundingBoxes]);
173    
174    [_boundingBoxes addObject: boundingBoxes];    [_boundingBoxes addObject: boundingBoxes];
175    
176      [[NSNotificationCenter defaultCenter] postNotificationName: @"updateObject"
177                                                          object: _game
178                    userInfo: [NSDictionary dictionaryWithObject: self
179                                                          forKey: @"HgObject"]];
180  }  }
181    
182  - (void) collide: (HgObject *)object  - (void) collide: (HgObject *)object
# Line 180  Line 189 
189  @implementation HgObject (NSCoding)  @implementation HgObject (NSCoding)
190    
191  /**  /**
192   * NSCoding method   * NSCoding method  to encode and decode objects
193   * to encode and decode objects   */
    */  
194  - (void)encodeWithCoder: (NSCoder *)encoder  - (void)encodeWithCoder: (NSCoder *)encoder
195  {  {
196    [encoder encodeValueOfObjCType: "I" at: &_identifier];    [encoder encodeValueOfObjCType: "I" at: &_identifier];
# Line 195  Line 203 
203  {  {
204    [decoder decodeValueOfObjCType: "I" at: &_identifier];    [decoder decodeValueOfObjCType: "I" at: &_identifier];
205    NSNumber *numIdent = [NSNumber numberWithInt: _identifier];    NSNumber *numIdent = [NSNumber numberWithInt: _identifier];
206      
207    //HgGame *current = [HgGame currentGame];    HgGame *currentGame = [HgGame currentGame];
208    HgObject *object = [[_game objects] objectForKey: numIdent];    HgObject *object = [[currentGame objects] objectForKey: numIdent];
209      
210    if (object != nil)    if (object != nil)
211      {      {
212        DESTROY(self);        DESTROY(self);

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