Oolite
Loading...
Searching...
No Matches
ShipEntity(LoadRestoreInternal) Category Reference

Instance Methods

(void) - simplifyShipdata:andGetDeletes:
 

Detailed Description

Definition at line 70 of file ShipEntityLoadRestore.m.

Method Documentation

◆ simplifyShipdata:andGetDeletes:

- (void) simplifyShipdata: (NSMutableDictionary *)  data
andGetDeletes: (NSArray **)  deletes 

Extends class ShipEntity.

Definition at line 362 of file ShipEntityLoadRestore.m.

263 :(NSMutableDictionary *)data andGetDeletes:(NSArray **)deletes
264{
265 NSParameterAssert(data != nil && deletes != NULL);
266 *deletes = nil;
267
268 // Get original ship data.
269 NSMutableDictionary *referenceData = [NSMutableDictionary dictionaryWithDictionary:[[OOShipRegistry sharedRegistry] shipInfoForKey:[self shipDataKey]]];
270
271 // Discard stuff that we handle separately.
272 StripIgnoredKeys(referenceData);
273 StripIgnoredKeys(data);
274
275 // Note items that are in referenceData, but not data.
276 NSMutableArray *foundDeletes = [NSMutableArray array];
277 NSString *key = nil;
278 foreachkey (key, referenceData)
279 {
280 if ([data objectForKey:key] == nil)
281 {
282 [foundDeletes addObject:key];
283 }
284 }
285 if ([foundDeletes count] != 0) *deletes = foundDeletes;
286
287 // after rev3010 this loop was using cycles without doing anything - commenting this whole loop out for now. -- kaks 20100207
288/*
289 // Discard anything that hasn't changed.
290 for (enumerator = [data keyEnumerator]; (key = [enumerator nextObject]); )
291 {
292 id referenceVal = [referenceData objectForKey:key];
293 id myVal = [data objectForKey:key];
294 if ([referenceVal isEqual:myVal])
295 {
296 // [data removeObjectForKey:key];
297 }
298 }
299*/
300}
#define foreachkey(VAR, DICT)
Definition OOCocoa.h:353
unsigned count
return nil
static void StripIgnoredKeys(NSMutableDictionary *dict)
OOShipRegistry * sharedRegistry()
NSDictionary * shipInfoForKey:(NSString *key)

The documentation for this category was generated from the following file: