Oolite 1.91.0.7645-241119-222d325
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 365 of file ShipEntityLoadRestore.m.

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