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

Instance Methods

(void) - simplifyShipdata:andGetDeletes:

Detailed Description

Definition at line 67 of file ShipEntityLoadRestore.m.

Method Documentation

◆ simplifyShipdata:andGetDeletes:

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

Extends class ShipEntity.

Definition at line 251 of file ShipEntityLoadRestore.m.

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

References count, foreachkey, nil, OOShipRegistry::sharedRegistry, ShipEntity::shipDataKey, OOShipRegistry::shipInfoForKey:, and StripIgnoredKeys().

Referenced by ShipEntity(LoadRestore)::savedShipDictionaryWithContext:.

Here is the call graph for this function:
Here is the caller graph for this function:

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